OSDN Git Service

drm_hwcomposer: Implement GetRenderIntents stub
authorAndrii Chepurnyi <andrii_chepurnyi@epam.com>
Fri, 24 Apr 2020 11:20:24 +0000 (14:20 +0300)
committerJohn Stultz <john.stultz@linaro.org>
Fri, 3 Jul 2020 20:14:25 +0000 (20:14 +0000)
Fix VTS test GraphicsComposerHidlTest.GetRenderIntentsBadDisplay.

Signed-off-by: Andrii Chepurnyi <andrii_chepurnyi@epam.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Change-Id: I5ceec735b5684581178070e75d96f5961b774f5f

drmhwctwo.cpp
include/drmhwctwo.h

index 8338f59..4b02b6e 100644 (file)
@@ -1029,6 +1029,26 @@ HWC2::Error DrmHwcTwo::HwcDisplay::GetDisplayCapabilities(
 }
 #endif /* PLATFORM_SDK_VERSION > 28 */
 
+#if PLATFORM_SDK_VERSION > 27
+
+HWC2::Error DrmHwcTwo::HwcDisplay::GetRenderIntents(
+    int32_t mode, uint32_t *outNumIntents,
+    int32_t * /*android_render_intent_v1_1_t*/ outIntents) {
+  if (mode != HAL_COLOR_MODE_NATIVE) {
+    return HWC2::Error::BadParameter;
+  }
+
+  if (outIntents == nullptr) {
+    *outNumIntents = 1;
+    return HWC2::Error::None;
+  }
+  *outNumIntents = 1;
+  outIntents[0] = HAL_RENDER_INTENT_COLORIMETRIC;
+  return HWC2::Error::None;
+}
+
+#endif /* PLATFORM_SDK_VERSION > 27 */
+
 HWC2::Error DrmHwcTwo::HwcLayer::SetCursorPosition(int32_t x, int32_t y) {
   supported(__func__);
   cursor_x_ = x;
@@ -1345,6 +1365,13 @@ hwc2_function_pointer_t DrmHwcTwo::HookDevGetFunction(
       return ToHook<HWC2_PFN_VALIDATE_DISPLAY>(
           DisplayHook<decltype(&HwcDisplay::ValidateDisplay),
                       &HwcDisplay::ValidateDisplay, uint32_t *, uint32_t *>);
+#if PLATFORM_SDK_VERSION > 27
+    case HWC2::FunctionDescriptor::GetRenderIntents:
+      return ToHook<HWC2_PFN_GET_RENDER_INTENTS>(
+          DisplayHook<decltype(&HwcDisplay::GetRenderIntents),
+                      &HwcDisplay::GetRenderIntents, int32_t, uint32_t *,
+                      int32_t *>);
+#endif
 #if PLATFORM_SDK_VERSION > 28
     case HWC2::FunctionDescriptor::GetDisplayIdentificationData:
       return ToHook<HWC2_PFN_GET_DISPLAY_IDENTIFICATION_DATA>(
index 2bbe334..ca85fb5 100644 (file)
@@ -190,6 +190,10 @@ class DrmHwcTwo : public hwc2_device_t {
                                    uint32_t *num_elements, hwc2_layer_t *layers,
                                    int32_t *layer_requests);
     HWC2::Error GetDisplayType(int32_t *type);
+#if PLATFORM_SDK_VERSION > 27
+    HWC2::Error GetRenderIntents(int32_t mode, uint32_t *outNumIntents,
+                                 int32_t *outIntents);
+#endif
 #if PLATFORM_SDK_VERSION > 28
     HWC2::Error GetDisplayIdentificationData(uint8_t *outPort,
                                              uint32_t *outDataSize,