diff --git a/layer/private_data.hpp b/layer/private_data.hpp index d342fb6..416e18f 100644 --- a/layer/private_data.hpp +++ b/layer/private_data.hpp @@ -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, ) diff --git a/wsi/synchronization.cpp b/wsi/synchronization.cpp index b4b5d25..540eb94 100644 --- a/wsi/synchronization.cpp +++ b/wsi/synchronization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2024 Arm Limited. + * Copyright (c) 2021-2025 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -54,6 +54,22 @@ std::optional fence_sync::create(layer::device_private_data &device) { return std::nullopt; } + + if (ENABLE_INSTRUMENTATION && + device.instance_data.disp.get_fn("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(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::create(layer::device_priva { return std::nullopt; } + if (ENABLE_INSTRUMENTATION && + device.instance_data.disp.get_fn("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(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 }; } diff --git a/wsi/wsi_factory.cpp b/wsi/wsi_factory.cpp index 8fdc93b..c0aec77 100644 --- a/wsi/wsi_factory.cpp +++ b/wsi/wsi_factory.cpp @@ -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; }