diff options
author | Chirag Khurana <ckhurana@codeaurora.org> | 2021-07-29 01:09:45 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2021-07-30 14:49:59 -0700 |
commit | 14f53ed4f8fb3f36193c7ebe5e9cedffd72b3f4f (patch) | |
tree | 81feb0f12a7b8648bb0e4000b3e731681989825d | |
parent | 648eaa352b672182c379bb20fee2a170d5cce308 (diff) |
composer: Add support to read panel info
- Implement GET_PANEL_RESOLUTION binder support. Clients
can use this api to read the panel width and height
during boot time.
Change-Id: I81d223cd94eca36f685721ef7f8fcc2985457886
-rw-r--r-- | composer/hwc_session.cpp | 26 | ||||
-rw-r--r-- | composer/hwc_session.h | 2 | ||||
-rw-r--r-- | libqdutils/display_config.cpp | 19 | ||||
-rw-r--r-- | libqdutils/display_config.h | 3 | ||||
-rw-r--r-- | libqservice/IQService.h | 1 |
5 files changed, 51 insertions, 0 deletions
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp index a1c48c61..f0a0b44d 100644 --- a/composer/hwc_session.cpp +++ b/composer/hwc_session.cpp @@ -1719,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; @@ -2496,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()); diff --git a/composer/hwc_session.h b/composer/hwc_session.h index acd8844d..140f009f 100644 --- a/composer/hwc_session.h +++ b/composer/hwc_session.h @@ -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); diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp index 0157a536..dc590e95 100644 --- a/libqdutils/display_config.cpp +++ b/libqdutils/display_config.cpp @@ -409,3 +409,22 @@ extern "C" int setStandByMode(int mode) { } return err; } + +extern "C" int getPanelResolution(int *width, int *height) { + status_t err = (status_t) FAILED_TRANSACTION; + sp<IQService> binder = getBinder(); + Parcel inParcel, outParcel; + + if(binder != NULL) { + err = binder->dispatch(IQService::GET_PANEL_RESOLUTION, + &inParcel, &outParcel); + if(err != 0) { + ALOGE_IF(getBinder(), "%s() failed with err %d", __FUNCTION__, err); + } else { + *width = outParcel.readInt32(); + *height = outParcel.readInt32(); + } + } + + return err; +} diff --git a/libqdutils/display_config.h b/libqdutils/display_config.h index 81f22d75..d3f75d56 100644 --- a/libqdutils/display_config.h +++ b/libqdutils/display_config.h @@ -173,6 +173,9 @@ int setPanelLuminanceAttributes(int dpy, float min_lum, float max_lum); // Sets display standy mode extern "C" int setStandByMode(int mode); +// Get Panel Resolution +extern "C" int getPanelResolution(int *width, int *height); + }; //namespace diff --git a/libqservice/IQService.h b/libqservice/IQService.h index 473de12b..c7283ac3 100644 --- a/libqservice/IQService.h +++ b/libqservice/IQService.h @@ -80,6 +80,7 @@ public: SET_BRIGHTNESS_SCALE = 48, // Set brightness scale ratio SET_COLOR_SAMPLING_ENABLED = 49, // Toggle the collection of display color stats SET_STAND_BY_MODE = 50, // Set stand by mode for MDP hardware + GET_PANEL_RESOLUTION = 51, // Get Panel Resolution COMMAND_LIST_END = 400, }; |