sdm: Disable vsync when display state is poweroff/dozesuspend
Disable vsync when display state is poweroff/dozesuspend and restore
vsync state to its previous state when the display is powered on.
Change-Id: I83569873aa0d082a9ec6d33b7ce5dc8815bd4953
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 72751e5..ae88e42 100755
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -551,6 +551,15 @@
return kErrorNone;
}
+ // If vsync is enabled, disable vsync before power off/Doze suspend
+ if (vsync_enable_ && (state == kStateOff || state == kStateDozeSuspend)) {
+ error = SetVSyncState(false);
+ if (error == kErrorNone) {
+ vsync_state_change_pending_ = true;
+ requested_vsync_state_ = true;
+ }
+ }
+
switch (state) {
case kStateOff:
hw_layers_.info.hw_layers.clear();
@@ -605,7 +614,7 @@
comp_manager_->SetDisplayState(display_comp_ctx_, state, release_fence ? *release_fence : -1);
}
- if (vsync_state_change_pending_ && (state_ != kStateOff || state_ != kStateStandby)) {
+ if (vsync_state_change_pending_ && (state_ == kStateOn || state_ == kStateDoze)) {
error = SetVSyncState(requested_vsync_state_);
if (error != kErrorNone) {
return error;
diff --git a/sdm/libs/core/display_base.h b/sdm/libs/core/display_base.h
index 4ca6254..eb1c045 100644
--- a/sdm/libs/core/display_base.h
+++ b/sdm/libs/core/display_base.h
@@ -234,6 +234,7 @@
bool custom_mixer_resolution_ = false;
DisplayState power_state_pending_ = kStateOff;
bool vsync_state_change_pending_ = false;
+ // requested_vsync_state: true -> enable vsync, false -> disable vsync
bool requested_vsync_state_ = false;
bool defer_power_state_ = false;
QSyncMode qsync_mode_ = kQSyncModeNone;