Discuz! Board

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

now copy half

[复制链接]

1198

主题

2060

帖子

7058

积分

超级版主

Rank: 8Rank: 8

积分
7058
跳转到指定楼层
楼主
发表于 2016-4-20 01:34:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
void SurfaceFlinger::postFramebuffer()
{
    ATRACE_CALL();

    const nsecs_t now = systemTime();
    mDebugInSwapBuffers = now;

    HWComposer& hwc(getHwComposer());
    if (hwc.initCheck() == NO_ERROR) {
        if (!hwc.supportsFramebufferTarget()) {
            // EGL spec says:
            //   "surface must be bound to the calling thread's current context,
            //    for the current rendering API."
            getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext);
        }
        hwc.commit();
    }

    // make the default display current because the VirtualDisplayDevice code cannot
    // deal with dequeueBuffer() being called outside of the composition loop; however
    // the code below can call glFlush() which is allowed (and does in some case) call
    // dequeueBuffer().
    getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext);

    for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
        sp<const DisplayDevice> hw(mDisplays[dpy]);
#ifdef MTK_AOSP_ENHANCEMENT
        if (!hw->mustRecompose()) continue;
#endif
        const Vector< sp<Layer> >& currentLayers(hw->getVisibleLayersSortedByZ());
        hw->onSwapBuffersCompleted(hwc);
        const size_t count = currentLayers.size();
        int32_t id = hw->getHwcDisplayId();
        sp<GraphicBuffer> buf;    //zcfdebug++
        if (id >=0 && hwc.initCheck() == NO_ERROR) {
            HWComposer:ayerListIterator cur = hwc.begin(id);
            const HWComposer:ayerListIterator end = hwc.end(id);
            for (size_t i = 0; cur != end && i < count; ++i, ++cur) {
//zcfdebug++<<
                buf = currentLayers[i]->getActiveBuffer();
                ALOGE("zcfdebug here in SurfaceFlinger::postFramebuffer()");
                ALOGE("zcfdebug buf->stride is %d", buf->stride);
                ALOGE("zcfdebug buf->height is %d", buf->height);
                if(buf!=NULL){
                    uint8_t* img = NULL;

                    buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE, (void**)(&img));
                    //memcpy(img+buf->stride * buf->height*2,img,buf->stride * buf->height*2);
                    //memset(img,0,buf->stride * buf->height*4);
                    memcpy(img+buf->stride * buf->height*2,img,buf->stride * buf->height*2);
                    buf->unlock();
                }
//zcfdebug++>>
                currentLayers[i]->onLayerDisplayed(hw, &*cur);
            }
        } else {
            for (size_t i = 0; i < count; i++) {
//zcfdebug++<<
                buf = currentLayers[i]->getActiveBuffer();
                ALOGE("zcfdebug here in SurfaceFlinger::postFramebuffer()");
                ALOGE("zcfdebug buf->stride is %d", buf->stride);
                ALOGE("zcfdebug buf->height is %d", buf->height);
                if(buf!=NULL){
                    uint8_t* img = NULL;

                    buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_HW_TEXTURE, (void**)(&img));
                    //memcpy(img+buf->stride * buf->height*2,img,buf->stride * buf->height*2);
                    //memset(img,0,buf->stride * buf->height*4);
                    memcpy(img+buf->stride * buf->height*2,img,buf->stride * buf->height*2);
                    buf->unlock();
                }
//zcfdebug++>>
                currentLayers[i]->onLayerDisplayed(hw, NULL);
            }
        }
    }

    mLastSwapBufferTime = systemTime() - now;
    mDebugInSwapBuffers = 0;

    uint32_t flipCount = getDefaultDisplayDevice()->getPageFlipCount();
    if (flipCount % LOG_FRAME_STATS_PERIOD == 0) {
        logFrameStats();
    }
}
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 02:03 , Processed in 0.011364 second(s), 9 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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