Mesa (staging/21.2): panfrost: Maintain a bitmap of active batches

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 26 17:46:44 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 6b788b887048ad4ca763d4adae771060819e84ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b788b887048ad4ca763d4adae771060819e84ab

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Aug 17 16:39:40 2021 +0000

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 at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12528>
(cherry picked from commit 79dd1a4e634ffd735323da7111f00e9dbda6a354)

---

 .pick_status.json                          | 2 +-
 src/gallium/drivers/panfrost/pan_context.h | 3 +++
 src/gallium/drivers/panfrost/pan_job.c     | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 70c711a3447..cccd0e8220b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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
     },
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 4079c3fee45..41f013c66c8 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 9d20a799a7a..6606656d495 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -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;
 }
 



More information about the mesa-commit mailing list