intel/batch_decoder: Don't follow predicated MI_BATCH_BUFFER_START

The stuff after these may be executed so we want to decode it too.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9445>
This commit is contained in:
Jason Ekstrand 2021-02-24 00:28:17 -06:00
parent 6721925220
commit c23f7f1154

View file

@ -1151,6 +1151,7 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
uint64_t next_batch_addr = 0;
bool ppgtt = false;
bool second_level = false;
bool predicate = false;
struct gen_field_iterator iter;
gen_field_iterator_init(&iter, inst, p, 0, false);
while (gen_field_iterator_next(&iter)) {
@ -1160,32 +1161,36 @@ gen_print_batch(struct gen_batch_decode_ctx *ctx,
second_level = iter.raw_value;
} else if (strcmp(iter.name, "Address Space Indicator") == 0) {
ppgtt = iter.raw_value;
} else if (strcmp(iter.name, "Predication Enable") == 0) {
predicate = iter.raw_value;
}
}
struct gen_batch_decode_bo next_batch = ctx_get_bo(ctx, ppgtt, next_batch_addr);
if (!predicate) {
struct gen_batch_decode_bo next_batch = ctx_get_bo(ctx, ppgtt, next_batch_addr);
if (next_batch.map == NULL) {
fprintf(ctx->fp, "Secondary batch at 0x%08"PRIx64" unavailable\n",
next_batch_addr);
} else {
gen_print_batch(ctx, next_batch.map, next_batch.size,
next_batch.addr, false);
}
if (second_level) {
/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
* like a subroutine call. Commands that come afterwards get
* processed once the 2nd level batch buffer returns with
* MI_BATCH_BUFFER_END.
*/
continue;
} else if (!from_ring) {
/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" unset acts
* like a goto. Nothing after it will ever get processed. In
* order to prevent the recursion from growing, we just reset the
* loop and continue;
*/
break;
if (next_batch.map == NULL) {
fprintf(ctx->fp, "Secondary batch at 0x%08"PRIx64" unavailable\n",
next_batch_addr);
} else {
gen_print_batch(ctx, next_batch.map, next_batch.size,
next_batch.addr, false);
}
if (second_level) {
/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" set acts
* like a subroutine call. Commands that come afterwards get
* processed once the 2nd level batch buffer returns with
* MI_BATCH_BUFFER_END.
*/
continue;
} else if (!from_ring) {
/* MI_BATCH_BUFFER_START with "2nd Level Batch Buffer" unset acts
* like a goto. Nothing after it will ever get processed. In
* order to prevent the recursion from growing, we just reset the
* loop and continue;
*/
break;
}
}
} else if (strcmp(inst_name, "MI_BATCH_BUFFER_END") == 0) {
break;