[Mesa-dev] [PATCH] anv/wsi: create swapchain images using specified image usage

Jason Ekstrand jason at jlekstrand.net
Mon Jul 4 17:24:22 UTC 2016


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96791
Cc: "12.0" <mesa-stable at lists.freedesktop.org>

I've added the above tags and pushed the patch.  Thanks!
--Jason

On Mon, Jul 4, 2016 at 10:06 AM, Lionel Landwerlin <
lionel.g.landwerlin at intel.com> wrote:

> The image usage specified by the caller of vkCreateSwapchainKHR should be
> passed onto the internal image creation. Otherwise the driver might later
> crash when the user tries to use the image as a combined sampler even
> though
> the creation was explicitly created with VK_IMAGE_USAGE_TRANSFER_SRC_BIT.
>
> Leaving the previous VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT as this might be
> expected even if the swapchain is created without any flag.
>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/intel/vulkan/anv_wsi_wayland.c | 10 +++++++---
>  src/intel/vulkan/anv_wsi_x11.c     |  3 ++-
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_wsi_wayland.c
> b/src/intel/vulkan/anv_wsi_wayland.c
> index e95359c..a9e1617 100644
> --- a/src/intel/vulkan/anv_wsi_wayland.c
> +++ b/src/intel/vulkan/anv_wsi_wayland.c
> @@ -607,7 +607,9 @@ static const struct wl_buffer_listener buffer_listener
> = {
>  };
>
>  static VkResult
> -wsi_wl_image_init(struct wsi_wl_swapchain *chain, struct wsi_wl_image
> *image,
> +wsi_wl_image_init(struct wsi_wl_swapchain *chain,
> +                  struct wsi_wl_image *image,
> +                  const VkSwapchainCreateInfoKHR *pCreateInfo,
>                    const VkAllocationCallbacks* pAllocator)
>  {
>     VkDevice vk_device = anv_device_to_handle(chain->base.device);
> @@ -633,7 +635,8 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
> struct wsi_wl_image *image,
>           .samples = 1,
>           /* FIXME: Need a way to use X tiling to allow scanout */
>           .tiling = VK_IMAGE_TILING_OPTIMAL,
> -         .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
> +         .usage = (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
> +                   pCreateInfo->imageUsage),
>           .flags = 0,
>        }},
>        pAllocator,
> @@ -794,7 +797,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase
> *icd_surface,
>     }
>
>     for (uint32_t i = 0; i < chain->image_count; i++) {
> -      result = wsi_wl_image_init(chain, &chain->images[i], pAllocator);
> +      result = wsi_wl_image_init(chain, &chain->images[i],
> +                                 pCreateInfo, pAllocator);
>        if (result != VK_SUCCESS)
>           goto fail;
>        chain->images[i].busy = false;
> diff --git a/src/intel/vulkan/anv_wsi_x11.c
> b/src/intel/vulkan/anv_wsi_x11.c
> index d1e23a6..2895d6b 100644
> --- a/src/intel/vulkan/anv_wsi_x11.c
> +++ b/src/intel/vulkan/anv_wsi_x11.c
> @@ -606,7 +606,8 @@ x11_image_init(struct anv_device *device, struct
> x11_swapchain *chain,
>           .samples = 1,
>           /* FIXME: Need a way to use X tiling to allow scanout */
>           .tiling = VK_IMAGE_TILING_OPTIMAL,
> -         .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
> +         .usage = (pCreateInfo->imageUsage |
> +                   VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT),
>           .flags = 0,
>        }},
>        NULL,
> --
> 2.8.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160704/07911544/attachment.html>


More information about the mesa-dev mailing list