Module: Mesa Branch: main Commit: e98aa5541307b28804858c126e1c878c08714bb3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e98aa5541307b28804858c126e1c878c08714bb3
Author: Alyssa Rosenzweig <[email protected]> Date: Tue Aug 17 16:45:17 2021 +0000 panfrost: Prefer batch->resources to rsrc->users This expresses the semantic of the flush only applying to batches within the context, not globally, in line with OpenGL's multithreading rules. Signed-off-by: Alyssa Rosenzweig <[email protected]> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12528> --- src/gallium/drivers/panfrost/pan_job.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 67f7b66ed3a..a59a9a92290 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -257,12 +257,16 @@ panfrost_batch_update_access(struct panfrost_batch *batch, /* Flush users if required */ if (writes || ((writer != NULL) && (writer != batch))) { unsigned i; - BITSET_FOREACH_SET(i, rsrc->track.users, PAN_MAX_BATCHES) { + foreach_batch(ctx, i) { + struct panfrost_batch *batch = &ctx->batches.slots[i]; + /* Skip the entry if this our batch. */ if (i == batch_idx) continue; - panfrost_batch_submit(&ctx->batches.slots[i], 0, 0); + /* Submit if it's a user */ + if (_mesa_set_search(batch->resources, rsrc)) + panfrost_batch_submit(batch, 0, 0); } } @@ -867,10 +871,14 @@ panfrost_flush_batches_accessing_rsrc(struct panfrost_context *ctx, const char *reason) { unsigned i; - BITSET_FOREACH_SET(i, rsrc->track.users, PAN_MAX_BATCHES) { + foreach_batch(ctx, i) { + struct panfrost_batch *batch = &ctx->batches.slots[i]; + + if (!_mesa_set_search(batch->resources, rsrc)) + continue; + perf_debug_ctx(ctx, "Flushing user due to: %s", reason); - panfrost_batch_submit(&ctx->batches.slots[i], - ctx->syncobj, ctx->syncobj); + panfrost_batch_submit(batch, ctx->syncobj, ctx->syncobj); } assert(!BITSET_COUNT(rsrc->track.users));
