summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2021-08-05 10:59:48 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2021-08-05 10:59:47 -0700
commit066d5b19eaa402ca80c769b44cdab685030b873b (patch)
tree360c5fca82cd171cc5b3fd477f2f8892d415f381
parent8a1c780b926ab1fd44f0073a36b0dad0ca09681c (diff)
parent14f53ed4f8fb3f36193c7ebe5e9cedffd72b3f4f (diff)
Merge "composer: Add support to read panel info"
-rw-r--r--composer/hwc_session.cpp26
-rw-r--r--composer/hwc_session.h2
-rw-r--r--libqdutils/display_config.cpp19
-rw-r--r--libqdutils/display_config.h3
-rw-r--r--libqservice/IQService.h1
5 files changed, 51 insertions, 0 deletions
diff --git a/composer/hwc_session.cpp b/composer/hwc_session.cpp
index 4e668cd0..51d25f28 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 db7b2126..4af4bd7f 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,
};