anv/ds: Forward VkDebugUtilsObjectNameInfoEXT to perfetto.

This gets us names on zink/wsi command buffers in perfetto, but may also
be useful some day for getting app names onto framebuffers and non-dynamic
renderpasses.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22350>
This commit is contained in:
Emma Anholt 2023-04-24 12:12:32 -07:00 committed by Marge Bot
parent b47a6a5418
commit 4cc66123ec
4 changed files with 65 additions and 0 deletions

View file

@ -566,6 +566,28 @@ intel_ds_end_submit(struct intel_ds_queue *queue,
});
}
void intel_ds_perfetto_set_debug_utils_object_name(struct intel_ds_device *device,
const VkDebugUtilsObjectNameInfoEXT *pNameInfo)
{
IntelRenderpassDataSource::Trace([=](auto tctx) {
/* Do we need this for SEQ_INCREMENTAL_STATE_CLEARED for the object name to stick? */
setup_incremental_state(tctx, device);
tctx.GetDataSourceLocked()->SetDebugUtilsObjectNameEXT(tctx, pNameInfo);
});
}
void intel_ds_perfetto_refresh_debug_utils_object_name(struct intel_ds_device *device,
const struct vk_object_base *object)
{
IntelRenderpassDataSource::Trace([=](auto tctx) {
/* Do we need this for SEQ_INCREMENTAL_STATE_CLEARED for the object name to stick? */
setup_incremental_state(tctx, device);
tctx.GetDataSourceLocked()->RefreshSetDebugUtilsObjectNameEXT(tctx, object);
});
}
#endif /* HAVE_PERFETTO */
static void

View file

@ -36,6 +36,9 @@
extern "C" {
#endif
struct vk_object_base;
struct VkDebugUtilsObjectNameInfoEXT;
enum intel_ds_api {
INTEL_DS_API_OPENGL,
INTEL_DS_API_VULKAN,
@ -223,6 +226,12 @@ uint64_t intel_ds_begin_submit(struct intel_ds_queue *queue);
void intel_ds_end_submit(struct intel_ds_queue *queue,
uint64_t start_ts);
void intel_ds_perfetto_set_debug_utils_object_name(struct intel_ds_device *device,
const struct VkDebugUtilsObjectNameInfoEXT *pNameInfo);
void intel_ds_perfetto_refresh_debug_utils_object_name(struct intel_ds_device *device,
const struct vk_object_base *object);
#else
static inline uint64_t intel_ds_begin_submit(struct intel_ds_queue *queue)
@ -235,6 +244,16 @@ static inline void intel_ds_end_submit(struct intel_ds_queue *queue,
{
}
static inline void intel_ds_perfetto_set_debug_utils_object_name(struct intel_ds_device *device,
const struct VkDebugUtilsObjectNameInfoEXT *pNameInfo)
{
}
static inline void intel_ds_perfetto_refresh_debug_utils_object_name(struct intel_ds_device *device,
const struct vk_object_base *object)
{
}
#endif /* HAVE_PERFETTO */
#ifdef __cplusplus

View file

@ -1612,6 +1612,16 @@ anv_queue_submit(struct vk_queue *vk_queue,
anv_queue_free_initial_submission(queue);
if (u_trace_should_process(&device->ds.trace_context)) {
/* Refresh perfetto's knowledge of any easily accessible, long-lived
* object names referenced by this submit -- this helps provide better
* information in traces when tracing starts after application launch.
*/
for (int i = 0; i < submit->command_buffer_count; i++)
intel_ds_perfetto_refresh_debug_utils_object_name(&device->ds,
&submit->command_buffers[i]->base);
}
if (queue->device->info->no_hw) {
for (uint32_t i = 0; i < submit->signal_count; i++) {
result = vk_sync_signal(&device->vk,

View file

@ -588,6 +588,20 @@ void anv_CmdEndDebugUtilsLabelEXT(VkCommandBuffer _commandBuffer)
vk_common_CmdEndDebugUtilsLabelEXT(_commandBuffer);
}
VKAPI_ATTR VkResult VKAPI_CALL
anv_SetDebugUtilsObjectNameEXT(
VkDevice _device,
const VkDebugUtilsObjectNameInfoEXT *pNameInfo)
{
VK_FROM_HANDLE(anv_device, device, _device);
VkResult result = vk_common_SetDebugUtilsObjectNameEXT(_device, pNameInfo);
if (result == VK_SUCCESS)
intel_ds_perfetto_set_debug_utils_object_name(&device->ds, pNameInfo);
return result;
}
void
anv_queue_trace(struct anv_queue *queue, const char *label, bool frame, bool begin)
{