Improve SurfaceFlinger PTS estimation
Get the next refresh time from DispSync instead of guessing based
on the current time.
Change-Id: I8dc72a3217bfd4e9b4c905034194d1a298cad69a
diff --git a/services/surfaceflinger/DispSync.cpp b/services/surfaceflinger/DispSync.cpp
index a00ccdb..fd46822 100644
--- a/services/surfaceflinger/DispSync.cpp
+++ b/services/surfaceflinger/DispSync.cpp
@@ -508,4 +508,9 @@
}
}
+nsecs_t DispSync::computeNextRefresh(int periodOffset) const {
+ nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+ return (((now - mPhase) / mPeriod) + periodOffset + 1) * mPeriod + mPhase;
+}
+
} // namespace android