anv: move pipe control debug to anv_util.c

We're going to add more printing.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31928>
This commit is contained in:
Lionel Landwerlin 2024-10-21 11:48:40 +03:00 committed by Marge Bot
parent b5403a4e40
commit 0ab2849597
3 changed files with 29 additions and 10 deletions

View file

@ -6257,19 +6257,19 @@ struct anv_video_session_params {
void
anv_dump_pipe_bits(enum anv_pipe_bits bits, FILE *f);
void
anv_cmd_buffer_pending_pipe_debug(struct anv_cmd_buffer *cmd_buffer,
enum anv_pipe_bits bits,
const char* reason);
static inline void
anv_add_pending_pipe_bits(struct anv_cmd_buffer* cmd_buffer,
enum anv_pipe_bits bits,
const char* reason)
{
cmd_buffer->state.pending_pipe_bits |= bits;
if (INTEL_DEBUG(DEBUG_PIPE_CONTROL) && bits) {
fputs("pc: add ", stdout);
anv_dump_pipe_bits(bits, stdout);
fprintf(stdout, "reason: %s\n", reason);
}
if (cmd_buffer->batch.pc_reasons_count < ARRAY_SIZE(cmd_buffer->batch.pc_reasons)) {
cmd_buffer->batch.pc_reasons[cmd_buffer->batch.pc_reasons_count++] = reason;
if (INTEL_DEBUG(DEBUG_PIPE_CONTROL)) {
anv_cmd_buffer_pending_pipe_debug(cmd_buffer, bits, reason);
}
}

View file

@ -56,6 +56,25 @@ __anv_perf_warn(struct anv_device *device,
}
}
void
anv_cmd_buffer_pending_pipe_debug(struct anv_cmd_buffer *cmd_buffer,
enum anv_pipe_bits bits,
const char* reason)
{
if (bits == 0)
return;
fprintf(stdout, "acc: ");
fprintf(stdout, "bits: ");
anv_dump_pipe_bits(bits, stdout);
fprintf(stdout, "reason: %s", reason);
if (cmd_buffer->batch.pc_reasons_count < ARRAY_SIZE(cmd_buffer->batch.pc_reasons))
cmd_buffer->batch.pc_reasons[cmd_buffer->batch.pc_reasons_count++] = reason;
fprintf(stdout, "\n");
}
void
anv_dump_pipe_bits(enum anv_pipe_bits bits, FILE *f)
{

View file

@ -73,7 +73,7 @@ convert_pc_to_bits(struct GENX(PIPE_CONTROL) *pc) {
#define anv_debug_dump_pc(pc, reason) \
if (INTEL_DEBUG(DEBUG_PIPE_CONTROL)) { \
fputs("pc: emit PC=( ", stdout); \
fputs("pc : emit PC=( ", stdout); \
anv_dump_pipe_bits(convert_pc_to_bits(&(pc)), stdout); \
fprintf(stdout, ") reason: %s\n", reason); \
}
@ -1701,9 +1701,9 @@ genX(emit_apply_pipe_flushes)(struct anv_batch *batch,
bits &= ~ANV_PIPE_NEEDS_END_OF_PIPE_SYNC_BIT;
if (INTEL_DEBUG(DEBUG_PIPE_CONTROL) && bits) {
fputs("pc: add ", stderr);
fputs("acc: add ", stdout);
anv_dump_pipe_bits(ANV_PIPE_END_OF_PIPE_SYNC_BIT, stdout);
fprintf(stderr, "reason: Ensure flushes done before invalidate\n");
fprintf(stdout, "reason: Ensure flushes done before invalidate\n");
}
}