<div dir="ltr"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div>Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=96791">https://bugs.freedesktop.org/show_bug.cgi?id=96791</a><br></div>Cc: "12.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a>><br><div><div><div class="gmail_extra"><br></div><div class="gmail_extra">I've added the above tags and pushed the patch.  Thanks!<br></div><div class="gmail_extra">--Jason<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 4, 2016 at 10:06 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The image usage specified by the caller of vkCreateSwapchainKHR should be<br>
passed onto the internal image creation. Otherwise the driver might later<br>
crash when the user tries to use the image as a combined sampler even though<br>
the creation was explicitly created with VK_IMAGE_USAGE_TRANSFER_SRC_BIT.<br>
<br>
Leaving the previous VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT as this might be<br>
expected even if the swapchain is created without any flag.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>><br>
---<br>
 src/intel/vulkan/anv_wsi_wayland.c | 10 +++++++---<br>
 src/intel/vulkan/anv_wsi_x11.c     |  3 ++-<br>
 2 files changed, 9 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_wsi_wayland.c b/src/intel/vulkan/anv_wsi_wayland.c<br>
index e95359c..a9e1617 100644<br>
--- a/src/intel/vulkan/anv_wsi_wayland.c<br>
+++ b/src/intel/vulkan/anv_wsi_wayland.c<br>
@@ -607,7 +607,9 @@ static const struct wl_buffer_listener buffer_listener = {<br>
 };<br>
<br>
 static VkResult<br>
-wsi_wl_image_init(struct wsi_wl_swapchain *chain, struct wsi_wl_image *image,<br>
+wsi_wl_image_init(struct wsi_wl_swapchain *chain,<br>
+                  struct wsi_wl_image *image,<br>
+                  const VkSwapchainCreateInfoKHR *pCreateInfo,<br>
                   const VkAllocationCallbacks* pAllocator)<br>
 {<br>
    VkDevice vk_device = anv_device_to_handle(chain->base.device);<br>
@@ -633,7 +635,8 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain, struct wsi_wl_image *image,<br>
          .samples = 1,<br>
          /* FIXME: Need a way to use X tiling to allow scanout */<br>
          .tiling = VK_IMAGE_TILING_OPTIMAL,<br>
-         .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,<br>
+         .usage = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |<br>
+                   pCreateInfo->imageUsage),<br>
          .flags = 0,<br>
       }},<br>
       pAllocator,<br>
@@ -794,7 +797,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,<br>
    }<br>
<br>
    for (uint32_t i = 0; i < chain->image_count; i++) {<br>
-      result = wsi_wl_image_init(chain, &chain->images[i], pAllocator);<br>
+      result = wsi_wl_image_init(chain, &chain->images[i],<br>
+                                 pCreateInfo, pAllocator);<br>
       if (result != VK_SUCCESS)<br>
          goto fail;<br>
       chain->images[i].busy = false;<br>
diff --git a/src/intel/vulkan/anv_wsi_x11.c b/src/intel/vulkan/anv_wsi_x11.c<br>
index d1e23a6..2895d6b 100644<br>
--- a/src/intel/vulkan/anv_wsi_x11.c<br>
+++ b/src/intel/vulkan/anv_wsi_x11.c<br>
@@ -606,7 +606,8 @@ x11_image_init(struct anv_device *device, struct x11_swapchain *chain,<br>
          .samples = 1,<br>
          /* FIXME: Need a way to use X tiling to allow scanout */<br>
          .tiling = VK_IMAGE_TILING_OPTIMAL,<br>
-         .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,<br>
+         .usage = (pCreateInfo->imageUsage |<br>
+                   VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT),<br>
          .flags = 0,<br>
       }},<br>
       NULL,<br>
<span class=""><font color="#888888">--<br>
2.8.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div></div></div>