iris: Print the memzone name when allocating BOs with INTEL_DEBUG=buf
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 23 Mar 2019 16:32:38 +0000 (09:32 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 29 Mar 2019 06:37:32 +0000 (23:37 -0700)
This gives me an idea of what kinds of buffers are being allocated on
the fly which could help inform our cache decisions.

src/gallium/drivers/iris/iris_bufmgr.c

index e0d167913d2147c2322f534fc2767d1654f7c95a..56261d4a947a3cc093bf407da3380d53fde9f76e 100644 (file)
@@ -117,6 +117,21 @@ atomic_add_unless(int *v, int add, int unless)
    return c == unless;
 }
 
+static const char *
+memzone_name(enum iris_memory_zone memzone)
+{
+   const char *names[] = {
+      [IRIS_MEMZONE_SHADER]  = "shader",
+      [IRIS_MEMZONE_BINDER]  = "binder",
+      [IRIS_MEMZONE_SURFACE] = "surface",
+      [IRIS_MEMZONE_DYNAMIC] = "dynamic",
+      [IRIS_MEMZONE_OTHER]   = "other",
+      [IRIS_MEMZONE_BORDER_COLOR_POOL] = "bordercolor",
+   };
+   assert(memzone < ARRAY_SIZE(names));
+   return names[memzone];
+}
+
 /**
  * Iris fixed-size bucketing VMA allocator.
  *
@@ -662,8 +677,8 @@ skip_cache:
       }
    }
 
-   DBG("bo_create: buf %d (%s) %llub\n", bo->gem_handle, bo->name,
-       (unsigned long long) size);
+   DBG("bo_create: buf %d (%s) (%s memzone) %llub\n", bo->gem_handle,
+       bo->name, memzone_name(memzone), (unsigned long long) size);
 
    return bo;