diff options
| author | 2016-04-05 16:45:26 -0700 | |
|---|---|---|
| committer | 2016-04-07 14:03:02 -0700 | |
| commit | f34b9be610ce286af224364cb6e69ef6f7697ee9 (patch) | |
| tree | 0096a8de0b2e5f1747bd6ac9569520230d71652a /services/surfaceflinger/EventThread.cpp | |
| parent | 90e840f00713bf9c1016c4f2584ef70e0a87ca14 (diff) | |
DispSync: Always resync after inactivity
Changes DispSync to enable hardware vsync immediately when new frames
arrive after a period of inactivity.
No matter how hard we try, we can't avoid drifting over time without
being able to detect error based on display retire fences. By enabling
hardware vsync immediately, we avoid having a weird period or phase
offset relative to hardware while we retrain the model. Once the model
has locked, we turn hardware vsync back off to save power (until we
detect drift again).
Bug: 26255070
Change-Id: If4dd17c2d541015c730f47d824359d7cb4b52c3c
Diffstat (limited to 'services/surfaceflinger/EventThread.cpp')
| -rw-r--r-- | services/surfaceflinger/EventThread.cpp | 6 | 
1 files changed, 5 insertions, 1 deletions
diff --git a/services/surfaceflinger/EventThread.cpp b/services/surfaceflinger/EventThread.cpp index f760200006..dd88adb362 100644 --- a/services/surfaceflinger/EventThread.cpp +++ b/services/surfaceflinger/EventThread.cpp @@ -44,8 +44,9 @@ static void vsyncOffCallback(union sigval val) {      return;  } -EventThread::EventThread(const sp<VSyncSource>& src) +EventThread::EventThread(const sp<VSyncSource>& src, SurfaceFlinger& flinger)      : mVSyncSource(src), +      mFlinger(flinger),        mUseSoftwareVSync(false),        mVsyncEnabled(false),        mDebugVsyncEnabled(false), @@ -126,6 +127,9 @@ void EventThread::setVsyncRate(uint32_t count,  void EventThread::requestNextVsync(          const sp<EventThread::Connection>& connection) {      Mutex::Autolock _l(mLock); + +    mFlinger.resyncWithRateLimit(); +      if (connection->count < 0) {          connection->count = 0;          mCondition.broadcast();  |