drm_hwcomposer: Add check for format support during plane validation
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>
diff --git a/platform/platform.cpp b/platform/platform.cpp
index 479e79e..a500398 100644
--- a/platform/platform.cpp
+++ b/platform/platform.cpp
@@ -78,6 +78,13 @@
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;
}