asahi: Label batch flush reasons
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 17 Jun 2022 03:30:29 +0000 (23:30 -0400)
committerMarge Bot <emma+marge@anholt.net>
Sun, 4 Sep 2022 18:05:31 +0000 (18:05 +0000)
This was helpful in identifying the bottleneck in Inochi2D (the clears).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18380>

src/gallium/drivers/asahi/agx_pipe.c
src/gallium/drivers/asahi/agx_state.c
src/gallium/drivers/asahi/agx_state.h

index 7edcfd1..4a35eb5 100644 (file)
@@ -265,9 +265,9 @@ agx_transfer_map(struct pipe_context *pctx,
       return NULL;
 
    if (ctx->batch->cbufs[0] && resource == ctx->batch->cbufs[0]->texture)
-      pctx->flush(pctx, NULL, 0);
+      agx_flush_all(ctx, "Transfer to colour buffer");
    if (ctx->batch->zsbuf && resource == ctx->batch->zsbuf->texture)
-      pctx->flush(pctx, NULL, 0);
+      agx_flush_all(ctx, "Transfer to depth buffer");
 
    struct agx_transfer *transfer = CALLOC_STRUCT(agx_transfer);
    transfer->base.level = level;
index 0335be6..c1bf2cf 100644 (file)
@@ -726,7 +726,7 @@ agx_set_framebuffer_state(struct pipe_context *pctx,
       return;
 
    /* XXX: eliminate this flush with batch tracking logic */
-   pctx->flush(pctx, NULL, 0);
+   agx_flush_all(ctx, "Framebuffer switch");
 
    util_copy_framebuffer_state(&ctx->framebuffer, state);
    ctx->batch->width = state->width;
index f027f75..b94ff47 100644 (file)
@@ -333,4 +333,12 @@ void agx_blit(struct pipe_context *pipe,
 
 void agx_internal_shaders(struct agx_device *dev);
 
+/* Batch logic */
+static void
+agx_flush_all(struct agx_context *ctx, const char *reason)
+{
+   //printf("Flushing due to: %s\n", reason);
+   ctx->base.flush(&ctx->base, NULL, 0);
+}
+
 #endif