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 <matt.coster@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23028>
This commit is contained in:
Matt Coster 2023-05-12 15:18:10 +01:00 committed by Marge Bot
parent c5195a67b8
commit b793afc0ce
3 changed files with 8 additions and 12 deletions

View file

@ -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 */

View file

@ -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);

View file

@ -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);