asahi: Simplify occlusion query batch tracking

Yes, this means we now lie to the app. There's nothing more in the spirit of
dumb OpenGL features than lying!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24847>
This commit is contained in:
Alyssa Rosenzweig 2023-08-14 15:11:54 -04:00 committed by Marge Bot
parent e72facab9a
commit e5dd053640
3 changed files with 8 additions and 37 deletions

View file

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

View file

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

View file

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