Skip to content

Commit

Permalink
Merge tag 'LA.UM.9.12.r1-13300-SMxx50.QSSI12.0' of https://source.cod…
Browse files Browse the repository at this point in the history
…eaurora.org/quic/la/platform/hardware/qcom/display into 12

"LA.UM.9.12.r1-13300-SMxx50.QSSI12.0"
  • Loading branch information
markakash committed Nov 22, 2021
2 parents c809692 + b937182 commit cb4b2b2
Show file tree
Hide file tree
Showing 26 changed files with 395 additions and 96 deletions.
1 change: 1 addition & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ endif
display-hals += gralloc
display-hals += sde-drm
display-hals += composer
display-hals += init

ifneq ($(TARGET_PROVIDES_LIBLIGHT),true)
display-hals += liblight
Expand Down
14 changes: 7 additions & 7 deletions composer/hwc_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2812,25 +2812,25 @@ int HWCDisplay::GetActiveConfigIndex() {

HWC2::Error HWCDisplay::GetClientTargetProperty(ClientTargetProperty *out_client_target_property) {

Layer *client_target_layer = client_target_->GetSDMLayer();
if (!client_target_layer->request.flags.update_format) {
Layer *client_layer = client_target_->GetSDMLayer();
if (!client_layer->request.flags.update_format) {
return HWC2::Error::None;
}
int32_t format = 0;
uint64_t flags = 0;
auto err = buffer_allocator_->SetBufferInfo(client_target_layer->request.format, &format,
auto err = buffer_allocator_->SetBufferInfo(client_layer->request.format, &format,
&flags);
if (err) {
DLOGE("Invalid format: %s requested", GetFormatString(client_target_layer->request.format));
DLOGE("Invalid format: %s requested", GetFormatString(client_layer->request.format));
return HWC2::Error::BadParameter;
}
Dataspace dataspace;
DisplayError error = ColorMetadataToDataspace(layer_stack_.gpu_target_color_metadata,
DisplayError error = ColorMetadataToDataspace(client_layer->request.color_metadata,
&dataspace);
if (error != kErrorNone) {
DLOGE("Invalid Dataspace requested: Primaries = %d Transfer = %d ds = %d",
layer_stack_.gpu_target_color_metadata.colorPrimaries,
layer_stack_.gpu_target_color_metadata.transfer, dataspace);
client_layer->request.color_metadata.colorPrimaries,
client_layer->request.color_metadata.transfer, dataspace);
return HWC2::Error::BadParameter;
}
out_client_target_property->dataspace = dataspace;
Expand Down
3 changes: 2 additions & 1 deletion composer/hwc_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ class HWCDisplay : public DisplayEventHandler {
return false;
}

virtual void SetCpuPerfHintLargeCompCycle() {};
// Display Configurations
static uint32_t GetThrottlingRefreshRate() { return HWCDisplay::throttling_refresh_rate_; }
static void SetThrottlingRefreshRate(uint32_t newRefreshRate)
Expand All @@ -249,7 +250,7 @@ class HWCDisplay : public DisplayEventHandler {
virtual int SetState(bool connected) {
return kErrorNotSupported;
}
virtual DisplayError SetStandByMode(bool enable) {
virtual DisplayError SetStandByMode(bool enable, bool is_twm) {
return kErrorNotSupported;
}
virtual DisplayError Flush() {
Expand Down
34 changes: 32 additions & 2 deletions composer/hwc_display_builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ HWC2::Error HWCDisplayBuiltIn::Validate(uint32_t *out_num_types, uint32_t *out_n
}

status = PrepareLayerStack(out_num_types, out_num_requests);
SetCpuPerfHintLargeCompCycle();
pending_commit_ = true;
return status;
}
Expand Down Expand Up @@ -1332,18 +1331,42 @@ DisplayError HWCDisplayBuiltIn::GetSupportedDSIClock(std::vector<uint64_t> *bitc
return kErrorNotSupported;
}

DisplayError HWCDisplayBuiltIn::SetStandByMode(bool enable) {
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);
Expand Down Expand Up @@ -1649,6 +1672,13 @@ void HWCDisplayBuiltIn::SetCpuPerfHintLargeCompCycle() {
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) {
Expand Down
2 changes: 1 addition & 1 deletion composer/hwc_display_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class HWCDisplayBuiltIn : public HWCDisplay, public SyncTask<LayerStitchTaskCode
virtual DisplayError SetDynamicDSIClock(uint64_t bitclk);
virtual DisplayError GetDynamicDSIClock(uint64_t *bitclk);
virtual DisplayError GetSupportedDSIClock(std::vector<uint64_t> *bitclk_rates);
virtual DisplayError SetStandByMode(bool enable);
virtual DisplayError SetStandByMode(bool enable, bool is_twm);
virtual HWC2::Error UpdateDisplayId(hwc2_display_t id);
virtual HWC2::Error SetPendingRefresh();
virtual HWC2::Error SetPanelBrightness(float brightness);
Expand Down
4 changes: 2 additions & 2 deletions composer/hwc_display_virtual_gpu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2019-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
Expand Down Expand Up @@ -76,7 +76,7 @@ class HWCDisplayVirtualGPU : public HWCDisplayVirtual,
SyncTask<ColorConvertTaskCode>::TaskContext *task_context);

SyncTask<ColorConvertTaskCode> color_convert_task_;
GLColorConvert *gl_color_convert_;
GLColorConvert *gl_color_convert_ = nullptr;

bool disable_animation_ = false;
bool animation_in_progress_ = false;
Expand Down
67 changes: 64 additions & 3 deletions composer/hwc_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -2521,13 +2553,18 @@ android::status_t HWCSession::SetStandByMode(const android::Parcel *input_parcel
SCOPE_LOCK(locker_[HWC_DISPLAY_PRIMARY]);

bool enable = (input_parcel->readInt32() > 0);
bool is_twm = (input_parcel->readInt32() > 0);

if (!hwc_display_[HWC_DISPLAY_PRIMARY]) {
DLOGI("Primary display is not initialized");
return -EINVAL;
}

hwc_display_[HWC_DISPLAY_PRIMARY]->SetStandByMode(enable);
DisplayError error = hwc_display_[HWC_DISPLAY_PRIMARY]->SetStandByMode(enable, is_twm);
if (error != kErrorNone) {
DLOGE("SetStandByMode failed. Error = %d", error);
return -EINVAL;
}

return android::NO_ERROR;
}
Expand Down Expand Up @@ -3010,7 +3047,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) {
Expand Down Expand Up @@ -3624,4 +3664,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
3 changes: 3 additions & 0 deletions composer/hwc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
android::status_t SetColorModeFromClient(const android::Parcel *input_parcel);
android::status_t getComposerStatus();
android::status_t SetStandByMode(const android::Parcel *input_parcel);
android::status_t GetPanelResolution(const android::Parcel *input_parcel,
android::Parcel *output_parcel);
android::status_t SetQSyncMode(const android::Parcel *input_parcel);
android::status_t SetIdlePC(const android::Parcel *input_parcel);
android::status_t RefreshScreen(const android::Parcel *input_parcel);
Expand All @@ -509,6 +511,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, public qClient::BnQClient,
uint32_t *out_num_requests);
HWC2::Error PresentDisplayInternal(hwc2_display_t display);
void HandleSecureSession();
void SetCpuPerfHintLargeCompCycle();
void HandlePendingPowerMode(hwc2_display_t display, const shared_ptr<Fence> &retire_fence);
void HandlePendingHotplug(hwc2_display_t disp_id, const shared_ptr<Fence> &retire_fence);
bool IsPluggableDisplayConnected();
Expand Down
Loading

0 comments on commit cb4b2b2

Please sign in to comment.