radv: add img debug flag

This is similar to AMD_DEBUG=tex, but for radv.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5734>
This commit is contained in:
Simon Ser 2020-07-03 15:16:00 +02:00
parent dc93fd759a
commit 1cf1ece738
4 changed files with 33 additions and 0 deletions

View File

@ -557,6 +557,8 @@ RADV driver environment variables
``hang``
enable GPU hangs detection and dump a report to $HOME/radv_dumps_<pid>
if a GPU hang is detected
``img``
Print image info
``info``
show GPU-related information
``metashaders``

View File

@ -58,6 +58,7 @@ enum {
RADV_DEBUG_LLVM = 1 << 27,
RADV_DEBUG_FORCE_COMPRESS = 1 << 28,
RADV_DEBUG_HANG = 1 << 29,
RADV_DEBUG_IMG = 1 << 30,
};
enum {

View File

@ -552,6 +552,7 @@ static const struct debug_control radv_debug_options[] = {
{"llvm", RADV_DEBUG_LLVM},
{"forcecompress", RADV_DEBUG_FORCE_COMPRESS},
{"hang", RADV_DEBUG_HANG},
{"img", RADV_DEBUG_IMG},
{NULL, 0}
};

View File

@ -1409,6 +1409,31 @@ radv_destroy_image(struct radv_device *device,
vk_free2(&device->vk.alloc, pAllocator, image);
}
static void
radv_image_print_info(struct radv_device *device, struct radv_image *image)
{
fprintf(stderr, "Image:\n");
fprintf(stderr, " Info: size=%" PRIu64 ", alignment=%" PRIu32 ", "
"width=%" PRIu32 ", height=%" PRIu32 ", "
"offset=%" PRIu64 "\n",
image->size, image->alignment, image->info.width,
image->info.height, image->offset);
for (unsigned i = 0; i < image->plane_count; ++i) {
const struct radv_image_plane *plane = &image->planes[i];
const struct radeon_surf *surf = &plane->surface;
const struct vk_format_description *desc =
vk_format_description(plane->format);
fprintf(stderr,
" Plane[%u]: vkformat=%s, offset=%" PRIu64 "\n",
i, desc->name, plane->offset);
ac_surface_print_info(stderr,
&device->physical_device->rad_info,
surf);
}
}
VkResult
radv_image_create(VkDevice _device,
const struct radv_image_create_info *create_info,
@ -1505,6 +1530,10 @@ radv_image_create(VkDevice _device,
}
}
if (device->instance->debug_flags & RADV_DEBUG_IMG) {
radv_image_print_info(device, image);
}
*pImage = radv_image_to_handle(image);
return VK_SUCCESS;