sdm: Set crtc mode on every validate/commit.
Change of display mode does not take effect as atomic request pointer
is being recreated on every validate/commit which resets crtc mode.
Set CRTC mode on every validate/commit to fix it.
Change-Id: Iab1fd6b12addf05116f68b54162cdb55e8197ef1
CRs-Fixed: 2105316
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index 961a745..ecc0f63 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -663,12 +663,10 @@
DisplayError HWDeviceDRM::SetDisplayAttributes(uint32_t index) {
if (index >= display_attributes_.size()) {
+ DLOGE("Invalid mode index %d mode size %d", index, UINT32(display_attributes_.size()));
return kErrorParameters;
}
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &connector_info_.modes[index]);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
-
current_mode_index_ = index;
UpdatePanelSplitInfo();
UpdateMixerAttributes();
@@ -762,6 +760,7 @@
HWQosData &qos_data = hw_layers->qos_data;
DRMSecurityLevel crtc_security_level = DRMSecurityLevel::SECURE_NON_SECURE;
uint32_t index = current_mode_index_;
+ drmModeModeInfo current_mode = connector_info_.modes[index];
solid_fills_.clear();
@@ -895,18 +894,17 @@
// Set refresh rate
if (vrefresh_) {
- drmModeModeInfo mode = {};
- drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_];
for (uint32_t mode_index = 0; mode_index < connector_info_.modes.size(); mode_index++) {
if ((current_mode.vdisplay == connector_info_.modes[mode_index].vdisplay) &&
(current_mode.hdisplay == connector_info_.modes[mode_index].hdisplay) &&
(vrefresh_ == connector_info_.modes[mode_index].vrefresh)) {
- mode = connector_info_.modes[mode_index];
+ current_mode = connector_info_.modes[mode_index];
break;
}
}
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &mode);
}
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode);
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
}
void HWDeviceDRM::AddSolidfillStage(const HWSolidfillStage &sf, uint32_t plane_alpha) {
diff --git a/sdm/libs/core/drm/hw_virtual_drm.cpp b/sdm/libs/core/drm/hw_virtual_drm.cpp
index 7c7e348..176d4ec 100644
--- a/sdm/libs/core/drm/hw_virtual_drm.cpp
+++ b/sdm/libs/core/drm/hw_virtual_drm.cpp
@@ -177,8 +177,6 @@
height_ = display_attributes_[index].y_pixels;
return error;
}
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &connector_info_.modes[index]);
- drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1);
display_attributes_[index] = display_attributes;
if (display_attributes_[index].x_pixels > hw_resource_.max_mixer_width) {