Mesa (master): i965: Print access flags in INTEL_DEBUG=buf output.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Jul 1 18:48:50 UTC 2017


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Jun 30 21:16:00 2017 -0700

i965: Print access flags in INTEL_DEBUG=buf output.

Being able to see the access mode of various mappings is incredibly
useful for debugging.  With this patch, INTEL_DEBUG=buf now shows
data such as:

   bo_create: buf 7 (bufferobj) 640b
   bo_map_gtt: 7 (bufferobj) -> 0x7fca1fae5000, WRITE ASYNC
   brw_bo_map_cpu: 7 (bufferobj) -> 0x7fca1fae4000, READ
   bo_map_gtt: 5 (bufferobj) -> 0x7fca1fad4000, WRITE ASYNC
   brw_bo_map_cpu: 7 (bufferobj) -> 0x7fca1fae4000, READ

which makes it easy to see that there are async GTT writes with
intervening CPU reads.

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_bufmgr.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index f49b886622..da12a13152 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -645,6 +645,24 @@ set_domain(struct brw_context *brw, const char *action,
    }
 }
 
+static void
+print_flags(unsigned flags)
+{
+   if (flags & MAP_READ)
+      DBG("READ ");
+   if (flags & MAP_WRITE)
+      DBG("WRITE ");
+   if (flags & MAP_ASYNC)
+      DBG("ASYNC ");
+   if (flags & MAP_PERSISTENT)
+      DBG("PERSISTENT ");
+   if (flags & MAP_COHERENT)
+      DBG("COHERENT ");
+   if (flags & MAP_RAW)
+      DBG("RAW ");
+   DBG("\n");
+}
+
 static void *
 brw_bo_map_cpu(struct brw_context *brw, struct brw_bo *bo, unsigned flags)
 {
@@ -674,8 +692,9 @@ brw_bo_map_cpu(struct brw_context *brw, struct brw_bo *bo, unsigned flags)
          drm_munmap(map, bo->size);
       }
    }
-   DBG("brw_bo_map_cpu: %d (%s) -> %p\n", bo->gem_handle, bo->name,
+   DBG("brw_bo_map_cpu: %d (%s) -> %p, ", bo->gem_handle, bo->name,
        bo->map_cpu);
+   print_flags(flags);
 
    if (!(flags & MAP_ASYNC) || !bufmgr->has_llc) {
       set_domain(brw, "CPU mapping", bo, I915_GEM_DOMAIN_CPU,
@@ -725,8 +744,8 @@ brw_bo_map_gtt(struct brw_context *brw, struct brw_bo *bo, unsigned flags)
       }
    }
 
-   DBG("bo_map_gtt: %d (%s) -> %p\n", bo->gem_handle, bo->name,
-       bo->map_gtt);
+   DBG("bo_map_gtt: %d (%s) -> %p, ", bo->gem_handle, bo->name, bo->map_gtt);
+   print_flags(flags);
 
    if (!(flags & MAP_ASYNC) || !bufmgr->has_llc) {
       set_domain(brw, "GTT mapping", bo,




More information about the mesa-commit mailing list