diff options
author | Archit Srivastava <archsriv@codeaurora.org> | 2019-05-20 10:54:22 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-06-05 21:30:29 -0700 |
commit | 34042248bb01fdb87f68b8d3c6b60f0cc8b0fe8d (patch) | |
tree | 615e0a7f8b07ea6283cda3d8c21b05cdb0e0f8df /sdm/libs/hwc2/hwc_session.cpp | |
parent | 76e37e0712129ef50a12f50dd4694e0e1376fba4 (diff) |
display: Add API to set luminance
-Add API to set min/max luminance range for given display.
-using API via binder
adb shell "vndservice call display.qservice 46 i32 <display_id>
f <min_lum> f <max_lum>"
Change-Id: I97c31b18cac4ab8ac45518833d0964b7e54c9d58
Diffstat (limited to 'sdm/libs/hwc2/hwc_session.cpp')
-rw-r--r-- | sdm/libs/hwc2/hwc_session.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp index 1c1ea99c..674f666c 100644 --- a/sdm/libs/hwc2/hwc_session.cpp +++ b/sdm/libs/hwc2/hwc_session.cpp @@ -1276,7 +1276,8 @@ HWC2::Error HWCSession::CreateVirtualDisplayObj(uint32_t width, uint32_t height, } status = HWCDisplayVirtual::Create(core_intf_, &buffer_allocator_, &callbacks_, client_id, - info.display_id, width, height, format, &hwc_display); + info.display_id, width, height, format, &hwc_display, + set_min_lum_, set_max_lum_); // TODO(user): validate width and height support if (status) { return HWC2::Error::NoResources; @@ -1616,6 +1617,14 @@ android::status_t HWCSession::notifyCallback(uint32_t command, const android::Pa status = GetSupportedDsiClk(input_parcel, output_parcel); break; + case qService::IQService::SET_PANEL_LUMINANCE: + if (!input_parcel) { + DLOGE("QService command = %d: input_parcel needed.", command); + break; + } + status = SetPanelLuminanceAttributes(input_parcel); + break; + case qService::IQService::SET_COLOR_MODE_FROM_CLIENT: if (!input_parcel) { DLOGE("QService command = %d: input_parcel needed.", command); @@ -2265,6 +2274,22 @@ android::status_t HWCSession::GetSupportedDsiClk(const android::Parcel *input_pa return 0; } +android::status_t HWCSession::SetPanelLuminanceAttributes(const android::Parcel *input_parcel) { + int disp_id = input_parcel->readInt32(); + + // currently doing only for virtual display + if (disp_id != qdutils::DISPLAY_VIRTUAL) { + return -EINVAL; + } + + std::lock_guard<std::mutex> obj(mutex_lum_); + set_min_lum_ = input_parcel->readFloat(); + set_max_lum_ = input_parcel->readFloat(); + DLOGI("set max_lum %f, min_lum %f", set_max_lum_, set_min_lum_); + + return 0; +} + void HWCSession::UEventHandler(const char *uevent_data, int length) { // Drop hotplug uevents until SurfaceFlinger (the client) is connected. The equivalent of hotplug // uevent handling will be done once when SurfaceFlinger connects, at RegisterCallback(). Since |