SF: Fix synthetic VSYNC after first powering on
After onActiveDisplayChangedLocked, isActiveDisplay was stale, so the
first powering on of a newly active display did not enable and resync
to hardware VSYNC, i.e. EventThread stayed in SyntheticVsync.
Also, merge EventThread APIs to enable/disable synthetic VSYNC.
Fixes: 264700488
Bug: 255635821
Test: dumpsys SurfaceFlinger --events
Change-Id: Ibd4099bb856adc11d887f3b7b9432fbc4cb2e33d
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index eb6d7e4..b78b92b 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -384,23 +384,13 @@
return vsyncEventData;
}
-void EventThread::onScreenReleased() {
+void EventThread::enableSyntheticVsync(bool enable) {
std::lock_guard<std::mutex> lock(mMutex);
- if (!mVSyncState || mVSyncState->synthetic) {
+ if (!mVSyncState || mVSyncState->synthetic == enable) {
return;
}
- mVSyncState->synthetic = true;
- mCondition.notify_all();
-}
-
-void EventThread::onScreenAcquired() {
- std::lock_guard<std::mutex> lock(mMutex);
- if (!mVSyncState || !mVSyncState->synthetic) {
- return;
- }
-
- mVSyncState->synthetic = false;
+ mVSyncState->synthetic = enable;
mCondition.notify_all();
}