Mesa (main): panfrost: Avoid duplicate entries in access->readers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 17 17:12:16 UTC 2021
Module: Mesa
Branch: main
Commit: 82571f977ae0cf927f65df85e683a211cf7b077e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=82571f977ae0cf927f65df85e683a211cf7b077e
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Wed May 12 13:24:03 2021 +0200
panfrost: Avoid duplicate entries in access->readers
The PAN_BATCH_DEBUG section was too wide, potentially leading to
double insertion of the same batch in the readers array. Let's get rid
of this already_accessed parameter and make sure
panfrost_batch_update_bo_access() is only called if the RW flags have
changed.
Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10842>
---
src/gallium/drivers/panfrost/pan_job.c | 37 ++++++++--------------------------
1 file changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index d61567d28fe..5096a836cc4 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -397,25 +397,9 @@ panfrost_gc_fences(struct panfrost_context *ctx)
}
}
-#ifdef PAN_BATCH_DEBUG
-static bool
-panfrost_batch_in_readers(struct panfrost_batch *batch,
- struct panfrost_bo_access *access)
-{
- util_dynarray_foreach(&access->readers, struct panfrost_batch_fence *,
- reader) {
- if (*reader && (*reader)->batch == batch)
- return true;
- }
-
- return false;
-}
-#endif
-
static void
panfrost_batch_update_bo_access(struct panfrost_batch *batch,
- struct panfrost_bo *bo, bool writes,
- bool already_accessed)
+ struct panfrost_bo *bo, bool writes)
{
struct panfrost_context *ctx = batch->ctx;
struct panfrost_bo_access *access;
@@ -507,16 +491,6 @@ panfrost_batch_update_bo_access(struct panfrost_batch *batch,
batch->out_sync);
}
} else {
- /* We already accessed this BO before, so we should already be
- * in the reader array.
- */
-#ifdef PAN_BATCH_DEBUG
- if (already_accessed) {
- assert(panfrost_batch_in_readers(batch, access));
- return;
- }
-#endif
-
/* Previous access was a read and we want to read this BO.
* Add ourselves to the readers array and add a dependency on
* the previous writer if any.
@@ -570,9 +544,14 @@ panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo,
if (!(flags & PAN_BO_ACCESS_SHARED))
return;
+ /* RW flags didn't change since our last access, no need to update the
+ * BO access entry.
+ */
+ if ((old_flags & PAN_BO_ACCESS_RW) == (flags & PAN_BO_ACCESS_RW))
+ return;
+
assert(flags & PAN_BO_ACCESS_RW);
- panfrost_batch_update_bo_access(batch, bo, flags & PAN_BO_ACCESS_WRITE,
- old_flags != 0);
+ panfrost_batch_update_bo_access(batch, bo, flags & PAN_BO_ACCESS_WRITE);
}
static void
More information about the mesa-commit
mailing list