Merge 'Tag fences created by the layer' into 'main'

See merge request mesa/vulkan-wsi-layer!161
This commit is contained in:
Iason Paraskevopoulos 2025-06-04 11:18:37 +00:00
commit 5e91113efd
3 changed files with 49 additions and 0 deletions

View file

@ -263,6 +263,20 @@ static constexpr uint32_t API_VERSION_MAX = UINT32_MAX;
/* this extension. These are listed here in order to hide them from the application. */ \
EP(GetPhysicalDeviceExternalBufferPropertiesKHR, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, \
VK_API_VERSION_1_1, false, GetPhysicalDeviceExternalBufferProperties) \
/* VK_EXT_debug_utils */ \
/* The layer is only using vkSetDebugUtilsObjectNameEXT but we need to list all the commands in order to hide */ \
/* from the application. */ \
EP(CmdBeginDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(CmdEndDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(CmdInsertDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(CreateDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(DestroyDebugUtilsMessengerEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(QueueBeginDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(QueueEndDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(QueueInsertDebugUtilsLabelEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(SetDebugUtilsObjectNameEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(SetDebugUtilsObjectTagEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
EP(SubmitDebugUtilsMessageEXT, VK_EXT_DEBUG_UTILS_EXTENSION_NAME, API_VERSION_MAX, false, ) \
/* VK_KHR_calibrated_timestamps */ \
EP(GetPhysicalDeviceCalibrateableTimeDomainsKHR, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME, API_VERSION_MAX, \
false, )

View file

@ -54,6 +54,22 @@ std::optional<fence_sync> fence_sync::create(layer::device_private_data &device)
{
return std::nullopt;
}
if (ENABLE_INSTRUMENTATION &&
device.instance_data.disp.get_fn<PFN_vkSetDebugUtilsObjectNameEXT>("vkSetDebugUtilsObjectNameEXT").has_value())
{
VkDebugUtilsObjectNameInfoEXT nameInfo = { .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.pNext = NULL,
.objectType = VK_OBJECT_TYPE_FENCE,
.objectHandle = reinterpret_cast<uint64_t>(fence),
.pObjectName = "WsiLayerFence" };
res = device.instance_data.disp.SetDebugUtilsObjectNameEXT(device.device, &nameInfo);
if (res != VK_SUCCESS)
{
WSI_LOG_WARNING("Couldn't set fence name");
}
}
return fence_sync(device, fence);
}
@ -149,6 +165,20 @@ std::optional<sync_fd_fence_sync> sync_fd_fence_sync::create(layer::device_priva
{
return std::nullopt;
}
if (ENABLE_INSTRUMENTATION &&
device.instance_data.disp.get_fn<PFN_vkSetDebugUtilsObjectNameEXT>("vkSetDebugUtilsObjectNameEXT").has_value())
{
VkDebugUtilsObjectNameInfoEXT nameInfo = { .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
.pNext = NULL,
.objectType = VK_OBJECT_TYPE_FENCE,
.objectHandle = reinterpret_cast<uint64_t>(fence),
.pObjectName = "WsiLayerFence" };
res = device.instance_data.disp.SetDebugUtilsObjectNameEXT(device.device, &nameInfo);
if (res != VK_SUCCESS)
{
WSI_LOG_WARNING("Couldn't set fence name");
}
}
return sync_fd_fence_sync{ device, fence };
}

View file

@ -247,6 +247,11 @@ VkResult add_instance_extensions_required_by_layer(const util::wsi_platform_set
TRY_LOG_CALL(extensions_to_enable.add(extensions_required_by_layer));
}
if (ENABLE_INSTRUMENTATION)
{
TRY_LOG_CALL(extensions_to_enable.add(VK_EXT_DEBUG_UTILS_EXTENSION_NAME));
}
return VK_SUCCESS;
}