st/dri: don't expose modifiers in EGL if the driver doesn't implement them
authorMarek Olšák <marek.olsak@amd.com>
Wed, 27 Sep 2017 14:53:26 +0000 (16:53 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 27 Sep 2017 15:59:50 +0000 (17:59 +0200)
This unbreaks waffle/gbm (piglit/gbm) which fails initialization.

v2: also don't set queryDmaBufFormats

Reviewed-by: Daniel Stone <daniel@fooishbar.org>
src/gallium/state_trackers/dri/dri2.c

index 1e8bb48104465f89d1b71252b2f5bf913574ce19..867217478788cdcde7ebfa704e83924c64a88b3a 100644 (file)
@@ -1996,9 +1996,11 @@ dri2_init_screen(__DRIscreen * sPriv)
          dri2ImageExtension.createImageFromFds = dri2_from_fds;
          dri2ImageExtension.createImageFromDmaBufs = dri2_from_dma_bufs;
          dri2ImageExtension.createImageFromDmaBufs2 = dri2_from_dma_bufs2;
-         dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
-         dri2ImageExtension.queryDmaBufModifiers =
-                                    dri2_query_dma_buf_modifiers;
+         if (pscreen->query_dmabuf_modifiers) {
+            dri2ImageExtension.queryDmaBufFormats = dri2_query_dma_buf_formats;
+            dri2ImageExtension.queryDmaBufModifiers =
+                                       dri2_query_dma_buf_modifiers;
+         }
       }
    }