diff --git a/src/gallium/drivers/asahi/agx_batch.c b/src/gallium/drivers/asahi/agx_batch.c index c8b501d81ee..a656d31a13d 100644 --- a/src/gallium/drivers/asahi/agx_batch.c +++ b/src/gallium/drivers/asahi/agx_batch.c @@ -482,35 +482,6 @@ agx_batch_writes(struct agx_batch *batch, struct agx_resource *rsrc) } } -/* - * The OpenGL specification says that - * - * It must always be true that if any query object returns a result - * available of TRUE, all queries of the same type issued prior to that - * query must also return TRUE. - * - * To implement this, we need to be able to flush all batches writing occlusion - * queries so we ensure ordering. - */ -void -agx_flush_occlusion_queries(struct agx_context *ctx) -{ - unsigned i; - foreach_active(ctx, i) { - struct agx_batch *other = &ctx->batches.slots[i]; - - if (other->occlusion_queries.size != 0) - agx_flush_batch_for_reason(ctx, other, "Occlusion query ordering"); - } - - foreach_submitted(ctx, i) { - struct agx_batch *other = &ctx->batches.slots[i]; - - if (other->occlusion_queries.size != 0) - agx_sync_batch_for_reason(ctx, other, "Occlusion query ordering"); - } -} - static int agx_get_in_sync(struct agx_context *ctx) { diff --git a/src/gallium/drivers/asahi/agx_query.c b/src/gallium/drivers/asahi/agx_query.c index d5c7ce50cef..c6a1a62c703 100644 --- a/src/gallium/drivers/asahi/agx_query.c +++ b/src/gallium/drivers/asahi/agx_query.c @@ -115,13 +115,15 @@ agx_get_query_result(struct pipe_context *pctx, struct pipe_query *pquery, assert(query->writer->occlusion_queries.size != 0); /* Querying the result forces a query to finish in finite time, so we - * need to flush regardless. Furthermore, we need all earlier queries - * to finish before this query, so we flush all batches writing queries - * now. Yes, this sucks for tilers. + * need to flush. Furthermore, we need all earlier queries + * to finish before this query, so we sync unconditionally (so we can + * maintain the lie that all queries are finished when read). + * + * TODO: Optimize based on wait flag. */ - agx_flush_occlusion_queries(ctx); - - /* TODO: Respect wait when we have real sync */ + struct agx_batch *writer = query->writer; + agx_flush_batch_for_reason(ctx, writer, "GPU query"); + agx_sync_batch_for_reason(ctx, writer, "GPU query"); } assert(query->writer == NULL && "cleared when cleaning up batch"); diff --git a/src/gallium/drivers/asahi/agx_state.h b/src/gallium/drivers/asahi/agx_state.h index 5334b53abf0..d39dc14f16a 100644 --- a/src/gallium/drivers/asahi/agx_state.h +++ b/src/gallium/drivers/asahi/agx_state.h @@ -750,8 +750,6 @@ void agx_flush_readers(struct agx_context *ctx, struct agx_resource *rsrc, const char *reason); void agx_flush_writer(struct agx_context *ctx, struct agx_resource *rsrc, const char *reason); -void agx_flush_batches_writing_occlusion_queries(struct agx_context *ctx); -void agx_flush_occlusion_queries(struct agx_context *ctx); void agx_sync_writer(struct agx_context *ctx, struct agx_resource *rsrc, const char *reason);