panfrost: Add lots of perf_debug annotations
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 27 Oct 2022 21:48:02 +0000 (17:48 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sat, 29 Oct 2022 18:23:55 +0000 (18:23 +0000)
Should make it easier to diagnose performance issues in the future.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19358>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_resource.c

index ad17082..f666eae 100644 (file)
@@ -298,6 +298,9 @@ panfrost_get_blend_shaders(struct panfrost_batch *batch,
                                         c, &shader_bo, &shader_offset);
                 }
         }
+
+        if (shader_bo)
+                perf_debug_ctx(batch->ctx, "Blend shader use");
 }
 
 #if PAN_ARCH >= 5
@@ -3547,6 +3550,8 @@ panfrost_launch_xfb(struct panfrost_batch *batch,
         if (count == 0)
                 return;
 
+        perf_debug_ctx(batch->ctx, "Emulating transform feedback");
+
         struct panfrost_shader_state *vs = panfrost_get_shader_state(ctx, PIPE_SHADER_VERTEX);
         struct panfrost_shader_variants v = { .variants = vs->xfb };
 
@@ -3800,6 +3805,8 @@ panfrost_indirect_draw(struct panfrost_batch *batch,
         struct panfrost_context *ctx = batch->ctx;
         struct panfrost_device *dev = pan_device(ctx->base.screen);
 
+        perf_debug(dev, "Emulating indirect draw on the GPU");
+
         /* TODO: update statistics (see panfrost_statistics_record()) */
         /* TODO: Increment transform feedback offsets */
         assert(ctx->streamout.num_targets == 0);
@@ -3991,6 +3998,7 @@ panfrost_draw_vbo(struct pipe_context *pipe,
         if ((!(dev->debug & PAN_DBG_INDIRECT) || !PAN_GPU_INDIRECTS) && indirect && indirect->buffer) {
                 assert(num_draws == 1);
                 util_draw_indirect(pipe, info, indirect);
+                perf_debug(dev, "Emulating indirect draw on the CPU");
                 return;
         }
 
index e0b7978..aedc9e2 100644 (file)
@@ -78,6 +78,7 @@ panfrost_clear(
         /* Once there is content, clear with a fullscreen quad */
         panfrost_blitter_save(ctx, false /* render condition */);
 
+        perf_debug_ctx(ctx, "Clearing with quad");
         util_blitter_clear(ctx->blitter,
                            ctx->pipe_framebuffer.width,
                            ctx->pipe_framebuffer.height,
index 02651ec..a299225 100644 (file)
@@ -1401,6 +1401,8 @@ panfrost_generate_mipmap(
 {
         struct panfrost_resource *rsrc = pan_resource(prsrc);
 
+        perf_debug_ctx(pan_context(pctx), "Unoptimized mipmap generation");
+
         /* Generating a mipmap invalidates the written levels, so make that
          * explicit so we don't try to wallpaper them back and end up with
          * u_blitter recursion */