Mesa (master): intel/tools: Handle strides better when dumping buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 31 17:47:09 UTC 2020


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Jan 30 11:35:52 2020 -0600

intel/tools: Handle strides better when dumping buffers

The old code would only break at stride boundaries if the stride was
less than 32B; otherwise it would just break every 32B.  This commit
makes it break at stride boundaries and 32B boundaries (starting from
the last stride).  This makes reading large vertex buffers in aubinator
much nicer.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3642>

---

 src/intel/common/gen_batch_decoder.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index 2a5261b2f92..e03a5e1d26c 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -176,11 +176,13 @@ ctx_print_buffer(struct gen_batch_decode_ctx *ctx,
    const uint32_t *dw_end =
          bo.map + ROUND_DOWN_TO(MIN2(bo.size, read_length), 4);
 
-   int column_count = 0, line_count = -1;
+   int column_count = 0, pitch_col_count = 0, line_count = -1;
    for (const uint32_t *dw = bo.map; dw < dw_end; dw++) {
-      if (column_count * 4 == pitch || column_count == 8) {
+      if (pitch_col_count * 4 == pitch || column_count == 8) {
          fprintf(ctx->fp, "\n");
          column_count = 0;
+         if (pitch_col_count * 4 == pitch)
+            pitch_col_count = 0;
          line_count++;
 
          if (max_lines >= 0 && line_count >= max_lines)
@@ -194,6 +196,7 @@ ctx_print_buffer(struct gen_batch_decode_ctx *ctx,
          fprintf(ctx->fp, "  0x%08x", *dw);
 
       column_count++;
+      pitch_col_count++;
    }
    fprintf(ctx->fp, "\n");
 }



More information about the mesa-commit mailing list