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 <lionel.g.landwerlin@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Lionel Landwerlin
2017-04-02 01:07:37 +01:00
parent 04f2e80257
commit 471c1bc7cc
4 changed files with 24 additions and 12 deletions

View File

@@ -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);
}
}
}

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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;
}