IGT has this test hang test that works by having a batch buffer call itself. As our implementation of the decoding is perfectly mimicking the hardware, our decoder also "hangs". This change limits the number of batch buffer we'll decode before we bail to 100.
Signed-off-by: Lionel Landwerlin <[email protected]> --- src/intel/common/gen_batch_decoder.c | 15 +++++++++++++-- src/intel/common/gen_decoder.h | 2 ++ src/intel/tools/aubinator_viewer.h | 2 ++ src/intel/tools/aubinator_viewer_decoder.cpp | 10 ++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c index 3609bd3f0ad..d208c7d140f 100644 --- a/src/intel/common/gen_batch_decoder.c +++ b/src/intel/common/gen_batch_decoder.c @@ -804,6 +804,17 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx, const uint32_t *p, *end = batch + batch_size / 4; int length; struct gen_group *inst; + const char *reset_color = ctx->flags & GEN_BATCH_DECODE_IN_COLOR ? NORMAL : ""; + + if (ctx->n_batch_buffer_start >= 100) { + fprintf(ctx->fp, "%s0x%08"PRIx64": Max batch buffer jumps exceeded%s\n", + (ctx->flags & GEN_BATCH_DECODE_IN_COLOR) ? RED_COLOR : "", + (ctx->flags & GEN_BATCH_DECODE_OFFSETS) ? batch_addr : 0, + reset_color); + return; + } + + ctx->n_batch_buffer_start++; for (p = batch; p < end; p += length) { inst = gen_spec_find_instruction(ctx->spec, p); @@ -811,8 +822,6 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx, assert(inst == NULL || length > 0); length = MAX2(1, length); - const char *reset_color = ctx->flags & GEN_BATCH_DECODE_IN_COLOR ? NORMAL : ""; - uint64_t offset; if (ctx->flags & GEN_BATCH_DECODE_OFFSETS) offset = batch_addr + ((char *)p - (char *)batch); @@ -902,4 +911,6 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx, break; } } + + ctx->n_batch_buffer_start--; } diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index 964543581e3..e1d411b7403 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -225,6 +225,8 @@ struct gen_batch_decode_ctx { uint64_t instruction_base; int max_vbo_decoded_lines; + + int n_batch_buffer_start; }; void gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx, diff --git a/src/intel/tools/aubinator_viewer.h b/src/intel/tools/aubinator_viewer.h index e204516784f..970504e8b29 100644 --- a/src/intel/tools/aubinator_viewer.h +++ b/src/intel/tools/aubinator_viewer.h @@ -79,6 +79,8 @@ struct aub_viewer_decode_ctx { enum aub_decode_stage stage; uint32_t end_urb_offset; struct aub_decode_urb_stage_state urb_stages[AUB_DECODE_N_STAGE]; + + int n_batch_buffer_start; }; void aub_viewer_decode_ctx_init(struct aub_viewer_decode_ctx *ctx, diff --git a/src/intel/tools/aubinator_viewer_decoder.cpp b/src/intel/tools/aubinator_viewer_decoder.cpp index 2079deb48d2..57c7849e82e 100644 --- a/src/intel/tools/aubinator_viewer_decoder.cpp +++ b/src/intel/tools/aubinator_viewer_decoder.cpp @@ -873,6 +873,14 @@ aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx, const uint32_t *p, *batch = (const uint32_t *) _batch, *end = batch + batch_size / 4; int length; + if (ctx->n_batch_buffer_start >= 100) { + ImGui::TextColored(ctx->cfg->error_color, + "0x%08" PRIx64 ": Max batch buffer jumps exceeded", batch_addr); + return; + } + + ctx->n_batch_buffer_start++; + for (p = batch; p < end; p += length) { inst = gen_spec_find_instruction(ctx->spec, p); length = gen_group_get_length(inst, p); @@ -966,4 +974,6 @@ aub_viewer_render_batch(struct aub_viewer_decode_ctx *ctx, break; } } + + ctx->n_batch_buffer_start--; } -- 2.19.0.rc1 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
