SF: use cached vsync period
Don't query the vsync period from hwc but instead use the cached
value in SF. The reason for this change is a race condition with AOD:
1. SF changes refresh rate to from X to Y
2. HWC is caching Y since the display is already in AOD and can't
change refresh rate.
3. SF calls HWC to get the display out from AOD and query the refresh rate.
At this point HWC returns X as the refresh rate didn't change yet.
4. HWC changes the refresh rate to Y.
5. SF thinks the refresh rate is X -- mismatch.
Test: enable / disable AOD in a loop
Bug: 160966959
Change-Id: I127c3a445416607dee9402031e07c8fece7d167b
(cherry picked from commit 2492a02b8a04f9cd6e806e1bdb55a3dbc4d7ae91)
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index ccaeb2d..c727574 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -852,7 +852,7 @@
/* ------------------------------------------------------------------------
* VSync
*/
- nsecs_t getVsyncPeriod() const REQUIRES(mStateLock);
+ nsecs_t getVsyncPeriodFromHWC() const REQUIRES(mStateLock);
// Sets the refresh rate by switching active configs, if they are available for
// the desired refresh rate.