[Mesa-dev] [PATCH] wsi/x11: Don't cal pixmap_from_buffers if modifiers is not supported

Jason Ekstrand jason at jlekstrand.net
Sat May 5 18:08:48 UTC 2018


In the prime case, our modifier is always DRM_FORMAT_MOD_LINEAR and we
would end up calling dri3_pixmap_from_buffers on an X server which does
not support it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180
Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2"
---
 src/vulkan/wsi/wsi_common_x11.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index 3a00cad..1c40271 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1055,7 +1055,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
    image->pixmap = xcb_generate_id(chain->conn);
 
 #ifdef HAVE_DRI3_MODIFIERS
-   if (image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
+   if (wsi_conn->has_dri3_modifiers &&
+       image->base.drm_modifier != DRM_FORMAT_MOD_INVALID) {
       /* If the image has a modifier, we must have DRI3 v1.2. */
       assert(chain->has_dri3_modifiers);
 
@@ -1083,6 +1084,9 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
       /* Without passing modifiers, we can't have multi-plane RGB images. */
       assert(image->base.num_planes == 1);
 
+      assert(image->base.drm_modifier == DRM_FORMAT_MOD_LINEAR ||
+             image->base.drm_modifier == DRM_FORMAT_MOD_INVALID);
+
       cookie =
          xcb_dri3_pixmap_from_buffer_checked(chain->conn,
                                              image->pixmap,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list