asahi: tuck in null query check

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30051>
This commit is contained in:
Alyssa Rosenzweig
2024-07-05 11:16:27 -04:00
committed by Marge Bot
parent bce466586e
commit a82c0211e7
2 changed files with 15 additions and 19 deletions

View File

@@ -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

View File

@@ -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);
}
}