This makes aubinator_error_decode's shader dumping work like aubinator.
Instead of printing them after the fact, it prints them right inside the
3DSTATE_VS/HS/DS/GS/PS packet that references them. This saves you the
effort of cross-referencing things and jumping back and forth.
It also reduces a bunch of book-keeping, and eliminates the limitation
that we could only handle 4096 programs. That code was also broken and
failed to print any shaders if there were under 4096 programs.
---
src/intel/tools/aubinator_error_decode.c | 134
+++++++++++--------------------
1 file changed, 49 insertions(+), 85 deletions(-)
diff --git a/src/intel/tools/aubinator_error_decode.c
b/src/intel/tools/aubinator_error_decode.c
index cea68523ae2..96b4989936e 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -221,35 +221,28 @@ struct section {
#define MAX_SECTIONS 30
static struct section sections[MAX_SECTIONS];
-struct program {
- const char *type;
- const char *command;
- uint64_t command_offset;
- uint64_t instruction_base_address;
- uint64_t ksp;
-};
-
-#define MAX_NUM_PROGRAMS 4096
-static struct program programs[MAX_NUM_PROGRAMS];
-static int idx_program = 0, num_programs = 0;
-
-static int next_program(void)
+static void
+disassemble_program(struct gen_disasm *disasm, const char *type,
+ const struct section *instruction_section,
+ uint64_t ksp)
{
- int ret = idx_program;
- idx_program = (idx_program + 1) % MAX_NUM_PROGRAMS;
- num_programs = MIN(num_programs + 1, MAX_NUM_PROGRAMS);
- return ret;
+ if (!instruction_section)
+ return;
+
+ printf("\nReferenced %s:\n", type);
+ gen_disasm_disassemble(disasm, instruction_section->data, ksp, stdout);
}
static void
-decode(struct gen_spec *spec, const struct section *section)
+decode(struct gen_spec *spec, struct gen_disasm *disasm,
+ const struct section *section)
{
uint64_t gtt_offset = section->gtt_offset;
uint32_t *data = section->data;
uint32_t *p, *end = (data + section->count);
int length;
struct gen_group *inst;
- uint64_t current_instruction_base_address = 0;
+ const struct section *current_instruction_buffer = NULL;
for (p = data; p < end; p += length) {
const char *color = option_full_decode ? BLUE_HEADER : NORMAL,
@@ -284,7 +277,13 @@ decode(struct gen_spec *spec, const struct section
*section)
while (gen_field_iterator_next(&iter)) {
if (strcmp(iter.name, "Instruction Base Address") == 0) {
- current_instruction_base_address = strtol(iter.value, NULL, 16);
+ uint64_t instr_base_address = strtol(iter.value, NULL, 16);
+ current_instruction_buffer = NULL;
+ for (int s = 0; s < MAX_SECTIONS; s++) {
+ if (sections[s].gtt_offset == instr_base_address) {