freedreno/cffdec: Add NOP debug messages
We want to encode special messages into the CS that can be printed by cffdec, these messages have identifiers that describe their usage (message, scope begin and scope end) which allow for an improved trace navigation experience due to the additional information. Signed-off-by: Mark Collins <mark@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18271>
This commit is contained in:
@@ -41,6 +41,9 @@ u_trace is controlled by environment variables:
|
||||
enables marker instrumentation, will print utrace markers into
|
||||
the CS which can then be viewed by dumping the CS from the driver.
|
||||
|
||||
- For Turnip, ``cffdump`` can be used to view the markers in
|
||||
the trace.
|
||||
|
||||
:envvar:`MESA_GPU_TRACEFILE`
|
||||
specifies a file where to write the output instead of ``stdout``
|
||||
|
||||
|
@@ -2106,26 +2106,55 @@ cp_run_cl(uint32_t *dwords, uint32_t sizedwords, int level)
|
||||
}
|
||||
|
||||
static void
|
||||
cp_nop(uint32_t *dwords, uint32_t sizedwords, int level)
|
||||
print_nop_tail_string(uint32_t *dwords, uint32_t sizedwords)
|
||||
{
|
||||
const char *buf = (void *)dwords;
|
||||
int i;
|
||||
for (int i = 0; i < 4 * sizedwords; i++) {
|
||||
if (buf[i] == '\0')
|
||||
break;
|
||||
if (isascii(buf[i]))
|
||||
printf("%c", buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cp_nop(uint32_t *dwords, uint32_t sizedwords, int level)
|
||||
{
|
||||
if (quiet(3))
|
||||
return;
|
||||
|
||||
/* NOP is used to encode special debug strings by Turnip.
|
||||
* See tu_cs_emit_debug_magic_strv(...)
|
||||
*/
|
||||
static int scope_level = 0;
|
||||
uint32_t identifier = dwords[0];
|
||||
bool is_special = false;
|
||||
if (identifier == CP_NOP_MESG) {
|
||||
printf("### ");
|
||||
is_special = true;
|
||||
} else if (identifier == CP_NOP_BEGN) {
|
||||
printf(">>> #%d: ", ++scope_level);
|
||||
is_special = true;
|
||||
} else if (identifier == CP_NOP_END) {
|
||||
printf("<<< #%d: ", scope_level--);
|
||||
is_special = true;
|
||||
}
|
||||
|
||||
if (is_special) {
|
||||
if (sizedwords > 1) {
|
||||
print_nop_tail_string(dwords + 1, sizedwords - 1);
|
||||
printf("\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// blob doesn't use CP_NOP for string_marker but it does
|
||||
// use it for things that end up looking like, but aren't
|
||||
// ascii chars:
|
||||
if (!options->decode_markers)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 4 * sizedwords; i++) {
|
||||
if (buf[i] == '\0')
|
||||
break;
|
||||
if (isascii(buf[i]))
|
||||
printf("%c", buf[i]);
|
||||
}
|
||||
print_nop_tail_string(dwords, sizedwords);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user