mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 06:30:10 +01:00
aubinator: Move the guts of decode_group() to decoder.c.
This lets us use it outside of the aubinator binary itself. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
parent
aa1ef0b984
commit
4084083124
3 changed files with 42 additions and 31 deletions
|
|
@ -95,40 +95,12 @@ valid_offset(uint32_t offset)
|
|||
return offset < gtt_end;
|
||||
}
|
||||
|
||||
static void
|
||||
print_dword_header(struct gen_field_iterator *iter, uint64_t offset)
|
||||
{
|
||||
fprintf(outfile, "0x%08"PRIx64": 0x%08x : Dword %d\n",
|
||||
offset + 4 * iter->dword, iter->p[iter->dword], iter->dword);
|
||||
}
|
||||
|
||||
static void
|
||||
decode_group(struct gen_group *strct, const uint32_t *p, int starting_dword)
|
||||
{
|
||||
struct gen_field_iterator iter;
|
||||
int last_dword = 0;
|
||||
uint64_t offset = 0;
|
||||
|
||||
if (option_print_offsets)
|
||||
offset = (void *) p - gtt;
|
||||
else
|
||||
offset = 0;
|
||||
|
||||
gen_field_iterator_init(&iter, strct, p,
|
||||
option_color == COLOR_ALWAYS);
|
||||
while (gen_field_iterator_next(&iter)) {
|
||||
if (last_dword != iter.dword) {
|
||||
print_dword_header(&iter, offset);
|
||||
last_dword = iter.dword;
|
||||
}
|
||||
if (iter.dword >= starting_dword) {
|
||||
fprintf(outfile, " %s: %s\n", iter.name, iter.value);
|
||||
if (iter.struct_desc) {
|
||||
print_dword_header(&iter, offset + 4 * iter.dword);
|
||||
decode_group(iter.struct_desc, &p[iter.dword], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
uint64_t offset = option_print_offsets ? (void *) p - gtt : 0;
|
||||
gen_print_group(outfile, strct, offset, p, starting_dword,
|
||||
option_color == COLOR_ALWAYS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -826,3 +826,37 @@ gen_field_iterator_next(struct gen_field_iterator *iter)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
print_dword_header(FILE *outfile,
|
||||
struct gen_field_iterator *iter, uint64_t offset)
|
||||
{
|
||||
fprintf(outfile, "0x%08"PRIx64": 0x%08x : Dword %d\n",
|
||||
offset + 4 * iter->dword, iter->p[iter->dword], iter->dword);
|
||||
}
|
||||
|
||||
void
|
||||
gen_print_group(FILE *outfile, struct gen_group *group,
|
||||
uint64_t offset, const uint32_t *p,
|
||||
int starting_dword, bool color)
|
||||
{
|
||||
struct gen_field_iterator iter;
|
||||
int last_dword = 0;
|
||||
|
||||
gen_field_iterator_init(&iter, group, p, color);
|
||||
while (gen_field_iterator_next(&iter)) {
|
||||
if (last_dword != iter.dword) {
|
||||
print_dword_header(outfile, &iter, offset);
|
||||
last_dword = iter.dword;
|
||||
}
|
||||
if (iter.dword >= starting_dword) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,4 +130,9 @@ void gen_field_iterator_init(struct gen_field_iterator *iter,
|
|||
|
||||
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);
|
||||
|
||||
#endif /* DECODER_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue