summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nouveau_buffer.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-09-25 19:05:14 -0400
committerIlia Mirkin <[email protected]>2015-09-28 17:28:54 -0400
commit3a6b9a7830c3df14ffcfbbf57c82ea08bd59ef04 (patch)
tree22ecc2cef25ca36e696c64f0f4c528c600d8b58c /src/gallium/drivers/nouveau/nouveau_buffer.c
parentd4e650b07bc80075f0d088e7d85df9efa45e11bd (diff)
nouveau: delay deleting buffer with unflushed fence
If there is an unflushed fence on the bo, then the resource may still be used in commands built up in the local pushbuf. Flushing can cause all sorts of unwanted effects, so just free the bo when the relevant fence is hit. Signed-off-by: Ilia Mirkin <[email protected]> Cc: [email protected] Tested-by: Marcin Ĺšlusarz <[email protected]>
Diffstat (limited to 'src/gallium/drivers/nouveau/nouveau_buffer.c')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 4937dae8b06..310e9dbcfd4 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -80,7 +80,12 @@ release_allocation(struct nouveau_mm_allocation **mm,
inline void
nouveau_buffer_release_gpu_storage(struct nv04_resource *buf)
{
- nouveau_bo_ref(NULL, &buf->bo);
+ if (buf->fence && buf->fence->state < NOUVEAU_FENCE_STATE_FLUSHED) {
+ nouveau_fence_work(buf->fence, nouveau_fence_unref_bo, buf->bo);
+ buf->bo = NULL;
+ } else {
+ nouveau_bo_ref(NULL, &buf->bo);
+ }
if (buf->mm)
release_allocation(&buf->mm, buf->fence);