[Mesa-dev] [PATCH] st/dri: don't expose modifiers in EGL if the driver doesn't implement them

Marek Olšák maraeo at gmail.com
Wed Sep 27 14:55:55 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

This unbreaks waffle/gbm (piglit/gbm) which fails initialization.
---
 src/gallium/state_trackers/dri/dri2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 1e8bb48..c499822 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1990,22 +1990,24 @@ dri2_init_screen(__DRIscreen * sPriv)
 
    if (dmabuf_ret && dmabuf_ret->val.val_bool) {
       uint64_t cap;
 
       if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
           (cap & DRM_PRIME_CAP_IMPORT)) {
          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.queryDmaBufModifiers =
+                                       dri2_query_dma_buf_modifiers;
+         }
       }
    }
 
    if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) {
       sPriv->extensions = dri_robust_screen_extensions;
       screen->has_reset_status_query = true;
    }
    else
       sPriv->extensions = dri_screen_extensions;
 
-- 
2.7.4



More information about the mesa-dev mailing list