summaryrefslogtreecommitdiff
path: root/composer/hwc_display_builtin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'composer/hwc_display_builtin.cpp')
-rw-r--r--composer/hwc_display_builtin.cpp197
1 files changed, 179 insertions, 18 deletions
diff --git a/composer/hwc_display_builtin.cpp b/composer/hwc_display_builtin.cpp
index b0cc447c..9f313075 100644
--- a/composer/hwc_display_builtin.cpp
+++ b/composer/hwc_display_builtin.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -153,13 +153,6 @@ int HWCDisplayBuiltIn::Init() {
&window_rect_.right, &window_rect_.bottom) != kErrorUndefined;
DLOGI("Window rect : [%f %f %f %f]", window_rect_.left, window_rect_.top,
window_rect_.right, window_rect_.bottom);
-
- value = 0;
- HWCDebugHandler::Get()->GetProperty(ENABLE_POMS_DURING_DOZE, &value);
- enable_poms_during_doze_ = (value == 1);
- if (enable_poms_during_doze_) {
- DLOGI("Enable POMS during Doze mode %" PRIu64 , id_);
- }
}
value = 0;
@@ -179,6 +172,10 @@ int HWCDisplayBuiltIn::Init() {
enhance_idle_time_ = (enhance_idle_time == 1);
DLOGI("enhance_idle_time: %d", enhance_idle_time);
+ HWCDebugHandler::Get()->GetProperty(PERF_HINT_WINDOW_PROP, &perf_hint_window_);
+ HWCDebugHandler::Get()->GetProperty(ENABLE_PERF_HINT_LARGE_COMP_CYCLE,
+ &perf_hint_large_comp_cycle_);
+
return status;
}
@@ -238,6 +235,16 @@ HWC2::Error HWCDisplayBuiltIn::Validate(uint32_t *out_num_types, uint32_t *out_n
MarkLayersForClientComposition();
}
+ // apply pending DE config
+ PPPendingParams pending_action;
+ PPDisplayAPIPayload req_payload;
+ pending_action.action = kGetDetailedEnhancerData;
+ pending_action.params = NULL;
+ int err = display_intf_->ColorSVCRequestRoute(req_payload, NULL, &pending_action);
+ if (!err && pending_action.action == kConfigureDetailedEnhancer) {
+ err = SetHWDetailedEnhancerConfig(pending_action.params);
+ }
+
bool pending_output_dump = dump_frame_count_ && dump_output_to_file_;
if (readback_buffer_queued_ || pending_output_dump) {
@@ -851,7 +858,7 @@ void HWCDisplayBuiltIn::SetQDCMSolidFillInfo(bool enable, const LayerSolidFill &
}
void HWCDisplayBuiltIn::ToggleCPUHint(bool set) {
- if (!cpu_hint_) {
+ if (!cpu_hint_ || !perf_hint_window_) {
return;
}
@@ -922,8 +929,8 @@ uint32_t HWCDisplayBuiltIn::GetOptimalRefreshRate(bool one_updating_layer) {
return active_refresh_rate_;
}
-void HWCDisplayBuiltIn::SetIdleTimeoutMs(uint32_t timeout_ms) {
- display_intf_->SetIdleTimeoutMs(timeout_ms);
+void HWCDisplayBuiltIn::SetIdleTimeoutMs(uint32_t timeout_ms, uint32_t inactive_ms) {
+ display_intf_->SetIdleTimeoutMs(timeout_ms, inactive_ms);
validated_ = false;
}
@@ -1090,6 +1097,89 @@ DisplayError HWCDisplayBuiltIn::SetDetailEnhancerConfig
return error;
}
+DisplayError HWCDisplayBuiltIn::SetHWDetailedEnhancerConfig(void *params) {
+ DisplayError err = kErrorNone;
+ DisplayDetailEnhancerData de_data;
+
+ PPDETuningCfgData *de_tuning_cfg_data = reinterpret_cast<PPDETuningCfgData*>(params);
+ if (de_tuning_cfg_data->cfg_pending) {
+ if (!de_tuning_cfg_data->cfg_en) {
+ de_data.enable = 0;
+ DLOGV_IF(kTagQDCM, "Disable DE config");
+ } else {
+ de_data.override_flags = kOverrideDEEnable;
+ de_data.enable = 1;
+
+ DLOGV_IF(kTagQDCM, "Enable DE: flags %u, sharp_factor %d, thr_quiet %d, thr_dieout %d, "
+ "thr_low %d, thr_high %d, clip %d, quality %d, content_type %d, de_blend %d",
+ de_tuning_cfg_data->params.flags, de_tuning_cfg_data->params.sharp_factor,
+ de_tuning_cfg_data->params.thr_quiet, de_tuning_cfg_data->params.thr_dieout,
+ de_tuning_cfg_data->params.thr_low, de_tuning_cfg_data->params.thr_high,
+ de_tuning_cfg_data->params.clip, de_tuning_cfg_data->params.quality,
+ de_tuning_cfg_data->params.content_type, de_tuning_cfg_data->params.de_blend);
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagSharpFactor) {
+ de_data.override_flags |= kOverrideDESharpen1;
+ de_data.sharp_factor = de_tuning_cfg_data->params.sharp_factor;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagClip) {
+ de_data.override_flags |= kOverrideDEClip;
+ de_data.clip = de_tuning_cfg_data->params.clip;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrQuiet) {
+ de_data.override_flags |= kOverrideDEThrQuiet;
+ de_data.thr_quiet = de_tuning_cfg_data->params.thr_quiet;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrDieout) {
+ de_data.override_flags |= kOverrideDEThrDieout;
+ de_data.thr_dieout = de_tuning_cfg_data->params.thr_dieout;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrLow) {
+ de_data.override_flags |= kOverrideDEThrLow;
+ de_data.thr_low = de_tuning_cfg_data->params.thr_low;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagThrHigh) {
+ de_data.override_flags |= kOverrideDEThrHigh;
+ de_data.thr_high = de_tuning_cfg_data->params.thr_high;
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagContentQualLevel) {
+ switch (de_tuning_cfg_data->params.quality) {
+ case kDeContentQualLow:
+ de_data.quality_level = kContentQualityLow;
+ break;
+ case kDeContentQualMedium:
+ de_data.quality_level = kContentQualityMedium;
+ break;
+ case kDeContentQualHigh:
+ de_data.quality_level = kContentQualityHigh;
+ break;
+ case kDeContentQualUnknown:
+ default:
+ de_data.quality_level = kContentQualityUnknown;
+ break;
+ }
+ }
+
+ if (de_tuning_cfg_data->params.flags & kDeTuningFlagDeBlend) {
+ de_data.override_flags |= kOverrideDEBlend;
+ de_data.de_blend = de_tuning_cfg_data->params.de_blend;
+ }
+ }
+ err = SetDetailEnhancerConfig(de_data);
+ if (err) {
+ DLOGW("SetDetailEnhancerConfig failed. err = %d", err);
+ }
+ de_tuning_cfg_data->cfg_pending = false;
+ }
+ return err;
+}
+
DisplayError HWCDisplayBuiltIn::ControlPartialUpdate(bool enable, uint32_t *pending) {
DisplayError error = kErrorNone;
@@ -1234,6 +1324,53 @@ DisplayError HWCDisplayBuiltIn::GetSupportedDSIClock(std::vector<uint64_t> *bitc
return kErrorNotSupported;
}
+DisplayError HWCDisplayBuiltIn::SetStandByMode(bool enable, bool is_twm) {
+ if (enable) {
+ if (!display_null_.IsActive()) {
+ stored_display_intf_ = display_intf_;
+ display_intf_ = &display_null_;
+ shared_ptr<Fence> release_fence = nullptr;
+
+ if (is_twm && current_power_mode_ == HWC2::PowerMode::On) {
+ DLOGD("Display is in ON state and device is entering TWM mode.");
+ DisplayError error = stored_display_intf_->SetDisplayState(kStateDoze,
+ false /* teardown */,
+ &release_fence);
+ if (error != kErrorNone) {
+ if (error == kErrorShutDown) {
+ shutdown_pending_ = true;
+ return error;
+ }
+ DLOGE("Set state failed. Error = %d", error);
+ return error;
+ } else {
+ current_power_mode_ = HWC2::PowerMode::Doze;
+ DLOGD("Display moved to DOZE state.");
+ }
+ }
+
+ display_null_.SetActive(true);
+ DLOGD("Null display is connected successfully");
+ } else {
+ DLOGD("Null display is already connected.");
+ }
+ } else {
+ if (display_null_.IsActive()) {
+ if (is_twm) {
+ DLOGE("Unexpected event. Display state may be inconsistent.");
+ return kErrorNotSupported;
+ }
+ display_intf_ = stored_display_intf_;
+ validated_ = false;
+ display_null_.SetActive(false);
+ DLOGD("Display is connected successfully");
+ } else {
+ DLOGD("Display is already connected.");
+ }
+ }
+ return kErrorNone;
+}
+
HWC2::Error HWCDisplayBuiltIn::UpdateDisplayId(hwc2_display_t id) {
id_ = id;
return HWC2::Error::None;
@@ -1330,13 +1467,7 @@ bool HWCDisplayBuiltIn::HasSmartPanelConfig(void) {
return IsSmartPanelConfig(config);
}
- for (auto &config : variable_config_map_) {
- if (config.second.smart_panel) {
- return true;
- }
- }
-
- return false;
+ return smart_panel_config_;
}
int HWCDisplayBuiltIn::Deinit() {
@@ -1516,4 +1647,34 @@ uint32_t HWCDisplayBuiltIn::GetUpdatingAppLayersCount() {
return updating_count;
}
+bool HWCDisplayBuiltIn::IsDisplayIdle() {
+ // Notify only if this display is source of vsync.
+ bool vsync_source = (callbacks_->GetVsyncSource() == id_);
+ return vsync_source && display_idle_;
+}
+
+void HWCDisplayBuiltIn::SetCpuPerfHintLargeCompCycle() {
+ if (!cpu_hint_ || !perf_hint_large_comp_cycle_) {
+ DLOGV_IF(kTagResources, "cpu_hint_ not initialized or property not set");
+ return;
+ }
+
+ //Send large comp cycle hint only for fps >= 90
+ if (active_refresh_rate_ < 90) {
+ DLOGV_IF(kTagResources, "Skip large comp cycle hint for current fps - %u",
+ active_refresh_rate_);
+ return;
+ }
+
+ for (auto hwc_layer : layer_set_) {
+ Layer *layer = hwc_layer->GetSDMLayer();
+ if (layer->composition == kCompositionGPU) {
+ DLOGV_IF(kTagResources, "Set perf hint for large comp cycle");
+ int hwc_tid = gettid();
+ cpu_hint_->ReqHintsOffload(kPerfHintLargeCompCycle, hwc_tid);
+ break;
+ }
+ }
+}
+
} // namespace sdm