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>
(cherry picked from commit e98aa55413)

Conflicts:
	src/gallium/drivers/panfrost/pan_job.c
This commit is contained in:
Alyssa Rosenzweig 2021-08-17 16:45:17 +00:00 committed by Dylan Baker
parent 22dd50563e
commit a29b083bbe
2 changed files with 14 additions and 6 deletions

View file

@ -1156,7 +1156,7 @@
"description": "panfrost: Prefer batch->resources to rsrc->users",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -291,12 +291,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);
}
}
@ -943,9 +947,13 @@ panfrost_flush_batches_accessing_rsrc(struct panfrost_context *ctx,
struct panfrost_resource *rsrc)
{
unsigned i;
BITSET_FOREACH_SET(i, rsrc->track.users, PAN_MAX_BATCHES) {
panfrost_batch_submit(&ctx->batches.slots[i],
ctx->syncobj, ctx->syncobj);
foreach_batch(ctx, i) {
struct panfrost_batch *batch = &ctx->batches.slots[i];
if (!_mesa_set_search(batch->resources, rsrc))
continue;
panfrost_batch_submit(batch, ctx->syncobj, ctx->syncobj);
}
assert(!BITSET_COUNT(rsrc->track.users));