summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-07-17 09:42:27 -0400
committerRob Clark <[email protected]>2018-07-17 11:00:00 -0400
commitd77fcdeb5904ac1324d9445f775fdf5c6af95b84 (patch)
tree352c3cf38785490007bc4a78bd8522295cef029a /src/gallium/drivers/freedreno
parentf2570409f90e18c290beb7375107aa4862bd1019 (diff)
freedreno: comment for _invalidate_batch()
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch_cache.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index c4640a7cfee..804a73664f7 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -199,8 +199,18 @@ fd_bc_invalidate_context(struct fd_context *ctx)
mtx_unlock(&ctx->screen->lock);
}
+/**
+ * Note that when batch is flushed, it needs to remain in the cache so
+ * that fd_bc_invalidate_resource() can work.. otherwise we can have
+ * the case where a rsc is destroyed while a batch still has a dangling
+ * reference to it.
+ *
+ * Note that the cmdstream (or, after the SUBMIT ioctl, the kernel)
+ * would have a reference to the underlying bo, so it is ok for the
+ * rsc to be destroyed before the batch.
+ */
void
-fd_bc_invalidate_batch(struct fd_batch *batch, bool destroy)
+fd_bc_invalidate_batch(struct fd_batch *batch, bool remove)
{
if (!batch)
return;
@@ -208,9 +218,9 @@ fd_bc_invalidate_batch(struct fd_batch *batch, bool destroy)
struct fd_batch_cache *cache = &batch->ctx->screen->batch_cache;
struct key *key = (struct key *)batch->key;
- pipe_mutex_assert_locked(batch->ctx->screen->lock);
+ fd_context_assert_locked(batch->ctx);
- if (destroy) {
+ if (remove) {
cache->batches[batch->idx] = NULL;
cache->batch_mask &= ~(1 << batch->idx);
}