summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/freedreno/freedreno_batch.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c
index e44e8e5403e..9918c259e48 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch.c
@@ -405,6 +405,19 @@ fd_batch_resource_used(struct fd_batch *batch, struct fd_resource *rsc, bool wri
if (rsc->batch_mask != (1 << batch->idx)) {
struct fd_batch_cache *cache = &batch->ctx->screen->batch_cache;
struct fd_batch *dep;
+
+ if (rsc->write_batch && rsc->write_batch != batch) {
+ struct fd_batch *b = NULL;
+ fd_batch_reference(&b, rsc->write_batch);
+
+ mtx_unlock(&batch->ctx->screen->lock);
+ fd_batch_flush(b, true, false);
+ mtx_lock(&batch->ctx->screen->lock);
+
+ fd_bc_invalidate_batch(b, false);
+ fd_batch_reference_locked(&b, NULL);
+ }
+
foreach_batch(dep, cache, rsc->batch_mask) {
struct fd_batch *b = NULL;
if (dep == batch)