[PATCH xserver 10/15] dri3: return BadImplementation when missing ::get_{formats, modifiers}

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 2 15:41:21 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

If the implementations is missing the required functionality simply
return BadImplementation.

Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers")
Cc: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
Cc: Daniel Stone <daniels at collabora.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 dri3/dri3_screen.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c
index ee23336a5..ec9afe28a 100644
--- a/dri3/dri3_screen.c
+++ b/dri3/dri3_screen.c
@@ -124,16 +124,9 @@ cache_formats_and_modifiers(ScreenPtr screen)
     if (ds->formats_cached)
         return Success;
 
-    if (!info)
+    if (!info || !info->get_formats || !info->get_modifiers)
         return BadImplementation;
 
-    if (!info->get_formats || !info->get_modifiers) {
-        ds->formats = NULL;
-        ds->num_formats = 0;
-        ds->formats_cached = TRUE;
-        return Success;
-    }
-
     (*info->get_formats) (screen, &ds->num_formats, &formats);
     ds->formats = calloc(ds->num_formats, sizeof(dri3_dmabuf_format_rec));
     if (!ds->formats)
-- 
2.16.0



More information about the xorg-devel mailing list