diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 98394c1bcf8..78b39ebaef1 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -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 */ diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 2bf544860a1..f7339678f30 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -143,6 +143,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 @@ -177,6 +178,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; }