[Mesa-dev] [PATCH 02/17] i965: Add an INTEL_DEBUG=flush option for printing batch statistics.

Kenneth Graunke kenneth at whitecape.org
Wed Sep 6 00:09:35 UTC 2017


When a batch is flushed, INTEL_DEBUG=bat prints a message indicating
which part of the code triggered the flushed, and some statistics about
the batch/state buffer utilization.

It also decodes the batchbuffer in debug builds...which is so much
output that it drowns out the utilization messages, if that's all you
care about.

INTEL_DEBUG=flush now just does the utilization messages.
INTEL_DEBUG=bat continues to do both (as the message is a good indicator
that we're starting decode of a new batch).
---
 docs/envvars.html                             | 1 +
 src/intel/common/gen_debug.c                  | 1 +
 src/intel/common/gen_debug.h                  | 2 +-
 src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/docs/envvars.html b/docs/envvars.html
index 9e2f8163644..ddd1470327e 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -175,6 +175,7 @@ See the <a href="xlibdriver.html">Xlib software driver page</a> for details.
    <li>do32 - generate compute shader SIMD32 programs even if workgroup size doesn't exceed the SIMD16 limit</li>
    <li>dri - emit messages about the DRI interface</li>
    <li>fbo - emit messages about framebuffers</li>
+   <li>flush - emit batchbuffer usage statistics</li>
    <li>fs - dump shader assembly for fragment shaders</li>
    <li>gs - dump shader assembly for geometry shaders</li>
    <li>hex - print instruction hex dump with the disassembly</li>
diff --git a/src/intel/common/gen_debug.c b/src/intel/common/gen_debug.c
index b604d56ef86..068a43ecfdb 100644
--- a/src/intel/common/gen_debug.c
+++ b/src/intel/common/gen_debug.c
@@ -57,6 +57,7 @@ static const struct debug_control debug_control[] = {
    { "vert",        DEBUG_VERTS },
    { "dri",         DEBUG_DRI },
    { "sf",          DEBUG_SF },
+   { "flush",       DEBUG_FLUSH },
    { "wm",          DEBUG_WM },
    { "urb",         DEBUG_URB },
    { "vs",          DEBUG_VS },
diff --git a/src/intel/common/gen_debug.h b/src/intel/common/gen_debug.h
index d290303682e..ea34f7247f3 100644
--- a/src/intel/common/gen_debug.h
+++ b/src/intel/common/gen_debug.h
@@ -57,7 +57,7 @@ extern uint64_t INTEL_DEBUG;
 #define DEBUG_VERTS               (1ull << 13)
 #define DEBUG_DRI                 (1ull << 14)
 #define DEBUG_SF                  (1ull << 15)
-/* Hole - feel free to reuse      (1ull << 16) */
+#define DEBUG_FLUSH               (1ull << 16)
 #define DEBUG_WM                  (1ull << 17)
 #define DEBUG_URB                 (1ull << 18)
 #define DEBUG_VS                  (1ull << 19)
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 08d35ace135..422e6754d54 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -731,7 +731,7 @@ _intel_batchbuffer_flush_fence(struct brw_context *brw,
       brw_bo_reference(brw->throttle_batch[0]);
    }
 
-   if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
+   if (unlikely(INTEL_DEBUG & (DEBUG_BATCH | DEBUG_FLUSH))) {
       int bytes_for_commands = 4 * USED_BATCH(brw->batch);
       int bytes_for_state = brw->batch.bo->size - brw->batch.state_batch_offset;
       int total_bytes = bytes_for_commands + bytes_for_state;
-- 
2.14.1



More information about the mesa-dev mailing list