From 188bd800c20922ca06eb71eead357d2f16bbcab6 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Tue, 4 Apr 2023 14:36:35 -0700 Subject: [PATCH] wsi: Label the WSI blit command buffer with a name. Given that the command buffer will be long-lived, no reason not to just do this so that debugging tools can see what the cmdbuf is doing. Reviewed-by: Lionel Landwerlin Part-of: --- src/vulkan/wsi/wsi_common.c | 17 +++++++++++++++++ src/vulkan/wsi/wsi_common.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 05a247181cf..0cd119dd2d9 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -205,6 +205,7 @@ wsi_device_init(struct wsi_device *wsi, WSI_GET_CB(GetSemaphoreFdKHR); WSI_GET_CB(ResetFences); WSI_GET_CB(QueueSubmit); + WSI_GET_CB(SetDebugUtilsObjectNameEXT); WSI_GET_CB(WaitForFences); WSI_GET_CB(MapMemory); WSI_GET_CB(UnmapMemory); @@ -1905,6 +1906,20 @@ wsi_create_buffer_blit_context(const struct wsi_swapchain *chain, return VK_SUCCESS; } +static void +wsi_label_cmd_buffer(const struct wsi_device *wsi, VkDevice device, VkCommandBuffer cmd_buffer, const char *name) +{ + VkDebugUtilsObjectNameInfoEXT name_info = { + .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, + .pNext = NULL, + .objectType = VK_OBJECT_TYPE_COMMAND_BUFFER, + .objectHandle = (uintptr_t)cmd_buffer, + .pObjectName = name, + }; + + wsi->SetDebugUtilsObjectNameEXT(device, &name_info); +} + VkResult wsi_finish_create_blit_context(const struct wsi_swapchain *chain, const struct wsi_image_info *info, @@ -1938,6 +1953,8 @@ wsi_finish_create_blit_context(const struct wsi_swapchain *chain, if (result != VK_SUCCESS) return result; + wsi_label_cmd_buffer(wsi, chain->device, image->blit.cmd_buffers[i], "wsi blit"); + const VkCommandBufferBeginInfo begin_info = { .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, }; diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index 08c1438cb1f..5488c904e6c 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -273,6 +273,7 @@ struct wsi_device { WSI_CB(GetSemaphoreFdKHR); WSI_CB(ResetFences); WSI_CB(QueueSubmit); + WSI_CB(SetDebugUtilsObjectNameEXT); WSI_CB(WaitForFences); WSI_CB(MapMemory); WSI_CB(UnmapMemory);