mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
asahi: optimize memory_barrier
don't flush everything, only flush batches that could actually need a flush. this eliminates memory barrier flushes in an apitrace of ryujinx, although perf impact there seems neglible. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
This commit is contained in:
parent
745c9d8bdc
commit
e34a707d78
3 changed files with 20 additions and 7 deletions
|
|
@ -776,3 +776,22 @@ agx_add_timestamp_end_query(struct agx_context *ctx, struct agx_query *q)
|
|||
agx_batch_add_timestamp_query(&ctx->batches.slots[idx], q);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* To implement a memory barrier conservatively, flush any batch that contains
|
||||
* an incoherent memory write (requiring a memory barrier to synchronize). This
|
||||
* could be further optimized.
|
||||
*/
|
||||
void
|
||||
agx_memory_barrier(struct pipe_context *pctx, unsigned flags)
|
||||
{
|
||||
struct agx_context *ctx = agx_context(pctx);
|
||||
|
||||
unsigned i;
|
||||
foreach_active(ctx, i) {
|
||||
struct agx_batch *batch = &ctx->batches.slots[i];
|
||||
|
||||
if (batch->incoherent_writes)
|
||||
agx_flush_batch_for_reason(ctx, batch, "Memory barrier");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1417,13 +1417,6 @@ agx_invalidate_resource(struct pipe_context *pctx,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
agx_memory_barrier(struct pipe_context *pctx, unsigned flags)
|
||||
{
|
||||
/* Be conservative for now, we can try to optimize this more later */
|
||||
agx_flush_all(agx_context(pctx), "Memory barrier");
|
||||
}
|
||||
|
||||
static enum pipe_reset_status
|
||||
asahi_get_device_reset_status(struct pipe_context *pipe)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1010,6 +1010,7 @@ void agx_sync_batch(struct agx_context *ctx, struct agx_batch *batch);
|
|||
void agx_sync_all(struct agx_context *ctx, const char *reason);
|
||||
void agx_sync_batch_for_reason(struct agx_context *ctx, struct agx_batch *batch,
|
||||
const char *reason);
|
||||
void agx_memory_barrier(struct pipe_context *pctx, unsigned flags);
|
||||
|
||||
/* Use these instead of batch_add_bo for proper resource tracking */
|
||||
void agx_batch_reads(struct agx_batch *batch, struct agx_resource *rsrc);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue