Mesa (main): vulkan/wsi: fix crash with debug names on swapchain
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 21 17:27:39 UTC 2022
Module: Mesa
Branch: main
Commit: efc398c722ae47afd01ed1abd83abb208bba9692
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=efc398c722ae47afd01ed1abd83abb208bba9692
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Mon Jun 20 13:00:38 2022 +0000
vulkan/wsi: fix crash with debug names on swapchain
If you set a name of on a swapchain object, because the base object
struct has not been initialized with a VkDevice,
vk_object_base_finish() will segfault when trying to free the object
name.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: cb1e0db23e3f ("vulkan/wsi: Make wsi_swapchain inherit from vk_object_base")
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17165>
---
src/vulkan/wsi/wsi_common.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 7094171db7d..bfa607c26a7 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -247,24 +247,25 @@ wsi_device_setup_syncobj_fd(struct wsi_device *wsi_device,
VkResult
wsi_swapchain_init(const struct wsi_device *wsi,
struct wsi_swapchain *chain,
- VkDevice device,
+ VkDevice _device,
const VkSwapchainCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
bool use_buffer_blit)
{
+ VK_FROM_HANDLE(vk_device, device, _device);
VkResult result;
memset(chain, 0, sizeof(*chain));
- vk_object_base_init(NULL, &chain->base, VK_OBJECT_TYPE_SWAPCHAIN_KHR);
+ vk_object_base_init(device, &chain->base, VK_OBJECT_TYPE_SWAPCHAIN_KHR);
chain->wsi = wsi;
- chain->device = device;
+ chain->device = _device;
chain->alloc = *pAllocator;
chain->use_buffer_blit = use_buffer_blit;
chain->buffer_blit_queue = VK_NULL_HANDLE;
if (use_buffer_blit && wsi->get_buffer_blit_queue)
- chain->buffer_blit_queue = wsi->get_buffer_blit_queue(device);
+ chain->buffer_blit_queue = wsi->get_buffer_blit_queue(_device);
int cmd_pools_count = chain->buffer_blit_queue != VK_NULL_HANDLE ? 1 : wsi->queue_family_count;
@@ -287,7 +288,7 @@ wsi_swapchain_init(const struct wsi_device *wsi,
.flags = 0,
.queueFamilyIndex = queue_family_index,
};
- result = wsi->CreateCommandPool(device, &cmd_pool_info, &chain->alloc,
+ result = wsi->CreateCommandPool(_device, &cmd_pool_info, &chain->alloc,
&chain->cmd_pools[i]);
if (result != VK_SUCCESS)
goto fail;
More information about the mesa-commit
mailing list