summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau/nv30/nv30_miptree.c')
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_miptree.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
index 735c718c4b3..c6f69650068 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
@@ -339,10 +339,15 @@ nv30_miptree_transfer_unmap(struct pipe_context *pipe,
struct nv30_context *nv30 = nv30_context(pipe);
struct nv30_transfer *tx = nv30_transfer(ptx);
- if (ptx->usage & PIPE_TRANSFER_WRITE)
+ if (ptx->usage & PIPE_TRANSFER_WRITE) {
nv30_transfer_rect(nv30, NEAREST, &tx->tmp, &tx->img);
- nouveau_bo_ref(NULL, &tx->tmp.bo);
+ /* Allow the copies above to finish executing before freeing the source */
+ nouveau_fence_work(nv30->screen->base.fence.current,
+ nouveau_fence_unref_bo, tx->tmp.bo);
+ } else {
+ nouveau_bo_ref(NULL, &tx->tmp.bo);
+ }
pipe_resource_reference(&ptx->resource, NULL);
FREE(tx);
}