radeonsi: print radeon_bo_flag when AMD_DEBUG=vm is used
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 5 Aug 2022 09:44:21 +0000 (11:44 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 9 Aug 2022 14:38:06 +0000 (14:38 +0000)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11449>

src/gallium/drivers/radeonsi/si_buffer.c
src/gallium/drivers/radeonsi/si_texture.c
src/gallium/include/winsys/radeon_winsys.h

index fb93eff..11c2caf 100644 (file)
@@ -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)
index e756fb5..a14c9f7 100644 (file)
@@ -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)) {
index 04ea596..32aa288 100644 (file)
@@ -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.