schedule vsync immediately when requested from the Looper thread
This patch allows Choreographer to schedule vsync immediately when it is requested from the Looper thread. Previously this is not allowed when vsync is already scheduled from a binder thread and hence there is a delay up to 16ms (one vsync interval) in processing frame callbacks. Change-Id: Idd70f1a6c359e92ecebd778a104b71dfa6660c79 Signed-off-by: Dohyun Lee <dohyun.lee@lge.com> Signed-off-by: mydongistiny <jaysonedson@gmail.com> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -867,6 +867,19 @@ public final class Choreographer {
|
||||
msg.setAsynchronous(true);
|
||||
mHandler.sendMessageAtTime(msg, nextFrameTime);
|
||||
}
|
||||
} else {
|
||||
if (USE_VSYNC) {
|
||||
if (mHandler.hasMessages(MSG_DO_SCHEDULE_VSYNC)) {
|
||||
// If running on the Looper thread, then schedule the vsync immediately.
|
||||
if (isRunningOnLooperThreadLocked()) {
|
||||
if (DEBUG_FRAMES) {
|
||||
Log.d(TAG, "Scheduling next frame on vsync.");
|
||||
}
|
||||
scheduleVsyncLocked();
|
||||
mHandler.removeMessages(MSG_DO_SCHEDULE_VSYNC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user