From f49d6f47f3c2eb55f846ba9dc2e1e09ba3c86ea5 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 21 Jan 2022 15:19:05 +0000 Subject: [PATCH] gl-renderer: Reject unknown-format dmabufs Make sure we only import dmabufs where the underlying pixel_format is known: if we can't reason about the buffer content, we're not entirely likely to be able to display it well. Signed-off-by: Daniel Stone --- libweston/renderer-gl/gl-renderer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index d82df49d..bf47dd66 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2626,6 +2626,9 @@ import_dmabuf(struct gl_renderer *gr, struct dmabuf_image *image; GLenum target; + if (!pixel_format_get_info(dmabuf->attributes.format)) + return NULL; + image = dmabuf_image_create(); image->dmabuf = dmabuf; @@ -2876,6 +2879,9 @@ populate_supported_formats(struct weston_compositor *ec, return 0; for (i = 0; i < num_formats; i++) { + if (!pixel_format_get_info(formats[i])) + continue; + fmt = weston_drm_format_array_add_format(supported_formats, formats[i]); if (!fmt) {