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
diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp
index ae9d5da..5afc96d 100644
--- a/drmhwctwo.cpp
+++ b/drmhwctwo.cpp
@@ -1027,6 +1027,18 @@
 
   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 @@
           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 @@
                                              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,