Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 6|回复: 6
打印 上一主题 下一主题

下面在新的横屏基础上,进行复制buffer

[复制链接]

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
跳转到指定楼层
楼主
发表于 2016-4-29 19:43:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
下面在新的横屏基础上,进行复制buffer
回复

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
沙发
 楼主| 发表于 2016-4-29 20:01:17 | 只看该作者
第一步,修改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;
}

回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
板凳
 楼主| 发表于 2016-4-29 20:25:22 | 只看该作者
先写复制函数,然后看看是那个地方影响了视频投射口的。
/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>>++
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
地板
 楼主| 发表于 2016-4-29 20:30:24 | 只看该作者
下面看看是那个程序影响投射口了?
第一,/media/doraemon/express/alps_ok/frameworks/native/libs/gui/Surface.cpp文件
暂时看和这个文件没有关系。
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
5#
 楼主| 发表于 2016-4-29 20:37:30 | 只看该作者
下面看看这个文件中的修改:
/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/DisplayHardware/HWComposer.cpp
暂时和这个没有关系
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
6#
 楼主| 发表于 2016-4-29 20:41:51 | 只看该作者
看看/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp中的修改:
好像也与这个地方无关
回复 支持 反对

使用道具 举报

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
7#
 楼主| 发表于 2016-4-29 20:51:49 | 只看该作者
下面看看Layer:/media/doraemon/express/alps_ok/frameworks/native/services/surfaceflinger/Layer.cpp部分的修改
修改之后,就会导致无法开机了。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, 2025-12-15 03:59 , Processed in 0.013695 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表