diff options
author | Jamie Gennis <jgennis@google.com> | 2013-10-29 13:36:12 -0700 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2013-11-01 13:58:56 -0700 |
commit | 41c3c496ff507554da1c6099c600809608bdbb81 (patch) | |
tree | 4a4a2292359b47432b41f1707c65c205bcdb1611 | |
parent | 46417b845a257d6725adf048a3cfad6306218e9b (diff) | |
download | frameworks_native-41c3c496ff507554da1c6099c600809608bdbb81.zip frameworks_native-41c3c496ff507554da1c6099c600809608bdbb81.tar.gz frameworks_native-41c3c496ff507554da1c6099c600809608bdbb81.tar.bz2 |
DispSync: remove delay when enabling vsync events
This change fixes a bug that caused an extra frame of latency when enabling
vsync event callbacks in DispSync. The bug was related to the logic that
prevents the two events from firing with very little time between them due to
updates to the vsync model.
Bug: 11479720
Change-Id: Ie7eaff9e92ffb7b7b6cb4d3d4402c96cbd29af7e
-rw-r--r-- | services/surfaceflinger/DispSync.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/services/surfaceflinger/DispSync.cpp b/services/surfaceflinger/DispSync.cpp index 167c6f0..ce07ab5 100644 --- a/services/surfaceflinger/DispSync.cpp +++ b/services/surfaceflinger/DispSync.cpp @@ -164,7 +164,14 @@ public: EventListener listener; listener.mPhase = phase; listener.mCallback = callback; - listener.mLastEventTime = systemTime(SYSTEM_TIME_MONOTONIC); + + // We want to allow the firstmost future event to fire without + // allowing any past events to fire. Because + // computeListenerNextEventTimeLocked filters out events within a half + // a period of the last event time, we need to initialize the last + // event time to a half a period in the past. + listener.mLastEventTime = systemTime(SYSTEM_TIME_MONOTONIC) - mPeriod / 2; + mEventListeners.push(listener); mCond.signal(); |