From 7bc904cb4a775e7c9084ba977d42980c85823362 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 15 Feb 2024 11:56:40 -0400 Subject: [PATCH] asahi: add flush_query_writers helper Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_query.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_query.c b/src/gallium/drivers/asahi/agx_query.c index 9a04ae3267b..8c746f05a98 100644 --- a/src/gallium/drivers/asahi/agx_query.c +++ b/src/gallium/drivers/asahi/agx_query.c @@ -174,13 +174,23 @@ agx_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index) } static void -sync_query_writers(struct agx_context *ctx, struct agx_query *query, - const char *reason) +flush_query_writers(struct agx_context *ctx, struct agx_query *query, + const char *reason) { STATIC_ASSERT(ARRAY_SIZE(ctx->batches.generation) == AGX_MAX_BATCHES); STATIC_ASSERT(ARRAY_SIZE(ctx->batches.slots) == AGX_MAX_BATCHES); STATIC_ASSERT(ARRAY_SIZE(query->writer_generation) == AGX_MAX_BATCHES); + for (unsigned i = 0; i < AGX_MAX_BATCHES; ++i) { + if (query->writer_generation[i] == ctx->batches.generation[i]) + agx_flush_batch_for_reason(ctx, &ctx->batches.slots[i], reason); + } +} + +static void +sync_query_writers(struct agx_context *ctx, struct agx_query *query, + const char *reason) +{ for (unsigned i = 0; i < AGX_MAX_BATCHES; ++i) { if (query->writer_generation[i] == ctx->batches.generation[i]) agx_sync_batch_for_reason(ctx, &ctx->batches.slots[i], reason);