[Mesa-dev] [PATCH v3 08/16] intel/batch-decoder: handle non-contiguous binding table / surface state

Lionel Landwerlin lionel.g.landwerlin at intel.com
Thu Jun 21 16:29:07 UTC 2018


From: Scott D Phillips <scott.d.phillips at intel.com>

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
---
 src/intel/common/gen_batch_decoder.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index 3852f32de36..2b6978da92d 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -236,20 +236,30 @@ dump_binding_table(struct gen_batch_decode_ctx *ctx, uint32_t offset, int count)
       return;
    }
 
+   struct gen_batch_decode_bo bo = ctx->surface_base;
    const uint32_t *pointers = ctx->surface_base.map + offset;
    for (int i = 0; i < count; i++) {
       if (pointers[i] == 0)
          continue;
 
-      if (pointers[i] % 32 != 0 ||
-          (pointers[i] + strct->dw_length * 4) >= ctx->surface_base.size) {
+      if (pointers[i] % 32 != 0) {
+         fprintf(ctx->fp, "pointer %u: %08x <not valid>\n", i, pointers[i]);
+         continue;
+      }
+
+      uint64_t addr = ctx->surface_base.addr + pointers[i];
+      uint32_t size = strct->dw_length * 4;
+
+      if (addr < bo.addr || addr + size >= bo.addr + bo.size)
+         bo = ctx->get_bo(ctx->user_data, addr);
+
+      if (addr < bo.addr || addr + size >= bo.addr + bo.size) {
          fprintf(ctx->fp, "pointer %u: %08x <not valid>\n", i, pointers[i]);
          continue;
       }
 
       fprintf(ctx->fp, "pointer %u: %08x\n", i, pointers[i]);
-      ctx_print_group(ctx, strct, ctx->surface_base.addr + pointers[i],
-                      ctx->surface_base.map + pointers[i]);
+      ctx_print_group(ctx, strct, addr, bo.map + (addr - bo.addr));
    }
 }
 
-- 
2.17.1



More information about the mesa-dev mailing list