在SurfaceFlinger的构造方法中调用了DispSync的init方法对DispSync进行初始化,
mPrimaryDispSync.init(hasSyncFramework, dispSyncPresentTimeOffset);
调用流程图如下,
DispSync的构造方法如下,
DispSync::DispSync(const char* name) :
mName(name),
mRefreshSkipCount(0),
mThread(new DispSyncThread(name)) {
}
创建了DispSyncThread 线程。
DispSyncThread是 DispSync的内部类,继承于Thread,
class DispSyncThread: public Thread {
DispSync的init方法主要逻辑如下,
1,运行DispSyncThread 线程,并设置调度策略,
mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE);
struct sched_param param = {0};
param.sched_priority = 2;
if (sched_setscheduler(mThread->getTid(), SCHED_FIFO, ¶m) !&