OSDN Git Service

drm_hwcomposer: Add check for format support during plane validation
authorRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
Thu, 10 Sep 2020 09:07:37 +0000 (12:07 +0300)
committerRoman Kovalivskyi <roman.kovalivskyi@globallogic.com>
Fri, 25 Sep 2020 11:58:04 +0000 (14:58 +0300)
Some layers have pixel format that aren't supported by a hardware. In
such case it is better to reject plane that doesn't supports such
format, so we could handle it in future, rather than accepting it,
passing to the kernel side and failing whole composition.

Signed-off-by: Roman Kovalivskyi <roman.kovalivskyi@globallogic.com>
platform/platform.cpp

index 479e79e..a500398 100644 (file)
@@ -78,6 +78,13 @@ int Planner::PlanStage::ValidatePlane(DrmPlane *plane, DrmHwcLayer *layer) {
       ALOGE("Expected a valid blend mode on plane %d", plane->id());
   }
 
+  uint32_t format = layer->buffer->format;
+  if (!plane->IsFormatSupported(format)) {
+    ALOGE("Plane %d does not supports %c%c%c%c format", plane->id(), format,
+          format >> 8, format >> 16, format >> 24);
+    return -EINVAL;
+  }
+
   return ret;
 }