From e72facab9ac5db8adc0a3b2c1749416a51de695c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 14 Aug 2023 14:44:16 -0400 Subject: [PATCH] asahi: Generalize query logic We will need to do the same flushing dance for non-occlusion GPU queries. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_query.c | 33 ++++++++++++--------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_query.c b/src/gallium/drivers/asahi/agx_query.c index fcea7fb41e7..d5c7ce50cef 100644 --- a/src/gallium/drivers/asahi/agx_query.c +++ b/src/gallium/drivers/asahi/agx_query.c @@ -48,34 +48,31 @@ agx_begin_query(struct pipe_context *pctx, struct pipe_query *pquery) case PIPE_QUERY_OCCLUSION_PREDICATE: case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: ctx->occlusion_query = query; - - /* begin_query zeroes, flush so we can do that write. If anything (i.e. - * other than piglit) actually hits this, we could shadow the query to - * avoid the flush. - */ - if (query->writer) { - agx_flush_batch_for_reason(ctx, query->writer, - "Occlusion overwritten"); - } - - assert(query->writer == NULL); - - query->value = 0; - return true; + break; case PIPE_QUERY_PRIMITIVES_GENERATED: ctx->prims_generated = query; - query->value = 0; - return true; + break; case PIPE_QUERY_PRIMITIVES_EMITTED: ctx->tf_prims_generated = query; - query->value = 0; - return true; + break; default: return false; } + + /* begin_query zeroes, flush so we can do that write. If anything (i.e. + * other than piglit) actually hits this, we could shadow the query to + * avoid the flush. + */ + if (query->writer) { + agx_flush_batch_for_reason(ctx, query->writer, "Query overwritten"); + } + + assert(query->writer == NULL); + query->value = 0; + return true; } static bool