Mesa (master): radv: add img debug flag

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 13 11:19:03 UTC 2020


Module: Mesa
Branch: master
Commit: 1cf1ece738c5e533ea95a5c9b34441124de1e560
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cf1ece738c5e533ea95a5c9b34441124de1e560

Author: Simon Ser <contact at emersion.fr>
Date:   Fri Jul  3 15:16:00 2020 +0200

radv: add img debug flag

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

Signed-off-by: Simon Ser <contact at emersion.fr>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5734>

---

 docs/envvars.rst             |  2 ++
 src/amd/vulkan/radv_debug.h  |  1 +
 src/amd/vulkan/radv_device.c |  1 +
 src/amd/vulkan/radv_image.c  | 29 +++++++++++++++++++++++++++++
 4 files changed, 33 insertions(+)

diff --git a/docs/envvars.rst b/docs/envvars.rst
index ed9d6402161..363f0aa0d83 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_<pid>
       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 0985be36940..4f049f7dc2f 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 4801cbb6607..8643367b953 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 ab70e1b5b5d..99ead128580 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;



More information about the mesa-commit mailing list