From: Simon Ser Date: Fri, 3 Jul 2020 13:16:00 +0000 (+0200) Subject: radv: add img debug flag X-Git-Tag: upstream/21.0.0~2639 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1cf1ece738c5e533ea95a5c9b34441124de1e560;p=platform%2Fupstream%2Fmesa.git radv: add img debug flag This is similar to AMD_DEBUG=tex, but for radv. Signed-off-by: Simon Ser Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Samuel Pitoiset Part-of: --- diff --git a/docs/envvars.rst b/docs/envvars.rst index ed9d640..363f0aa 100644 --- a/docs/envvars.rst +++ b/docs/envvars.rst @@ -557,6 +557,8 @@ RADV driver environment variables ``hang`` enable GPU hangs detection and dump a report to $HOME/radv_dumps_ if a GPU hang is detected + ``img`` + Print image info ``info`` show GPU-related information ``metashaders`` diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 0985be3..4f049f7 100644 --- a/src/amd/vulkan/radv_debug.h +++ b/src/amd/vulkan/radv_debug.h @@ -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 { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 4801cbb..8643367 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -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} }; diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index ab70e1b..99ead12 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -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;