From 2619aabb8754718ce4469407afd3004bfdea768e Mon Sep 17 00:00:00 2001 From: Andrii Chepurnyi Date: Fri, 3 Jul 2020 11:21:33 +0300 Subject: [PATCH] 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 Signed-off-by: John Stultz Change-Id: Idacb32abdcf7ac399ef989f24ab7a360248466f9 --- drmhwctwo.cpp | 20 ++++++++++++++++++++ include/drmhwctwo.h | 2 ++ 2 files changed, 22 insertions(+) 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); + case HWC2::FunctionDescriptor::GetDisplayBrightnessSupport: + return ToHook( + DisplayHook); + case HWC2::FunctionDescriptor::SetDisplayBrightness: + return ToHook( + DisplayHook); #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, -- 2.11.0