summaryrefslogtreecommitdiff
path: root/composer/hwc_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'composer/hwc_session.cpp')
-rw-r--r--composer/hwc_session.cpp60
1 files changed, 58 insertions, 2 deletions
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index 4b56fa73..51d25f28 100644
--- a/composer/hwc_session.cpp
+++ b/composer/hwc_session.cpp
@@ -1120,8 +1120,14 @@ int32_t HWCSession::SetPowerMode(hwc2_display_t display, int32_t int_mode) {
return HWC2_ERROR_NONE;
}
+ // 1. For power transition cases other than Off->On or On->Off, async power mode
+ // will not be used. Hence, set override_mode to false for them.
+ // 2. When SF requests Doze mode transition on panels where Doze mode is not supported
+ // (like video mode), HWComposer.cpp will override the request to "On". Handle such cases
+ // in main thread path.
if (!((last_power_mode == HWC2::PowerMode::Off && mode == HWC2::PowerMode::On) ||
- (last_power_mode == HWC2::PowerMode::On && mode == HWC2::PowerMode::Off))) {
+ (last_power_mode == HWC2::PowerMode::On && mode == HWC2::PowerMode::Off)) ||
+ (last_power_mode == HWC2::PowerMode::Off && mode == HWC2::PowerMode::On)) {
override_mode = false;
}
@@ -1713,6 +1719,14 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa
status = SetStandByMode(input_parcel);
break;
+ case qService::IQService::GET_PANEL_RESOLUTION:
+ if (!input_parcel || !output_parcel) {
+ DLOGE("QService command = %d: input_parcel and output_parcel needed.", command);
+ break;
+ }
+ status = GetPanelResolution(input_parcel, output_parcel);
+ break;
+
default:
DLOGW("QService command = %d is not supported.", command);
break;
@@ -2490,6 +2504,24 @@ void HWCSession::Refresh(hwc2_display_t display) {
callbacks_.Refresh(display);
}
+android::status_t HWCSession::GetPanelResolution(const android::Parcel *input_parcel,
+ android::Parcel *output_parcel) {
+ SCOPE_LOCK(locker_[HWC_DISPLAY_PRIMARY]);
+
+ if (!hwc_display_[HWC_DISPLAY_PRIMARY]) {
+ DLOGI("Primary display is not initialized");
+ return -EINVAL;
+ }
+ auto panel_width = 0u;
+ auto panel_height = 0u;
+
+ hwc_display_[HWC_DISPLAY_PRIMARY]->GetPanelResolution(&panel_width, &panel_height);
+ output_parcel->writeInt32(INT32(panel_width));
+ output_parcel->writeInt32(INT32(panel_height));
+
+ return android::NO_ERROR;
+}
+
android::status_t HWCSession::GetVisibleDisplayRect(const android::Parcel *input_parcel,
android::Parcel *output_parcel) {
int disp_idx = GetDisplayIndex(input_parcel->readInt32());
@@ -3010,7 +3042,10 @@ HWC2::Error HWCSession::ValidateDisplayInternal(hwc2_display_t display, uint32_t
}
}
- return hwc_display->Validate(out_num_types, out_num_requests);
+ auto status = HWC2::Error::None;
+ status = hwc_display->Validate(out_num_types, out_num_requests);
+ SetCpuPerfHintLargeCompCycle();
+ return status;
}
HWC2::Error HWCSession::PresentDisplayInternal(hwc2_display_t display) {
@@ -3624,4 +3659,25 @@ int32_t HWCSession::SetActiveConfigWithConstraints(
vsync_period_change_constraints, out_timeline);
}
+void HWCSession::SetCpuPerfHintLargeCompCycle() {
+ bool found_non_primary_active_display = false;
+
+ // Check any non-primary display is active
+ for (hwc2_display_t display = HWC_DISPLAY_PRIMARY + 1;
+ display < HWCCallbacks::kNumDisplays; display++) {
+ if (hwc_display_[display] == NULL) {
+ continue;
+ }
+ if (hwc_display_[display]->GetCurrentPowerMode() != HWC2::PowerMode::Off) {
+ found_non_primary_active_display = true;
+ break;
+ }
+ }
+
+ // send cpu hint for primary display
+ if (!found_non_primary_active_display) {
+ hwc_display_[HWC_DISPLAY_PRIMARY]->SetCpuPerfHintLargeCompCycle();
+ }
+}
+
} // namespace sdm