intel/tools/aubinator_error_decode: read HW Context before other batches

The hardware context buffer has state that was set before the
batch started. By decoding it first, references to things like
Dynamic State Base Address are decodable in the command batches.

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4246>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4246>
This commit is contained in:
D Scott Phillips 2020-03-19 11:10:11 -07:00 committed by Marge Bot
parent c40acdef52
commit 49f9a0bb57
1 changed files with 18 additions and 0 deletions

View File

@ -380,6 +380,17 @@ static int ascii85_decode(const char *in, uint32_t **out, bool inflate)
return zlib_inflate(out, len);
}
static int qsort_hw_context_first(const void *a, const void *b)
{
const struct section *sa = a, *sb = b;
if (strcmp(sa->buffer_name, "HW Context") == 0)
return -1;
if (strcmp(sb->buffer_name, "HW Context") == 0)
return 1;
else
return 0;
}
static struct gen_batch_decode_bo
get_gen_batch_bo(void *user_data, bool ppgtt, uint64_t address)
{
@ -584,6 +595,13 @@ read_data_file(FILE *file)
free(line);
free(ring_name);
/*
* Order sections so that the hardware context section is visited by the
* decoder before other command buffers. This will allow the decoder to see
* persistent state that was set before the current batch.
*/
qsort(sections, num_sections, sizeof(sections[0]), qsort_hw_context_first);
enum gen_batch_decode_flags batch_flags = 0;
if (option_color == COLOR_ALWAYS)
batch_flags |= GEN_BATCH_DECODE_IN_COLOR;