summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/freedreno_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_resource.c')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_resource.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 0e0305885a7..a091f5f1774 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -516,12 +516,18 @@ fd_resource_transfer_map(struct pipe_context *pctx,
if (needs_flush) {
if (usage & PIPE_TRANSFER_WRITE) {
- struct fd_batch *batch;
- foreach_batch(batch, &ctx->screen->batch_cache, rsc->batch_mask)
- fd_batch_flush(batch);
+ struct fd_batch *batch, *last_batch = NULL;
+ foreach_batch(batch, &ctx->screen->batch_cache, rsc->batch_mask) {
+ fd_batch_reference(&last_batch, batch);
+ fd_batch_flush(batch, false);
+ }
+ if (last_batch) {
+ fd_batch_sync(last_batch);
+ fd_batch_reference(&last_batch, NULL);
+ }
assert(rsc->batch_mask == 0);
} else {
- fd_batch_flush(rsc->write_batch);
+ fd_batch_flush(rsc->write_batch, true);
}
assert(!rsc->write_batch);
}
@@ -1080,7 +1086,7 @@ fd_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
struct fd_resource *rsc = fd_resource(prsc);
if (rsc->write_batch)
- fd_batch_flush(rsc->write_batch);
+ fd_batch_flush(rsc->write_batch, true);
assert(!rsc->write_batch);
}