summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrii Chepurnyi <andrii_chepurnyi@epam.com>2020-07-03 11:21:33 +0300
committerJohn Stultz <john.stultz@linaro.org>2020-07-03 20:14:40 +0000
commit2619aabb8754718ce4469407afd3004bfdea768e (patch)
treede9936578c21f881ec97fa7a70bc2f2311407d89
parent857a53f88435373ac92afaa91f523687a3f1b04c (diff)
drm_hwcomposer: Implement *DisplayBrightness* stubs
Implement *DisplayBrightness* stub to be able boot Android 11 using android.hardware.graphics.composer@2.3-service. This change caused by error during boot: failed to get hwcomposer2 function 61 61 is equal to SetDisplayBrightness. GetDisplayBrightnessSupport is a companion of it. Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Change-Id: Idacb32abdcf7ac399ef989f24ab7a360248466f9
-rw-r--r--drmhwctwo.cpp20
-rw-r--r--include/drmhwctwo.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index ae9d5da..5afc96d 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -1027,6 +1027,18 @@ HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayCapabilities(
return HWC2::Error::None;
}
+
+HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayBrightnessSupport(
+ bool *supported) {
+ *supported = false;
+ return HWC2::Error::None;
+}
+
+HWC2::Error DrmHwcTwo::HwcDisplay::SetDisplayBrightness(
+ float /* brightness */) {
+ return HWC2::Error::Unsupported;
+}
+
#endif /* PLATFORM_SDK_VERSION > 28 */
#if PLATFORM_SDK_VERSION > 27
@@ -1397,6 +1409,14 @@ hwc2_function_pointer_t DrmHwcTwo::HookDevGetFunction(
DisplayHook<decltype(&HwcDisplay::GetDisplayCapabilities),
&HwcDisplay::GetDisplayCapabilities, uint32_t *,
uint32_t *>);
+ case HWC2::FunctionDescriptor::GetDisplayBrightnessSupport:
+ return ToHook<HWC2_PFN_GET_DISPLAY_BRIGHTNESS_SUPPORT>(
+ DisplayHook<decltype(&HwcDisplay::GetDisplayBrightnessSupport),
+ &HwcDisplay::GetDisplayBrightnessSupport, bool *>);
+ case HWC2::FunctionDescriptor::SetDisplayBrightness:
+ return ToHook<HWC2_PFN_SET_DISPLAY_BRIGHTNESS>(
+ DisplayHook<decltype(&HwcDisplay::SetDisplayBrightness),
+ &HwcDisplay::SetDisplayBrightness, float>);
#endif /* PLATFORM_SDK_VERSION > 28 */
// Layer functions
case HWC2::FunctionDescriptor::SetCursorPosition:
diff --git a/include/drmhwctwo.h b/include/drmhwctwo.h
index 712510b..1f226bc 100644
--- a/include/drmhwctwo.h
+++ b/include/drmhwctwo.h
@@ -201,6 +201,8 @@ class DrmHwcTwo : public hwc2_device_t {
uint8_t *outData);
HWC2::Error GetDisplayCapabilities(uint32_t *outNumCapabilities,
uint32_t *outCapabilities);
+ HWC2::Error GetDisplayBrightnessSupport(bool *supported);
+ HWC2::Error SetDisplayBrightness(float);
#endif
HWC2::Error GetDozeSupport(int32_t *support);
HWC2::Error GetHdrCapabilities(uint32_t *num_types, int32_t *types,