hwc2: Don't defer active config setting
SetActiveConfigWithConstraints API makes sure to trigger a Refresh
by client and the active config change needs to be submitted and
applied in the follow-up draw cycle. Don't defer the active config
setting further in HWC HAL.
Change-Id: I43c874553722de567ff34b19e6eecdb27b1f4e90
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 467cc1b..3eb900d 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -2569,7 +2569,7 @@
}
void HWCDisplay::SubmitActiveConfigChange(hwc2_vsync_period_t current_vsync_period) {
- HWC2::Error error = SetActiveConfig(pending_refresh_rate_config_);
+ HWC2::Error error = SubmitDisplayConfig(pending_refresh_rate_config_);
if (error != HWC2::Error::None) {
return;
}
@@ -2626,4 +2626,25 @@
return IsSameGroup(active_config, config);
}
+HWC2::Error HWCDisplay::SubmitDisplayConfig(hwc2_config_t config) {
+ DTRACE_SCOPED();
+
+ hwc2_config_t current_config = 0;
+ GetActiveConfig(¤t_config);
+ if (current_config == config) {
+ return HWC2::Error::None;
+ }
+
+ DisplayError error = display_intf_->SetActiveConfig(config);
+ if (error != kErrorNone) {
+ DLOGE("Failed to set %d config! Error: %d", config, error);
+ return HWC2::Error::BadConfig;
+ }
+
+ validated_ = false;
+ DLOGI("Active configuration changed to: %d", config);
+
+ return HWC2::Error::None;
+}
+
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 96b3f65..d89deec 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -400,6 +400,7 @@
bool IsSameGroup(hwc2_config_t config_id1, hwc2_config_t config_id2);
bool AllowSeamless(hwc2_config_t request_config);
void SetVsyncsApplyRateChange(uint32_t vsyncs) { vsyncs_to_apply_rate_change_ = vsyncs; }
+ HWC2::Error SubmitDisplayConfig(hwc2_config_t config);
enum {
INPUT_LAYER_DUMP,