SurfaceFlinger: always turn HWVsync off when display is off
Maintain a state in SF about what is the latest HWVsync state in HWC
and what it should be. Apply the desired state when screen turns on and
always disabled HWVsync when the display is off.
Test: display power on/off
Bug: 134965007
Change-Id: I9c23d09ea2e32efa0b1f30a3999a08d15d7f35a6
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 46fc4d2..8e835bf 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -838,6 +838,7 @@
}
bool previousFrameMissed();
+ void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled);
/*
* Debugging & dumpsys
@@ -1172,8 +1173,9 @@
// be any issues with a raw pointer referencing an invalid object.
std::unordered_set<Layer*> mOffscreenLayers;
- // Flag to indicate whether to re-enable HWVsync when screen is on
- bool mEnableHWVsyncScreenOn = false;
+ // Flags to capture the state of Vsync in HWC
+ HWC2::Vsync mHWCVsyncState = HWC2::Vsync::Disable;
+ HWC2::Vsync mHWCVsyncPendingState = HWC2::Vsync::Disable;
};
} // namespace android