Module: Mesa
Branch: main
Commit: 379f2b641e486531d24a7d90ea4deb79af489502
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=379f2b641e486531d24a7d90ea4deb79af489502

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Fri Aug  5 11:44:21 2022 +0200

radeonsi: print radeon_bo_flag when AMD_DEBUG=vm is used

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11449>

---

 src/gallium/drivers/radeonsi/si_buffer.c   |  4 +++-
 src/gallium/drivers/radeonsi/si_texture.c  |  4 +++-
 src/gallium/include/winsys/radeon_winsys.h | 28 ++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_buffer.c 
b/src/gallium/drivers/radeonsi/si_buffer.c
index fb93eff6f82..11c2cafbbac 100644
--- a/src/gallium/drivers/radeonsi/si_buffer.c
+++ b/src/gallium/drivers/radeonsi/si_buffer.c
@@ -201,8 +201,10 @@ bool si_alloc_resource(struct si_screen *sscreen, struct 
si_resource *res)
 
    /* Print debug information. */
    if (sscreen->debug_flags & DBG(VM) && res->b.b.target == PIPE_BUFFER) {
-      fprintf(stderr, "VM start=0x%" PRIX64 "  end=0x%" PRIX64 " | Buffer %" 
PRIu64 " bytes\n",
+      fprintf(stderr, "VM start=0x%" PRIX64 "  end=0x%" PRIX64 " | Buffer %" 
PRIu64 " bytes | Flags: ",
               res->gpu_address, res->gpu_address + res->buf->size, 
res->buf->size);
+      si_res_print_flags(res->flags);
+      fprintf(stderr, "\n");
    }
 
    if (res->b.b.flags & SI_RESOURCE_FLAG_CLEAR)
diff --git a/src/gallium/drivers/radeonsi/si_texture.c 
b/src/gallium/drivers/radeonsi/si_texture.c
index e756fb559ab..a14c9f735bc 100644
--- a/src/gallium/drivers/radeonsi/si_texture.c
+++ b/src/gallium/drivers/radeonsi/si_texture.c
@@ -1149,10 +1149,12 @@ static struct si_texture 
*si_texture_create_object(struct pipe_screen *screen,
    if (sscreen->debug_flags & DBG(VM)) {
       fprintf(stderr,
               "VM start=0x%" PRIX64 "  end=0x%" PRIX64
-              " | Texture %ix%ix%i, %i levels, %i samples, %s\n",
+              " | Texture %ix%ix%i, %i levels, %i samples, %s | Flags: ",
               tex->buffer.gpu_address, tex->buffer.gpu_address + 
tex->buffer.buf->size,
               base->width0, base->height0, util_num_layers(base, 0), 
base->last_level + 1,
               base->nr_samples ? base->nr_samples : 1, 
util_format_short_name(base->format));
+      si_res_print_flags(tex->buffer.flags);
+      fprintf(stderr, "\n");
    }
 
    if (sscreen->debug_flags & DBG(TEX)) {
diff --git a/src/gallium/include/winsys/radeon_winsys.h 
b/src/gallium/include/winsys/radeon_winsys.h
index 04ea5963d84..32aa288bc5e 100644
--- a/src/gallium/include/winsys/radeon_winsys.h
+++ b/src/gallium/include/winsys/radeon_winsys.h
@@ -83,6 +83,34 @@ enum radeon_bo_flag
   RADEON_FLAG_MALL_NOALLOC = (1 << 11), /* don't cache in the infinity cache */
 };
 
+static inline void
+si_res_print_flags(enum radeon_bo_flag flags) {
+   if (flags & RADEON_FLAG_GTT_WC)
+      fprintf(stderr, "GTT_WC ");
+   if (flags & RADEON_FLAG_NO_CPU_ACCESS)
+      fprintf(stderr, "NO_CPU_ACCESS ");
+   if (flags & RADEON_FLAG_NO_SUBALLOC)
+      fprintf(stderr, "NO_SUBALLOC ");
+   if (flags & RADEON_FLAG_SPARSE)
+      fprintf(stderr, "SPARSE ");
+   if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING)
+      fprintf(stderr, "NO_INTERPROCESS_SHARING ");
+   if (flags & RADEON_FLAG_READ_ONLY)
+      fprintf(stderr, "READ_ONLY ");
+   if (flags & RADEON_FLAG_32BIT)
+      fprintf(stderr, "32BIT ");
+   if (flags & RADEON_FLAG_ENCRYPTED)
+      fprintf(stderr, "ENCRYPTED ");
+   if (flags & RADEON_FLAG_GL2_BYPASS)
+      fprintf(stderr, "GL2_BYPASS ");
+   if (flags & RADEON_FLAG_DRIVER_INTERNAL)
+      fprintf(stderr, "DRIVER_INTERNAL ");
+   if (flags & RADEON_FLAG_DISCARDABLE)
+      fprintf(stderr, "DISCARDABLE ");
+   if (flags & RADEON_FLAG_MALL_NOALLOC)
+      fprintf(stderr, "MALL_NOALLOC ");
+}
+
 enum radeon_map_flags
 {
    /* Indicates that the caller will unmap the buffer.

Reply via email to