vulkan/wsi: Only use LINEAR modifier for prime if supported.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 5 May 2018 13:34:44 +0000 (15:34 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 8 May 2018 13:47:16 +0000 (15:47 +0200)
This was setting the LINEAR modifier if neither the
X server nor the driver supported modifiers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106180
Fixes: c80c08e226 "vulkan/wsi/x11: Add support for DRI3 v1.2"
CC: 18.1 <mesa-stable@lists.freedesktop.org>
Tested-by: Abel Garcia Dorta <mercuriete@gmail.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/vulkan/wsi/wsi_common.c
src/vulkan/wsi/wsi_common_private.h
src/vulkan/wsi/wsi_common_x11.c

index fe262b4968d3e45fa538b05d7183698a472140f1..87e508ddf85792737a5ed356c148d4773f191fb4 100644 (file)
@@ -442,6 +442,7 @@ fail:
 VkResult
 wsi_create_prime_image(const struct wsi_swapchain *chain,
                        const VkSwapchainCreateInfoKHR *pCreateInfo,
+                       bool use_modifier,
                        struct wsi_image *image)
 {
    const struct wsi_device *wsi = chain->wsi;
@@ -626,7 +627,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain,
    if (result != VK_SUCCESS)
       goto fail;
 
-   image->drm_modifier = DRM_FORMAT_MOD_LINEAR;
+   image->drm_modifier = use_modifier ? DRM_FORMAT_MOD_LINEAR : DRM_FORMAT_MOD_INVALID;
    image->num_planes = 1;
    image->sizes[0] = linear_size;
    image->row_pitches[0] = linear_stride;
index b608119b96962919e7ac45e8e3aeb8241207db39..90941c8201b20ba0f9e80f1be85b9a09775dc7a0 100644 (file)
@@ -89,6 +89,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
 VkResult
 wsi_create_prime_image(const struct wsi_swapchain *chain,
                        const VkSwapchainCreateInfoKHR *pCreateInfo,
+                       bool use_modifier,
                        struct wsi_image *image);
 
 void
index 3a00caddfb90f9384faf836f3c56cfdfb981a484..62739b99125412ec9d73f1cf5861f9dd97af113d 100644 (file)
@@ -1043,7 +1043,8 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
    uint32_t bpp = 32;
 
    if (chain->base.use_prime_blit) {
-      result = wsi_create_prime_image(&chain->base, pCreateInfo, &image->base);
+      bool use_modifier = num_tranches > 0;
+      result = wsi_create_prime_image(&chain->base, pCreateInfo, use_modifier, &image->base);
    } else {
       result = wsi_create_native_image(&chain->base, pCreateInfo,
                                        num_tranches, num_modifiers, modifiers,