SurfaceFlinger: fix refresh rate override when changing refresh rate
If an app's frame rate is same as the display refresh rate, keep it
on the frame rate override list. The reason for this is if an app
is added to the list after the display refresh rate changed, the few
first frames would be running the the display refresh rate and not at
the override one.
Test: atest FrameRateOverrideHostTest
Test: run TouchLatency while changing refresh rates and collect systrace
Bug: 182544360
Change-Id: I66472a1230affae9336520083f0950ae252ede02
diff --git a/services/surfaceflinger/Scheduler/Scheduler.cpp b/services/surfaceflinger/Scheduler/Scheduler.cpp
index 9813270..4edbdd2 100644
--- a/services/surfaceflinger/Scheduler/Scheduler.cpp
+++ b/services/surfaceflinger/Scheduler/Scheduler.cpp
@@ -235,12 +235,7 @@
return true;
}
- const auto divider = mRefreshRateConfigs.getRefreshRateDivider(*frameRate);
- if (divider <= 1) {
- return true;
- }
-
- return mVsyncSchedule.tracker->isVSyncInPhase(expectedVsyncTimestamp, divider);
+ return mVsyncSchedule.tracker->isVSyncInPhase(expectedVsyncTimestamp, *frameRate);
}
impl::EventThread::ThrottleVsyncCallback Scheduler::makeThrottleVsyncCallback() const {
@@ -354,6 +349,10 @@
std::lock_guard<std::mutex> lock(mFeatureStateLock);
// Cache the last reported modes for primary display.
mFeatures.cachedModeChangedParams = {handle, displayId, modeId, vsyncPeriod};
+
+ // Invalidate content based refresh rate selection so it could be calculated
+ // again for the new refresh rate.
+ mFeatures.contentRequirements.clear();
}
onNonPrimaryDisplayModeChanged(handle, displayId, modeId, vsyncPeriod);
}