Reduce unnecessary calls to getLatestVsyncEventData
When Choreographer#doFrame is driven by MSG_DO_FRAME, since the value of VsyncEventData.frameInterval is -1, jitterNanos >= frameIntervalNanos must hold true in doFrame, and FrameData#update will call getLatestVsyncEventData (binder SurfaceFlinger). Since MSG_DO_FRAME is not VSync-driven, there is no issue of doFrame being delayed by the App (resynced), and thus FrameData#update is not required. This saves the time consumed by binder (getLatestVsyncEventData). Change-Id: I3b64b453622a7f46da5b2bfa628002f3a5fe4f93 Signed-off-by: Liangliang Sui <coolsui.coding@gmail.com> Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -1024,7 +1024,9 @@ public final class Choreographer {
|
||||
// Calculating jitter involves using the original frame time without
|
||||
// adjustments from buffer stuffing
|
||||
final long jitterNanos = startNanos - frameTimeNanos;
|
||||
if (jitterNanos >= frameIntervalNanos) {
|
||||
if (jitterNanos >= frameIntervalNanos
|
||||
&& (timeline.mVsyncId != FrameInfo.INVALID_VSYNC_ID
|
||||
|| vsyncEventData.frameInterval != -1)) {
|
||||
frameTimeNanos = startNanos;
|
||||
if (frameIntervalNanos == 0) {
|
||||
Log.i(TAG, "Vsync data empty due to timeout");
|
||||
|
||||
Reference in New Issue
Block a user