From 3da483859133c70a68f09698cfe3cad6cd2df4c4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 9 Feb 2023 14:50:26 -0500 Subject: [PATCH] asahi: Submit batches that don't touch RTs If there is any draw, we should submit in case there are active queries, fragment shader side effects, etc. Together with previous commit fixes no_attachment framebuffers. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_batch.c | 1 + src/gallium/drivers/asahi/agx_pipe.c | 4 ++-- src/gallium/drivers/asahi/agx_state.c | 2 ++ src/gallium/drivers/asahi/agx_state.h | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index 40374b79688..e67b9f3f652 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -60,6 +60,7 @@ agx_batch_init(struct agx_context *ctx, batch->clear_depth = 0; batch->clear_stencil = 0; batch->varyings = 0; + batch->any_draws = false; /* We need to emit prim state at the start. Max collides with all. */ batch->reduced_prim = PIPE_PRIM_MAX; diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 453df377503..a40fc8168f6 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -964,8 +964,8 @@ agx_flush_batch(struct agx_context *ctx, struct agx_batch *batch) assert(agx_batch_is_active(batch)); - /* Nothing to do */ - if (!(batch->draw | batch->clear)) { + /* Make sure there's something to submit. */ + if (!batch->clear && !batch->any_draws) { agx_batch_cleanup(ctx, batch); return; } diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 11d6f00d564..ccf3094b779 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -2424,6 +2424,8 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info, batch->resolve |= ctx->zs->store; } + batch->any_draws = true; + if (agx_update_vs(ctx)) ctx->dirty |= AGX_DIRTY_VS | AGX_DIRTY_VS_PROG; else if (ctx->stage[PIPE_SHADER_VERTEX].dirty) diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 6133f4de40f..4279cdab12f 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -162,6 +162,7 @@ struct agx_batch { /* PIPE_CLEAR_* bitmask */ uint32_t clear, draw, load, resolve; + bool any_draws; uint64_t uploaded_clear_color[PIPE_MAX_COLOR_BUFS]; double clear_depth;