summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamkumar Radhakrishnan <ramkumar@codeaurora.org>2017-11-27 14:53:06 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-03-08 02:54:31 -0800
commitf5d101a6e3597e8b2a01f7a25aa24bf7b5c74d79 (patch)
tree193649bc68f3893be9c62d243e3fc1c66daa03bd
parent58d0e0f0838d36a22d5a01a1682f1cbc7e1fe2dc (diff)
downloaddisplay-f5d101a6e3597e8b2a01f7a25aa24bf7b5c74d79.tar.gz
sdm: Handle disable partial update and display config change
1. Disable PU for one frame on any display state change. 2. Trigger invalidate on SetActiveConfig() and set the display config as a part of draw cycle Change-Id: Iffb64fb5d3af038f7d777382fdfdb5b8914fb6b5 CRs-Fixed: 2151067
-rw-r--r--sdm/libs/core/display_base.cpp4
-rw-r--r--sdm/libs/core/drm/hw_device_drm.cpp14
-rw-r--r--sdm/libs/core/drm/hw_device_drm.h1
-rw-r--r--sdm/libs/hwc2/hwc_display.cpp12
-rw-r--r--sdm/libs/hwc2/hwc_display.h2
-rw-r--r--sdm/libs/hwc2/hwc_display_external.cpp8
-rw-r--r--sdm/libs/hwc2/hwc_display_primary.cpp7
7 files changed, 45 insertions, 3 deletions
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 383bdba7..136168b9 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -488,9 +488,11 @@ DisplayError DisplayBase::SetDisplayState(DisplayState state) {
default:
DLOGE("Spurious state = %d transition requested.", state);
- break;
+ return kErrorParameters;
}
+ DisablePartialUpdateOneFrame();
+
if (error == kErrorNone) {
active_ = active;
state_ = state;
diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp
index c734f4cd..c1145c76 100644
--- a/sdm/libs/core/drm/hw_device_drm.cpp
+++ b/sdm/libs/core/drm/hw_device_drm.cpp
@@ -737,6 +737,7 @@ DisplayError HWDeviceDRM::PowerOff() {
return kErrorUndefined;
}
+ SetFullROI();
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);
int ret = drm_atomic_intf_->Commit(true /* synchronous */, false /* retain_planes */);
@@ -1549,4 +1550,17 @@ void HWDeviceDRM::SetMultiRectMode(const uint32_t flags, DRMMultiRectMode *targe
}
}
+void HWDeviceDRM::SetFullROI() {
+ // Reset the CRTC ROI and connector ROI only for the panel that supports partial update
+ if (!hw_panel_info_.partial_update) {
+ return;
+ }
+ uint32_t index = current_mode_index_;
+ DRMRect crtc_rects = {0, 0, mixer_attributes_.width, mixer_attributes_.height};
+ DRMRect conn_rects = {0, 0, display_attributes_[index].x_pixels,
+ display_attributes_[index].y_pixels};
+ drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ROI, token_.crtc_id, 1, &crtc_rects);
+ drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_ROI, token_.conn_id, 1, &conn_rects);
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h
index b08c0e66..3af3b77d 100644
--- a/sdm/libs/core/drm/hw_device_drm.h
+++ b/sdm/libs/core/drm/hw_device_drm.h
@@ -133,6 +133,7 @@ class HWDeviceDRM : public HWInterface {
bool IsResolutionSwitchEnabled() const { return resolution_switch_enabled_; }
void SetTopology(sde_drm::DRMTopology drm_topology, HWTopology *hw_topology);
void SetMultiRectMode(const uint32_t flags, sde_drm::DRMMultiRectMode *target);
+ void SetFullROI();
class Registry {
public:
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 142b84be..213230f7 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -1334,6 +1334,7 @@ HWC2::Error HWCDisplay::PostCommitLayerStack(int32_t *out_retire_fence) {
dump_frame_index_++;
}
}
+ config_pending_ = false;
geometry_changes_ = GeometryChanges::kNone;
flush_ = false;
@@ -1940,9 +1941,16 @@ void HWCDisplay::SetSecureDisplay(bool secure_display_active) {
}
int HWCDisplay::SetActiveDisplayConfig(uint32_t config) {
- int status = (display_intf_->SetActiveConfig(config) == kErrorNone) ? 0 : -1;
+ if (display_config_ == config) {
+ return 0;
+ }
+ display_config_ = config;
+ config_pending_ = true;
validated_ = false;
- return status;
+
+ callbacks_->Refresh(id_);
+
+ return 0;
}
int HWCDisplay::GetActiveDisplayConfig(uint32_t *config) {
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index a5e14573..beed4255 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -300,6 +300,8 @@ class HWCDisplay : public DisplayEventHandler {
HWCToneMapper *tone_mapper_ = nullptr;
uint32_t num_configs_ = 0;
int disable_hdr_handling_ = 0; // disables HDR handling.
+ uint32_t display_config_ = 0;
+ bool config_pending_ = false;
private:
void DumpInputBuffers(void);
diff --git a/sdm/libs/hwc2/hwc_display_external.cpp b/sdm/libs/hwc2/hwc_display_external.cpp
index 2bc2d189..975c86e4 100644
--- a/sdm/libs/hwc2/hwc_display_external.cpp
+++ b/sdm/libs/hwc2/hwc_display_external.cpp
@@ -115,6 +115,14 @@ HWC2::Error HWCDisplayExternal::Validate(uint32_t *out_num_types, uint32_t *out_
return status;
}
+ if (config_pending_) {
+ if (display_intf_->SetActiveConfig(display_config_) != kErrorNone) {
+ DLOGW("Invalid display config %d", display_config_);
+ // Reset the display config with active config
+ display_intf_->GetActiveConfig(&display_config_);
+ }
+ }
+
BuildLayerStack();
if (layer_set_.empty()) {
diff --git a/sdm/libs/hwc2/hwc_display_primary.cpp b/sdm/libs/hwc2/hwc_display_primary.cpp
index 1f2fdf64..ff98f59c 100644
--- a/sdm/libs/hwc2/hwc_display_primary.cpp
+++ b/sdm/libs/hwc2/hwc_display_primary.cpp
@@ -178,6 +178,13 @@ HWC2::Error HWCDisplayPrimary::Validate(uint32_t *out_num_types, uint32_t *out_n
MarkLayersForClientComposition();
}
+ if (config_pending_) {
+ if (display_intf_->SetActiveConfig(display_config_) != kErrorNone) {
+ DLOGW("Invalid display config %d", display_config_);
+ // Reset the display config with active config
+ display_intf_->GetActiveConfig(&display_config_);
+ }
+ }
// Fill in the remaining blanks in the layers and add them to the SDM layerstack
BuildLayerStack();
// Checks and replaces layer stack for solid fill