From 96f247d1b33fafd42a02b58d3f5387f9b574badc Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 11 Feb 2020 11:21:47 -0800 Subject: [PATCH] iris: Dump frame markers with INTEL_DEBUG=submit Now you can see which batches go with which frames. Acked-by: Jason Ekstrand Reviewed-by: Jordan Justen Part-of: --- src/gallium/drivers/iris/iris_context.h | 3 +++ src/gallium/drivers/iris/iris_fence.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 5eacc769f76..e76d3e79e81 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -687,6 +687,9 @@ struct iris_context { struct gen_perf_context *perf_ctx; + /** Frame number for debug prints */ + uint32_t frame; + struct { uint64_t dirty; uint64_t dirty_for_nos[IRIS_NOS_COUNT]; diff --git a/src/gallium/drivers/iris/iris_fence.c b/src/gallium/drivers/iris/iris_fence.c index dbd2d826588..b163ef5a23b 100644 --- a/src/gallium/drivers/iris/iris_fence.c +++ b/src/gallium/drivers/iris/iris_fence.c @@ -156,6 +156,10 @@ iris_wait_syncpt(struct pipe_screen *p_screen, return gen_ioctl(screen->fd, DRM_IOCTL_SYNCOBJ_WAIT, &args); } +#define CSI "\e[" +#define BLUE_HEADER CSI "0;97;44m" +#define NORMAL CSI "0m" + static void iris_fence_flush(struct pipe_context *ctx, struct pipe_fence_handle **out_fence, @@ -164,6 +168,17 @@ iris_fence_flush(struct pipe_context *ctx, struct iris_screen *screen = (void *) ctx->screen; struct iris_context *ice = (struct iris_context *)ctx; + if (flags & PIPE_FLUSH_END_OF_FRAME) { + ice->frame++; + + if (INTEL_DEBUG & DEBUG_SUBMIT) { + fprintf(stderr, "%s ::: FRAME %-10u (ctx %p)%-35c%s\n", + (INTEL_DEBUG & DEBUG_COLOR) ? BLUE_HEADER : "", + ice->frame, ctx, ' ', + (INTEL_DEBUG & DEBUG_COLOR) ? NORMAL : ""); + } + } + /* XXX PIPE_FLUSH_DEFERRED */ for (unsigned i = 0; i < IRIS_BATCH_COUNT; i++) iris_batch_flush(&ice->batches[i]); -- 2.30.2