From a82c0211e7e2d278235bef49bd926d20ac139484 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 5 Jul 2024 11:16:27 -0400 Subject: [PATCH] asahi: tuck in null query check Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_query.c | 8 ++++++-- src/gallium/drivers/asahi/agx_state.c | 26 +++++++++----------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_query.c b/src/gallium/drivers/asahi/agx_query.c index f2de946479a..58835b77d8e 100644 --- a/src/gallium/drivers/asahi/agx_query.c +++ b/src/gallium/drivers/asahi/agx_query.c @@ -619,8 +619,12 @@ agx_get_oq_index(struct agx_batch *batch, struct agx_query *query) uint64_t agx_get_query_address(struct agx_batch *batch, struct agx_query *query) { - agx_add_query_to_batch(batch, query); - return query->ptr.gpu; + if (query) { + agx_add_query_to_batch(batch, query); + return query->ptr.gpu; + } else { + return 0; + } } void diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 03746b4c024..e8d493b9e38 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -3990,31 +3990,23 @@ agx_batch_geometry_params(struct agx_batch *batch, uint64_t input_index_buffer, } for (unsigned i = 0; i < ARRAY_SIZE(batch->ctx->prims_generated); ++i) { - if (batch->ctx->prims_generated[i]) { - params.prims_generated_counter[i] = - agx_get_query_address(batch, batch->ctx->prims_generated[i]); - } + params.prims_generated_counter[i] = + agx_get_query_address(batch, batch->ctx->prims_generated[i]); } for (unsigned i = 0; i < ARRAY_SIZE(batch->ctx->tf_prims_generated); ++i) { - if (batch->ctx->tf_prims_generated[i]) { - params.xfb_prims_generated_counter[i] = - agx_get_query_address(batch, batch->ctx->tf_prims_generated[i]); - } + params.xfb_prims_generated_counter[i] = + agx_get_query_address(batch, batch->ctx->tf_prims_generated[i]); } if (batch->ctx->active_queries && batch->ctx->streamout.num_targets > 0) { for (unsigned i = 0; i < ARRAY_SIZE(batch->ctx->tf_overflow); ++i) { - if (batch->ctx->tf_overflow[i]) { - params.xfb_overflow[i] = - agx_get_query_address(batch, batch->ctx->tf_overflow[i]); - } + params.xfb_overflow[i] = + agx_get_query_address(batch, batch->ctx->tf_overflow[i]); } - if (batch->ctx->tf_any_overflow) { - params.xfb_any_overflow = - agx_get_query_address(batch, batch->ctx->tf_any_overflow); - } + params.xfb_any_overflow = + agx_get_query_address(batch, batch->ctx->tf_any_overflow); } /* Calculate input primitive count for direct draws, and allocate the vertex @@ -5050,7 +5042,7 @@ agx_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info, for (unsigned i = 0; i < ARRAY_SIZE(ctx->pipeline_statistics); ++i) { struct agx_query *query = ctx->pipeline_statistics[i]; batch->uniforms.pipeline_statistics[i] = - query ? agx_get_query_address(batch, query) : 0; + agx_get_query_address(batch, query); } }