intel/decoder: Add intel_print_group_custom_spacing()

This function has 2 additional parameters to set spacing before
printing register group dword or individual registers.

intel_print_group() is keept with the same spacing as before so no
changes on decoder output is expected here.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28722>
This commit is contained in:
José Roberto de Souza 2024-04-15 09:26:41 -07:00 committed by Marge Bot
parent 94deb24e2b
commit c221ba6f75
2 changed files with 25 additions and 7 deletions

View File

@ -1402,10 +1402,11 @@ intel_field_iterator_next(struct intel_field_iterator *iter)
static void
print_dword_header(FILE *outfile,
struct intel_field_iterator *iter,
uint64_t offset, uint32_t dword)
uint64_t offset, uint32_t dword,
const char *spacing)
{
fprintf(outfile, "0x%08"PRIx64": 0x%08x : Dword %d\n",
offset + 4 * dword, iter->p[dword], dword);
fprintf(outfile, "%s0x%08"PRIx64": 0x%08x : Dword %d\n",
spacing, offset + 4 * dword, iter->p[dword], dword);
}
bool
@ -1425,8 +1426,9 @@ intel_field_is_header(struct intel_field *field)
}
void
intel_print_group(FILE *outfile, struct intel_group *group, uint64_t offset,
const uint32_t *p, int p_bit, bool color)
intel_print_group_custom_spacing(FILE *outfile, struct intel_group *group, uint64_t offset,
const uint32_t *p, int p_bit, bool color,
const char *spacing_reg, const char *spacing_dword)
{
struct intel_field_iterator iter;
int last_dword = -1;
@ -1436,11 +1438,11 @@ intel_print_group(FILE *outfile, struct intel_group *group, uint64_t offset,
int iter_dword = iter.end_bit / 32;
if (last_dword != iter_dword) {
for (int i = last_dword + 1; i <= iter_dword; i++)
print_dword_header(outfile, &iter, offset, i);
print_dword_header(outfile, &iter, offset, i, spacing_dword);
last_dword = iter_dword;
}
if (!intel_field_is_header(iter.field)) {
fprintf(outfile, " %s: %s\n", iter.name, iter.value);
fprintf(outfile, "%s%s: %s\n", spacing_reg, iter.name, iter.value);
if (iter.struct_desc) {
int struct_dword = iter.start_bit / 32;
uint64_t struct_offset = offset + 4 * struct_dword;
@ -1450,3 +1452,14 @@ intel_print_group(FILE *outfile, struct intel_group *group, uint64_t offset,
}
}
}
void
intel_print_group(FILE *outfile, struct intel_group *group, uint64_t offset,
const uint32_t *p, int p_bit, bool color)
{
const char *spacing_reg = " ";
const char *spacing_dword = "";
intel_print_group_custom_spacing(outfile, group, offset, p, p_bit, color,
spacing_reg, spacing_dword);
}

View File

@ -202,6 +202,11 @@ void intel_field_iterator_init(struct intel_field_iterator *iter,
bool intel_field_iterator_next(struct intel_field_iterator *iter);
void intel_print_group_custom_spacing(FILE *outfile, struct intel_group *group,
uint64_t offset, const uint32_t *p,
int p_bit, bool color,
const char *spacing_reg,
const char *spacing_dword);
void intel_print_group(FILE *out,
struct intel_group *group,
uint64_t offset, const uint32_t *p, int p_bit,