From c262ec19d0705d93903b28ed8f79cb85abeb5a1a Mon Sep 17 00:00:00 2001 From: Scott D Phillips Date: Mon, 9 Apr 2018 12:46:51 -0700 Subject: [PATCH] intel/batch-decoder: handle non-contiguous binding table / surface state Reviewed-by: Lionel Landwerlin --- 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 \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 \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.30.2