Discuz! Board

标题: 下面在新的横屏基础上,进行复制buffer [打印本页]

作者: zangcf    时间: 2016-4-29 19:43
标题: 下面在新的横屏基础上,进行复制buffer
下面在新的横屏基础上,进行复制buffer

作者: zangcf    时间: 2016-4-29 20:01
第一步,修改buffer的大小为高度1920:
/media/doraemon/express/alps_ok/frameworks/native/libs/ui/GraphicBufferAllocator.cpp

status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format,
        int usage, buffer_handle_t* handle, int32_t* stride)
{
    ATRACE_CALL();
    // make sure to not allocate a N x 0 or 0 x N buffer, since this is
    // allowed from an API stand-point allocate a 1x1 buffer instead.
    if (!w || !h)
        w = h = 1;

    // we have a h/w allocator and h/w buffer is requested
    status_t err;
        //ALOGD("zcfdebug [GraphicBufferAllocator::alloc] the h is : %d", h);        //zcfdebug++
        //ALOGD("zcfdebug [GraphicBufferAllocator::alloc] the w is : %d", w);        //zcfdebug++
    if(h>=1 && h<=1920)h=1920;        //zcfdebug++
    err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);

    ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
            w, h, format, usage, err, strerror(-err));
   
    if (err == NO_ERROR) {
        Mutex::Autolock _l(sLock);
        KeyedVector<buffer_handle_t, alloc_rec_t>& list(sAllocList);
        int bpp = bytesPerPixel(format);
        if (bpp < 0) {
            // probably a HAL custom format. in any case, we don't know
            // what its pixel size is.
            bpp = 0;
        }
        alloc_rec_t rec;
        rec.w = w;
        rec.h = h;
        rec.s = *stride;
        rec.format = format;
        rec.usage = usage;
        rec.size = h * stride[0] * bpp;
        list.add(*handle, rec);
    }

#ifdef MTK_AOSP_ENHANCEMENT
    // dump call stack here after handle value got
    if (true == mIsDumpCallStack) {
        ALOGD("[GraphicBufferAllocator::alloc] handle:%p", *handle);
        CallStack stack("    ");
    }
#endif

    return err;
}


作者: zangcf    时间: 2016-4-29 20:25
先写复制函数,然后看看是那个地方影响了视频投射口的。
/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/Layer.cpp

//zcfdebug++<<
                                ALOGE("zcfdebug1 mActiveBuffer->stride is %d", mActiveBuffer->stride);
                                ALOGE("zcfdebug1 mActiveBuffer->height is %d", mActiveBuffer->height);

        if (mActiveBuffer != NULL) {
                                if(mActiveBuffer!=NULL && mActiveBuffer->height==960){
                                    uint8_t* img = NULL;
                                        ALOGE("zcfdebug1 here run buf!=NULL && buf->height==960");
                                    mActiveBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
                                        memcpy(img+mActiveBuffer->height*mActiveBuffer->stride*4,img,mActiveBuffer->stride * mActiveBuffer->height*4);
                                    mActiveBuffer->unlock();
                                }

                                if(mActiveBuffer!=NULL && mActiveBuffer->height==950){
                                    uint8_t* img = NULL;
                                        ALOGE("zcfdebug1 here run buf!=NULL && buf->height==950");
                                    mActiveBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img));
                                        memcpy(img+(mActiveBuffer->height+20)*mActiveBuffer->stride*4,img,mActiveBuffer->stride * (mActiveBuffer->height-10)*4);
                                    mActiveBuffer->unlock();
                                }

        }
//zcfdebug>>++

作者: zangcf    时间: 2016-4-29 20:30
下面看看是那个程序影响投射口了?
第一,/media/doraemon/express/alps_ok/frameworks/native/libs/gui/Surface.cpp文件
暂时看和这个文件没有关系。
作者: zangcf    时间: 2016-4-29 20:37
下面看看这个文件中的修改:
/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/DisplayHardware/HWComposer.cpp
暂时和这个没有关系
作者: zangcf    时间: 2016-4-29 20:41
看看/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp中的修改:
好像也与这个地方无关
作者: zangcf    时间: 2016-4-29 20:51
下面看看Layer:/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/Layer.cpp部分的修改
修改之后,就会导致无法开机了。




欢迎光临 Discuz! Board (http://47.89.242.157:9000/bbs/discuz/) Powered by Discuz! X3.2