From e29677b16d979776278681adf86cf3e378e9354d Mon Sep 17 00:00:00 2001 From: Zan Dobersek Date: Thu, 7 Mar 2024 16:10:00 +0100 Subject: [PATCH] vulkan/rmv: enable logging miscellaneous internal resources Add the vk_rmv_misc_internal_description struct and list the misc_internal member of that type in the vk_rmv_resource_create_token union, allowing logging of different internal resources in RMV dumps. The vk_rmv_common.h header also has the C-linkage block added in order to enable its inclusion in C++ files. Signed-off-by: Zan Dobersek Part-of: --- src/vulkan/runtime/rmv/vk_rmv_common.h | 8 ++++++++ src/vulkan/runtime/rmv/vk_rmv_exporter.c | 11 +++++++++++ src/vulkan/runtime/rmv/vk_rmv_tokens.h | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/src/vulkan/runtime/rmv/vk_rmv_common.h b/src/vulkan/runtime/rmv/vk_rmv_common.h index e6ee8bb5beb..d4f0fb62f54 100644 --- a/src/vulkan/runtime/rmv/vk_rmv_common.h +++ b/src/vulkan/runtime/rmv/vk_rmv_common.h @@ -32,6 +32,10 @@ #include #include "vk_rmv_tokens.h" +#ifdef __cplusplus +extern "C" { +#endif + struct vk_memory_trace_data; /* @@ -137,4 +141,8 @@ uint32_t vk_rmv_get_resource_id_locked(struct vk_device *device, uint64_t handle * The memory trace mutex should be locked when entering this function. */ void vk_rmv_destroy_resource_id_locked(struct vk_device *device, uint64_t handle); +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/vulkan/runtime/rmv/vk_rmv_exporter.c b/src/vulkan/runtime/rmv/vk_rmv_exporter.c index 639becc855b..ebf13941011 100644 --- a/src/vulkan/runtime/rmv/vk_rmv_exporter.c +++ b/src/vulkan/runtime/rmv/vk_rmv_exporter.c @@ -1394,6 +1394,14 @@ rmt_dump_command_buffer_resource(struct vk_rmv_command_buffer_description *descr fwrite(data, 44, 1, output); } +static void +rmt_dump_misc_internal_resource(struct vk_rmv_misc_internal_description *description, + FILE *output) +{ + /* 8 bits of zero-value enum are the only thing in the payload */ + fwrite(&description->type, 1, 1, output); +} + static void rmt_dump_resource_create(struct vk_rmv_resource_create_token *token, FILE *output) { @@ -1434,6 +1442,9 @@ rmt_dump_resource_create(struct vk_rmv_resource_create_token *token, FILE *outpu case VK_RMV_RESOURCE_TYPE_COMMAND_ALLOCATOR: rmt_dump_command_buffer_resource(&token->command_buffer, output); break; + case VK_RMV_RESOURCE_TYPE_MISC_INTERNAL: + rmt_dump_misc_internal_resource(&token->misc_internal, output); + break; default: unreachable("invalid resource type"); } diff --git a/src/vulkan/runtime/rmv/vk_rmv_tokens.h b/src/vulkan/runtime/rmv/vk_rmv_tokens.h index d1034bdf7e1..e16998b1184 100644 --- a/src/vulkan/runtime/rmv/vk_rmv_tokens.h +++ b/src/vulkan/runtime/rmv/vk_rmv_tokens.h @@ -224,6 +224,14 @@ struct vk_rmv_command_buffer_description { uint64_t app_available_scratch_size; }; +enum vk_rmv_misc_internal_type { + VK_RMV_MISC_INTERNAL_TYPE_PADDING, +}; + +struct vk_rmv_misc_internal_description { + enum vk_rmv_misc_internal_type type; +}; + struct vk_rmv_resource_create_token { uint32_t resource_id; bool is_driver_internal; @@ -238,6 +246,7 @@ struct vk_rmv_resource_create_token { struct vk_rmv_pipeline_description pipeline; struct vk_rmv_descriptor_pool_description descriptor_pool; struct vk_rmv_command_buffer_description command_buffer; + struct vk_rmv_misc_internal_description misc_internal; }; };