panfrost: Maintain a bitmap of active batches

This is on the context, so no concurrency issues. This will allow us to
efficiently iterate active batches.

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 79dd1a4e63)
This commit is contained in:
Alyssa Rosenzweig 2021-08-17 16:39:40 +00:00 committed by Dylan Baker
parent ca3c31add8
commit 6b788b8870
3 changed files with 8 additions and 1 deletions

View file

@ -1174,7 +1174,7 @@
"description": "panfrost: Maintain a bitmap of active batches",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -141,6 +141,9 @@ struct panfrost_context {
struct {
uint64_t seqnum;
struct panfrost_batch slots[PAN_MAX_BATCHES];
/** Set of active batches for faster traversal */
BITSET_DECLARE(active, PAN_MAX_BATCHES);
} batches;
/* Bound job batch */

View file

@ -147,6 +147,7 @@ panfrost_batch_cleanup(struct panfrost_batch *batch)
util_sparse_array_finish(&batch->bos);
memset(batch, 0, sizeof(*batch));
BITSET_CLEAR(ctx->batches.active, batch_idx);
}
static void
@ -181,6 +182,9 @@ panfrost_get_batch(struct panfrost_context *ctx,
panfrost_batch_init(ctx, key, batch);
unsigned batch_idx = panfrost_batch_idx(batch);
BITSET_SET(ctx->batches.active, batch_idx);
return batch;
}