summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2021-05-12 13:24:03 +0200
committerMarge Bot <eric+marge@anholt.net>2021-05-17 16:55:03 +0000
commit82571f977ae0cf927f65df85e683a211cf7b077e (patch)
treeaffa8d0acffac5dd7a40ad13040ca50aec319093
parent3c684d10be87467f06d9b73c4f9ccb2cce154dee (diff)
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@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10842>
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c37
1 files 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