通过上一篇文章我们创建了一个 EventThread 线程,并且它持有了 SurfaceFlinger 中 resyncWithRateLimit() 方法的指针。这里我们主要来看一下 EventThread 对信号的处理。

一、发送Vsync信号

        当 SurfaceFlinger 执行完 queueBuffer() 方法之后,通过 onFrameAvailable 又会回调到 SurfaceFlinger 中的 commit() 方法中。

1、SurfaceFlinger.cpp

源码位置:/frameworks/native/services/surfaceflinger/SurfaceFlinger.cpp

commit

bool SurfaceFlinger::commit(nsecs_t frameTime, int64_t vsyncId, nsecs_t expectedVsyncTime)
        FTL_FAKE_GUARD(kMainThreadContext) {
    ……
    if (mSetActiveModePending) {
        // 检查是否有待处理的帧
        if (framePending) {
            mScheduler->scheduleFrame();
            return false;
        }

        mSetActiveModePending = false;
        {
            Mutex::Autolock lock(mStateLock);
            updateInternalStateWithChangedMode();
        }
    }

    // 检查是否有待处理的帧
    if (framePending) {
        if ((hwcFrameMissed && !gpuF

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部