From 955174331aa9f22189f790e242668760046e6139 Mon Sep 17 00:00:00 2001 From: Alex Sarraf Date: Mon, 22 Nov 2021 18:51:21 -0800 Subject: [PATCH] sdm: Skip CRTC_SET_MODE on seamless transition Skip CRTC_SET_MODE during PowerOff when there is a DFPS switch, dynamic DSI clock change, or a POMS change. CRs-Fixed: 3081148 Change-Id: I7191876a4731845e10a7c1b0547b1d83242a0c4f --- sdm/libs/core/drm/hw_device_drm.cpp | 15 +++++++++++++-- sdm/libs/core/drm/hw_device_drm.h | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp index ac726fc91..2b630564a 100644 --- a/sdm/libs/core/drm/hw_device_drm.cpp +++ b/sdm/libs/core/drm/hw_device_drm.cpp @@ -932,6 +932,10 @@ void HWDeviceDRM::SetDisplaySwitchMode(uint32_t index) { cmd_mode_index_ = current_mode_index_; } } + if (current_mode.hdisplay == to_set.hdisplay && + current_mode.vdisplay == to_set.vdisplay) { + seamless_mode_switch_ = true; + } } DisplayError HWDeviceDRM::SetDisplayAttributes(uint32_t index) { @@ -1016,14 +1020,18 @@ DisplayError HWDeviceDRM::PowerOff(bool teardown) { ResetROI(); int64_t retire_fence_fd = -1; drmModeModeInfo current_mode = connector_info_.modes[current_mode_index_].mode; - drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode); + if (!IsSeamlessTransition()) { + drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode); + } drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::OFF); drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 0); drm_atomic_intf_->Perform(DRMOps::CONNECTOR_GET_RETIRE_FENCE, token_.conn_id, &retire_fence_fd); int ret = NullCommit(false /* asynchronous */, false /* retain_planes */); if (ret) { - DLOGE("Failed with error: %d", ret); + DLOGE("Failed with error: %d, dynamic_fps=%d, seamless_mode_switch_=%d, vrefresh_=%d," + "panel_mode_changed_=%d bit_clk_rate_=%" PRIu64 , ret, hw_panel_info_.dynamic_fps, + seamless_mode_switch_, vrefresh_, panel_mode_changed_, bit_clk_rate_); return kErrorHardware; } @@ -1475,6 +1483,7 @@ DisplayError HWDeviceDRM::Validate(HWLayers *hw_layers) { DumpHWLayers(hw_layers); vrefresh_ = 0; panel_mode_changed_ = 0; + seamless_mode_switch_ = false; err = kErrorHardware; } @@ -1572,6 +1581,7 @@ DisplayError HWDeviceDRM::AtomicCommit(HWLayers *hw_layers) { DumpHWLayers(hw_layers); vrefresh_ = 0; panel_mode_changed_ = 0; + seamless_mode_switch_ = false; return kErrorHardware; } @@ -1640,6 +1650,7 @@ DisplayError HWDeviceDRM::AtomicCommit(HWLayers *hw_layers) { update_mode_ = false; hw_layers->updates_mask = 0; pending_doze_ = false; + seamless_mode_switch_ = false; return kErrorNone; } diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h index 08595f26e..683c75518 100644 --- a/sdm/libs/core/drm/hw_device_drm.h +++ b/sdm/libs/core/drm/hw_device_drm.h @@ -212,6 +212,11 @@ class HWDeviceDRM : public HWInterface { }; protected: + bool IsSeamlessTransition() { + return (hw_panel_info_.dynamic_fps && (vrefresh_ || seamless_mode_switch_)) || + panel_mode_changed_ || bit_clk_rate_; + } + const char *device_name_ = {}; bool default_mode_ = false; int32_t display_id_ = -1; @@ -261,6 +266,7 @@ class HWDeviceDRM : public HWInterface { bool resolution_switch_enabled_ = false; bool autorefresh_ = false; std::unique_ptr hw_color_mgr_ = {}; + bool seamless_mode_switch_ = false; }; } // namespace sdm