pco: add verbose printing debug option

Signed-off-by: Simon Perretta <simon.perretta@imgtec.com>
Acked-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32258>
This commit is contained in:
Simon Perretta 2024-05-21 16:54:36 +01:00 committed by Marge Bot
parent 6b0a738bfd
commit f3cc7c128c
4 changed files with 14 additions and 3 deletions

View file

@ -2023,6 +2023,8 @@ PowerVR driver environment variables
Print the resulting NIR.
``binary``
Print the resulting binary.
``verbose``
Print verbose IR.
.. envvar:: PCO_COLOR

View file

@ -38,6 +38,7 @@ static const struct debug_named_value pco_debug_print_options[] = {
{ "passes", PCO_DEBUG_PRINT_PASSES, "Print the IR after each pass." },
{ "nir", PCO_DEBUG_PRINT_NIR, "Print the resulting NIR." },
{ "binary", PCO_DEBUG_PRINT_BINARY, "Print the resulting binary." },
{ "verbose", PCO_DEBUG_PRINT_VERBOSE, "Print verbose IR." },
DEBUG_NAMED_VALUE_END,
};

View file

@ -64,6 +64,7 @@ enum pco_debug_print {
PCO_DEBUG_PRINT_PASSES = BITFIELD64_BIT(4),
PCO_DEBUG_PRINT_NIR = BITFIELD64_BIT(5),
PCO_DEBUG_PRINT_BINARY = BITFIELD64_BIT(6),
PCO_DEBUG_PRINT_VERBOSE = BITFIELD64_BIT(7),
};
extern uint64_t pco_debug_print;

View file

@ -31,6 +31,7 @@ typedef struct _pco_print_state {
pco_shader *shader; /** The shader being printed. */
unsigned indent; /** The current printing indent. */
bool is_grouped; /** Whether the shader uses igrps. */
bool verbose; /** Whether to print additional info. */
} pco_print_state;
/* Forward declarations. */
@ -429,6 +430,10 @@ static void pco_print_instr(pco_print_state *state, pco_instr *instr)
/* Special parameters. */
if (info->has_target_cf_node) {
if (printed)
pco_printf(state, ",");
pco_printf(state, " ");
switch (instr->target_cf_node->type) {
case PCO_CF_NODE_TYPE_BLOCK: {
pco_block *target_block = pco_cf_node_as_block(instr->target_cf_node);
@ -469,7 +474,7 @@ static void pco_print_instr(pco_print_state *state, pco_instr *instr)
pco_printf(state, ";");
/* Spec for destinations. */
if (!state->is_grouped && instr->num_dests) {
if (state->verbose && !state->is_grouped && instr->num_dests) {
pco_printf(state, " /*");
printed = false;
@ -488,7 +493,7 @@ static void pco_print_instr(pco_print_state *state, pco_instr *instr)
pco_printf(state, " */");
}
if (instr->comment)
if (state->verbose && instr->comment)
pco_printf(state, " /* %s */", instr->comment);
if (!state->is_grouped)
@ -749,6 +754,7 @@ void pco_print_shader(pco_shader *shader, FILE *fp, const char *when)
.shader = shader,
.indent = 0,
.is_grouped = shader->is_grouped,
.verbose = PCO_DEBUG_PRINT(VERBOSE),
};
if (when)
@ -777,6 +783,7 @@ void pco_print_binary(pco_shader *shader, FILE *fp, const char *when)
.shader = shader,
.indent = 0,
.is_grouped = shader->is_grouped,
.verbose = PCO_DEBUG_PRINT(VERBOSE),
};
if (when)
@ -789,5 +796,5 @@ void pco_print_binary(pco_shader *shader, FILE *fp, const char *when)
return u_hexdump(fp,
pco_shader_binary_data(shader),
pco_shader_binary_size(shader),
true);
state.verbose);
}