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>
This commit is contained in:
Boris Brezillon
2021-05-12 13:24:03 +02:00
committed by Marge Bot
parent 3c684d10be
commit 82571f977a
+8 -29
View File
@@ -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