Tag fences created by the layer

Tags the fences created by the layer with the WsiLayerFence name
when instrumentation has been enabled.

Change-Id: I90ad71e5073d80cd650c6ba3be406abd67185376
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
This commit is contained in:
Iason Paraskevopoulos 2025-06-04 11:18:37 +00:00
parent 20f64a2e48
commit eda337c308
3 changed files with 50 additions and 1 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. */ \ /* this extension. These are listed here in order to hide them from the application. */ \
EP(GetPhysicalDeviceExternalBufferPropertiesKHR, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, \ EP(GetPhysicalDeviceExternalBufferPropertiesKHR, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, \
VK_API_VERSION_1_1, false, GetPhysicalDeviceExternalBufferProperties) \ 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 */ \ /* VK_KHR_calibrated_timestamps */ \
EP(GetPhysicalDeviceCalibrateableTimeDomainsKHR, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME, API_VERSION_MAX, \ EP(GetPhysicalDeviceCalibrateableTimeDomainsKHR, VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME, API_VERSION_MAX, \
false, ) false, )

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021-2024 Arm Limited. * Copyright (c) 2021-2025 Arm Limited.
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@ -54,6 +54,22 @@ std::optional<fence_sync> fence_sync::create(layer::device_private_data &device)
{ {
return std::nullopt; 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); 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; 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 }; 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)); 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; return VK_SUCCESS;
} }