Skip to content

Commit

Permalink
Merge "sdm: Skip CRTC_SET_MODE on seamless transition"
Browse files Browse the repository at this point in the history
  • Loading branch information
qctecmdr authored and Gerrit - the friendly Code Review server committed Mar 2, 2022
2 parents 4b9d18b + 9551743 commit 384dec4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 13 additions & 2 deletions sdm/libs/core/drm/hw_device_drm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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, &current_mode);
if (!IsSeamlessTransition()) {
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, &current_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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions sdm/libs/core/drm/hw_device_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -261,6 +266,7 @@ class HWDeviceDRM : public HWInterface {
bool resolution_switch_enabled_ = false;
bool autorefresh_ = false;
std::unique_ptr<HWColorManagerDrm> hw_color_mgr_ = {};
bool seamless_mode_switch_ = false;
};

} // namespace sdm
Expand Down

0 comments on commit 384dec4

Please sign in to comment.