From b793afc0ce2f3e5cc77c06a830a183b54259fe98 Mon Sep 17 00:00:00 2001 From: Matt Coster Date: Fri, 12 May 2023 15:18:10 +0100 Subject: [PATCH] pvr: Add PVR_DEBUG=vk_desc option to dump descriptor set layouts Prints on every call to vkCreate{DescriptorSet,Pipeline}Layout(). Previously, this could not be turned on or off at runtime, and was dependent on DEBUG. Signed-off-by: Matt Coster Reviewed-by: Frank Binns Part-of: --- src/imagination/common/pvr_debug.c | 2 ++ src/imagination/common/pvr_debug.h | 1 + src/imagination/vulkan/pvr_descriptor_set.c | 17 +++++------------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/imagination/common/pvr_debug.c b/src/imagination/common/pvr_debug.c index 829e8f5..5970979 100644 --- a/src/imagination/common/pvr_debug.c +++ b/src/imagination/common/pvr_debug.c @@ -36,6 +36,8 @@ static const struct debug_named_value debug_control[] = { "Track all buffer objects with at least one reference." }, { "bo_zero", PVR_DEBUG_ZERO_BOS, "Zero all buffer objects at allocation to make them deterministic." }, + { "vk_desc", PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT, + "Dump descriptor set and pipeline layouts." }, DEBUG_NAMED_VALUE_END }; /* clang-format on */ diff --git a/src/imagination/common/pvr_debug.h b/src/imagination/common/pvr_debug.h index c2378cc..f0254cc 100644 --- a/src/imagination/common/pvr_debug.h +++ b/src/imagination/common/pvr_debug.h @@ -37,6 +37,7 @@ extern uint32_t PVR_DEBUG; #define PVR_DEBUG_DUMP_CONTROL_STREAM BITFIELD_BIT(0) #define PVR_DEBUG_TRACK_BOS BITFIELD_BIT(1) #define PVR_DEBUG_ZERO_BOS BITFIELD_BIT(2) +#define PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT BITFIELD_BIT(3) void pvr_process_debug_variable(void); diff --git a/src/imagination/vulkan/pvr_descriptor_set.c b/src/imagination/vulkan/pvr_descriptor_set.c index fede093..c65bd04 100644 --- a/src/imagination/vulkan/pvr_descriptor_set.c +++ b/src/imagination/vulkan/pvr_descriptor_set.c @@ -30,6 +30,7 @@ #include "hwdef/rogue_hw_utils.h" #include "pvr_bo.h" +#include "pvr_debug.h" #include "pvr_private.h" #include "pvr_types.h" #include "util/compiler.h" @@ -42,7 +43,6 @@ #include "vk_object.h" #include "vk_util.h" -#if defined(DEBUG) static const struct { const char *raw; const char *primary; @@ -78,7 +78,6 @@ static const char *descriptor_names[] = { "VK SAMPLER", "VK UNIFORM_BUFFER_DYNAMIC", "VK STORAGE_BUFFER_DYNAMIC", "VK INPUT_ATTACHMENT" }; -#endif #define PVR_DESC_IMAGE_SECONDARY_OFFSET_ARRAYBASE 0U #define PVR_DESC_IMAGE_SECONDARY_SIZE_ARRAYBASE 2U @@ -332,7 +331,6 @@ static void pvr_setup_in_memory_layout_sizes( } } -#if defined(DEBUG) static void pvr_dump_in_memory_layout_sizes(const struct pvr_descriptor_set_layout *layout) { @@ -424,7 +422,6 @@ pvr_dump_in_memory_layout_sizes(const struct pvr_descriptor_set_layout *layout) mesa_logd("=============================================="); } } -#endif VkResult pvr_CreateDescriptorSetLayout( VkDevice _device, @@ -654,9 +651,8 @@ VkResult pvr_CreateDescriptorSetLayout( pvr_setup_in_memory_layout_sizes(layout, reg_usage); -#if defined(DEBUG) - pvr_dump_in_memory_layout_sizes(layout); -#endif + if (PVR_IS_DEBUG_SET(VK_DUMP_DESCRIPTOR_SET_LAYOUT)) + pvr_dump_in_memory_layout_sizes(layout); vk_free2(&device->vk.alloc, pAllocator, bindings); @@ -678,7 +674,6 @@ void pvr_DestroyDescriptorSetLayout(VkDevice _device, pvr_descriptor_set_layout_free(device, pAllocator, layout); } -#if defined(DEBUG) static void pvr_dump_in_register_layout_sizes(const struct pvr_device *device, const struct pvr_pipeline_layout *layout) @@ -853,7 +848,6 @@ pvr_dump_in_register_layout_sizes(const struct pvr_device *device, # undef LOGD_CHAR_NTIMES # undef SEPARATOR_LENGTH } -#endif /* Pipeline layouts. These have nothing to do with the pipeline. They are * just multiple descriptor set layouts pasted together. @@ -1015,9 +1009,8 @@ VkResult pvr_CreatePipelineLayout(VkDevice _device, layout->compute_push_constants_offset = range->offset; } -#if defined(DEBUG) - pvr_dump_in_register_layout_sizes(device, layout); -#endif + if (PVR_IS_DEBUG_SET(VK_DUMP_DESCRIPTOR_SET_LAYOUT)) + pvr_dump_in_register_layout_sizes(device, layout); *pPipelineLayout = pvr_pipeline_layout_to_handle(layout); -- 2.7.4