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 <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12528>
This commit is contained in:
Alyssa Rosenzweig 2021-08-17 16:45:17 +00:00 committed by Marge Bot
parent 5c4fbae571
commit e98aa55413
1 changed files with 13 additions and 5 deletions

View File

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