summaryrefslogtreecommitdiffstats
path: root/sdm
diff options
context:
space:
mode:
authorSushil Chauhan <sushilchauhan@codeaurora.org>2018-06-28 11:39:01 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-07-03 16:22:46 -0700
commit8aefef0b385405f689a0eea1e80f1c67f441787c (patch)
tree12c0581b4941836cf1f0d28b89073b49ef92d2e4 /sdm
parent1795dbfc9f3aaf73504a313463591a631b0057cb (diff)
downloadandroid_hardware_qcom_sdm710_display-8aefef0b385405f689a0eea1e80f1c67f441787c.tar.gz
android_hardware_qcom_sdm710_display-8aefef0b385405f689a0eea1e80f1c67f441787c.tar.bz2
android_hardware_qcom_sdm710_display-8aefef0b385405f689a0eea1e80f1c67f441787c.zip
hwc2: Skip SDM prepare for consecutive GPU composed frames
Skip SDM prepare, if all the layers in the current draw cycle are marked as Skip and previous draw cycle had GPU Composition, since the resources for GPU Target layer, have already been validated and configured to driver. It avoids unnecessary CPU cycles in Strategy, Resource Manager, DAL, etc. in SDM and the Validate IOCTL in driver. CRs-Fixed: 2269870 Change-Id: I019a13d0eaf08c01d710555ff99f104d2a3d24ce
Diffstat (limited to 'sdm')
-rw-r--r--sdm/libs/hwc2/hwc_display.cpp38
-rw-r--r--sdm/libs/hwc2/hwc_display.h2
2 files changed, 40 insertions, 0 deletions
diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp
index 7bc4e734..22097222 100644
--- a/sdm/libs/hwc2/hwc_display.cpp
+++ b/sdm/libs/hwc2/hwc_display.cpp
@@ -1060,6 +1060,11 @@ HWC2::Error HWCDisplay::PrepareLayerStack(uint32_t *out_num_types, uint32_t *out
}
UpdateRefreshRate();
+
+ if (CanSkipSdmPrepare(out_num_types, out_num_requests)) {
+ return ((*out_num_types > 0) ? HWC2::Error::HasChanges : HWC2::Error::None);
+ }
+
if (!skip_prepare_) {
DisplayError error = display_intf_->Prepare(&layer_stack_);
if (error != kErrorNone) {
@@ -2166,4 +2171,37 @@ void HWCDisplay::UpdateRefreshRate() {
}
}
+// Skip SDM prepare if all the layers in the current draw cycle are marked as Skip and
+// previous draw cycle had GPU Composition, as the resources for GPU Target layer have
+// already been validated and configured to the driver.
+bool HWCDisplay::CanSkipSdmPrepare(uint32_t *num_types, uint32_t *num_requests) {
+ if (!validated_ || layer_set_.empty()) {
+ return false;
+ }
+
+ bool skip_prepare = true;
+ for (auto hwc_layer : layer_set_) {
+ if (!hwc_layer->GetSDMLayer()->flags.skip ||
+ (hwc_layer->GetDeviceSelectedCompositionType() != HWC2::Composition::Client)) {
+ skip_prepare = false;
+ layer_changes_.clear();
+ break;
+ }
+ if (hwc_layer->GetClientRequestedCompositionType() != HWC2::Composition::Client) {
+ layer_changes_[hwc_layer->GetId()] = HWC2::Composition::Client;
+ }
+ }
+
+ if (skip_prepare) {
+ *num_types = UINT32(layer_changes_.size());
+ *num_requests = 0;
+ layer_stack_invalid_ = false;
+ has_client_composition_ = true;
+ client_target_->ResetValidation();
+ validate_state_ = kNormalValidate;
+ }
+
+ return skip_prepare;
+}
+
} // namespace sdm
diff --git a/sdm/libs/hwc2/hwc_display.h b/sdm/libs/hwc2/hwc_display.h
index 8cbd6bb9..084a2a5c 100644
--- a/sdm/libs/hwc2/hwc_display.h
+++ b/sdm/libs/hwc2/hwc_display.h
@@ -345,6 +345,8 @@ class HWCDisplay : public DisplayEventHandler {
private:
void DumpInputBuffers(void);
void UpdateRefreshRate();
+ bool CanSkipSdmPrepare(uint32_t *num_types, uint32_t *num_requests);
+
qService::QService *qservice_ = NULL;
DisplayClass display_class_;
uint32_t geometry_changes_ = GeometryChanges::kNone;