From: Lionel Landwerlin Date: Sun, 2 Apr 2017 00:07:37 +0000 (+0100) Subject: aubinator/gen_decoder/i965: decode instructions from dword 0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=471c1bc7ccd33caa38bbf7124691ccf6884ac5f8;p=mesa.git aubinator/gen_decoder/i965: decode instructions from dword 0 Some packets like 3DSTATE_VF_STATISTICS, 3DSTATE_DRAWING_RECTANGLE, 3DPRIMITIVE, PIPELINE_SELECT, etc... have configurable fields in dword0, we probably want to print those. Signed-off-by: Lionel Landwerlin Reviewed-by: Matt Turner --- diff --git a/src/intel/common/gen_decoder.c b/src/intel/common/gen_decoder.c index 9b587c344de..6cc6896b057 100644 --- a/src/intel/common/gen_decoder.c +++ b/src/intel/common/gen_decoder.c @@ -817,10 +817,23 @@ print_dword_header(FILE *outfile, offset + 4 * iter->dword, iter->p[iter->dword], iter->dword); } +static bool +is_header_field(struct gen_group *group, struct gen_field *field) +{ + uint32_t bits; + + if (field->start > 32) + return false; + + bits = (1U << (field->end - field->start + 1)) - 1; + bits <<= field->start; + + return (group->opcode_mask & bits) != 0; +} + void gen_print_group(FILE *outfile, struct gen_group *group, - uint64_t offset, const uint32_t *p, - int starting_dword, bool color) + uint64_t offset, const uint32_t *p, bool color) { struct gen_field_iterator iter; int last_dword = 0; @@ -831,13 +844,13 @@ gen_print_group(FILE *outfile, struct gen_group *group, print_dword_header(outfile, &iter, offset); last_dword = iter.dword; } - if (iter.dword >= starting_dword) { + if (!is_header_field(group, iter.field)) { fprintf(outfile, " %s: %s\n", iter.name, iter.value); if (iter.struct_desc) { uint64_t struct_offset = offset + 4 * iter.dword; print_dword_header(outfile, &iter, struct_offset); gen_print_group(outfile, iter.struct_desc, struct_offset, - &p[iter.dword], 0, color); + &p[iter.dword], color); } } } diff --git a/src/intel/common/gen_decoder.h b/src/intel/common/gen_decoder.h index ab01d6dd8b5..be37e8a5424 100644 --- a/src/intel/common/gen_decoder.h +++ b/src/intel/common/gen_decoder.h @@ -134,6 +134,6 @@ bool gen_field_iterator_next(struct gen_field_iterator *iter); void gen_print_group(FILE *out, struct gen_group *group, uint64_t offset, const uint32_t *p, - int starting_dword, bool color); + bool color); #endif /* GEN_DECODER_H */ diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c index 322f0df5232..cae578babac 100644 --- a/src/intel/tools/aubinator.c +++ b/src/intel/tools/aubinator.c @@ -99,8 +99,7 @@ static void decode_group(struct gen_group *strct, const uint32_t *p, int starting_dword) { uint64_t offset = option_print_offsets ? (void *) p - gtt : 0; - gen_print_group(outfile, strct, offset, p, starting_dword, - option_color == COLOR_ALWAYS); + gen_print_group(outfile, strct, offset, p, option_color == COLOR_ALWAYS); } static void @@ -722,7 +721,7 @@ parse_commands(struct gen_spec *spec, uint32_t *cmds, int size, int engine) gen_group_get_name(inst), reset_color); if (option_full_decode) { - decode_group(inst, p, 1); + decode_group(inst, p, 0); for (i = 0; i < ARRAY_LENGTH(custom_handlers); i++) { if (gen_group_get_opcode(inst) == custom_handlers[i].opcode) diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c index 4c3b7dcc411..54bab9efb02 100644 --- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c @@ -180,7 +180,7 @@ decode_struct(struct brw_context *brw, struct gen_spec *spec, fprintf(stderr, "%s\n", struct_name); gen_print_group(stderr, group, gtt_offset + offset, - &data[offset / 4], 0, color); + &data[offset / 4], color); } static void @@ -197,7 +197,7 @@ decode_structs(struct brw_context *brw, struct gen_spec *spec, for (int i = 0; i < entries; i++) { fprintf(stderr, "%s %d\n", struct_name, i); gen_print_group(stderr, group, gtt_offset + offset, - &data[(offset + i * struct_size) / 4], 0, color); + &data[(offset + i * struct_size) / 4], color); } } @@ -239,7 +239,7 @@ do_batch_dump(struct brw_context *brw) fprintf(stderr, "%s0x%08"PRIx64": 0x%08x: %-80s%s\n", header_color, offset, p[0], gen_group_get_name(inst), reset_color); - gen_print_group(stderr, inst, offset, p, 1, color); + gen_print_group(stderr, inst, offset, p, color); switch (gen_group_get_opcode(inst) >> 16) { case _3DSTATE_PIPELINED_POINTERS: @@ -261,7 +261,7 @@ do_batch_dump(struct brw_context *brw) for (int i = 0; i < bt_entries; i++) { fprintf(stderr, "SURFACE_STATE - BTI = %d\n", i); gen_print_group(stderr, group, gtt_offset + bt_pointers[i], - &data[bt_pointers[i] / 4], 0, color); + &data[bt_pointers[i] / 4], color); } break; }