From 53586f88d7a3386d3122584b0af9fddc8abc6657 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sat, 11 Nov 2017 20:57:42 -0800 Subject: [PATCH] intel/tools/error: Do ascii85 decode first. The dashes "---" may occur within an ascii85 block, but only an ascii85 block starts with ':' or '~'. Ported from Chris Wilson's intel-gpu-tools commit: bceec7e1d8a160226b783c6344eae8cbf4ece144 Reviewed-by: Chris Wilson --- src/intel/tools/aubinator_error_decode.c | 60 ++++++++++++------------ 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c index 2322bac8391..72919c1c9e4 100644 --- a/src/intel/tools/aubinator_error_decode.c +++ b/src/intel/tools/aubinator_error_decode.c @@ -507,6 +507,35 @@ read_data_file(FILE *file) ring_name = new_ring_name; } + if (line[0] == ':' || line[0] == '~') { + count = ascii85_decode(line+1, &data, line[0] == ':'); + if (count == 0) { + fprintf(stderr, "ASCII85 decode failed.\n"); + exit(EXIT_FAILURE); + } + + if (strcmp(buffer_name, "user") == 0) { + printf("Disassembly of programs in instruction buffer at " + "0x%08"PRIx64":\n", gtt_offset); + for (int i = 0; i < num_programs; i++) { + int idx = (idx_program + i) % MAX_NUM_PROGRAMS; + if (programs[idx].instruction_base_address == gtt_offset) { + printf("\n%s (specified by %s at batch offset " + "0x%08"PRIx64") at offset 0x%08"PRIx64"\n", + programs[idx].type, + programs[idx].command, + programs[idx].command_offset, + programs[idx].ksp); + gen_disasm_disassemble(disasm, data, programs[idx].ksp, + stdout); + } + } + } else { + decode(spec, buffer_name, ring_name, gtt_offset, data, &count); + } + continue; + } + dashes = strstr(line, "---"); if (dashes) { uint32_t lo, hi; @@ -590,37 +619,6 @@ read_data_file(FILE *file) } } - if (line[0] == ':' || line[0] == '~') { - count = ascii85_decode(line+1, &data, line[0] == ':'); - if (count == 0) { - fprintf(stderr, "ASCII85 decode failed.\n"); - exit(EXIT_FAILURE); - } - - if (strcmp(buffer_name, "user") == 0) { - printf("Disassembly of programs in instruction buffer at " - "0x%08"PRIx64":\n", gtt_offset); - for (int i = 0; i < num_programs; i++) { - int idx = (idx_program + i) % MAX_NUM_PROGRAMS; - if (programs[idx].instruction_base_address == gtt_offset) { - printf("\n%s (specified by %s at batch offset " - "0x%08"PRIx64") at offset 0x%08"PRIx64"\n", - programs[idx].type, - programs[idx].command, - programs[idx].command_offset, - programs[idx].ksp); - gen_disasm_disassemble(disasm, data, programs[idx].ksp, - stdout); - } - } - } else { - decode(spec, - buffer_name, ring_name, - gtt_offset, data, &count); - } - continue; - } - matched = sscanf(line, "%08x : %08x", &offset, &value); if (matched != 2) { uint32_t reg, reg2; -- 2.30.2