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

Author: Scott D Phillips <[email protected]>
Date:   Mon Apr  9 12:46:51 2018 -0700

intel/batch-decoder: handle non-contiguous binding table / surface state

Reviewed-by: Lionel Landwerlin <[email protected]>

---

 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 3852f32de3..2b6978da92 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));
    }
 }
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to