From 675c2dabd33b9df0c094c32287acabe358f93819 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 22 Jul 2021 18:38:20 -0500 Subject: [PATCH] vulkan/wsi: Set MUTABLE_FORMAT_BIT in the prime path Fixes: 4bdf8547f4dc "vulkan/wsi: Implement VK_KHR_swapchain_mutable_format" Reviewed-by: Lionel Landwerlin Acked-by: Erik Faye-Lund Part-of: (cherry picked from commit 8299d5f37f1689ca90278eab45b0277c89cca058) --- .pick_status.json | 2 +- src/vulkan/wsi/wsi_common_drm.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 37d3fecf32d..7f8163b1ad0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -3064,7 +3064,7 @@ "description": "vulkan/wsi: Set MUTABLE_FORMAT_BIT in the prime path", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4bdf8547f4dc1a383bf4e67110f44610a3790189" }, diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c index 09684b2272d..347fc6e25e1 100644 --- a/src/vulkan/wsi/wsi_common_drm.c +++ b/src/vulkan/wsi/wsi_common_drm.c @@ -531,7 +531,7 @@ wsi_create_prime_image(const struct wsi_swapchain *chain, .sType = VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA, .prime_blit_src = true, }; - const VkImageCreateInfo image_info = { + VkImageCreateInfo image_info = { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .pNext = &image_wsi_info, .flags = 0, @@ -552,6 +552,10 @@ wsi_create_prime_image(const struct wsi_swapchain *chain, .pQueueFamilyIndices = pCreateInfo->pQueueFamilyIndices, .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED, }; + if (pCreateInfo->flags & VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR) { + image_info.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | + VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR; + } result = wsi->CreateImage(chain->device, &image_info, &chain->alloc, &image->image); if (result != VK_SUCCESS)