Avoid vsync enabled when in DOZE mode (AOD).
Bug: 219109873
Test: perfetto trace
Change-Id: Id3373dc9bb0cf4c0375c79a32ca9802fd77e06c2
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 459291a..445961b 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -376,6 +376,11 @@
}
ATRACE_CALL();
+ if (displayData.powerMode == hal::PowerMode::DOZE && enabled == hal::Vsync::ENABLE) {
+ ALOGV("%s will not enable vsync for display %s due to power mode %s", __FUNCTION__,
+ to_string(displayId).c_str(), to_string(displayData.powerMode).c_str());
+ return;
+ }
auto error = displayData.hwcDisplay->setVsyncEnabled(enabled);
RETURN_IF_HWC_ERROR(error, displayId);
@@ -553,6 +558,7 @@
setVsyncEnabled(displayId, hal::Vsync::DISABLE);
}
+ mDisplayData[displayId].powerMode = mode;
const auto& displayData = mDisplayData[displayId];
auto& hwcDisplay = displayData.hwcDisplay;
switch (mode) {