通过上一篇文章我们创建了一个 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
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » Android SurfaceFlinger——Vsync信号发送(五十二)
发表评论 取消回复