summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2013-11-29 18:49:44 -0500
committerIan Romanick <ian.d.romanick@intel.com>2013-12-06 10:51:45 -0800
commit05d2a796a0a1c198b9123394d49b7b6407853c14 (patch)
tree7abbabf3d418d0624c2daf90b42e0d3cc7b7fc5d /src/gallium
parentde517d2bb38c62a6814c3c624cbcca942f8f13af (diff)
nouveau: avoid leaking fences while waiting
This fixes a memory leak in some situations. Also avoids emitting an extra fence if the kick handler does the call to nouveau_fence_next itself. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "9.2 10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit ce6dd69697ae62d9336bbd4f5808bc4d75cdcc04)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/nouveau/nouveau_fence.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
index dea146ce65f..c6867104adb 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -189,16 +189,15 @@ nouveau_fence_wait(struct nouveau_fence *fence)
/* wtf, someone is waiting on a fence in flush_notify handler? */
assert(fence->state != NOUVEAU_FENCE_STATE_EMITTING);
- if (fence->state < NOUVEAU_FENCE_STATE_EMITTED) {
+ if (fence->state < NOUVEAU_FENCE_STATE_EMITTED)
nouveau_fence_emit(fence);
- if (fence == screen->fence.current)
- nouveau_fence_new(screen, &screen->fence.current, FALSE);
- }
- if (fence->state < NOUVEAU_FENCE_STATE_FLUSHED) {
+ if (fence->state < NOUVEAU_FENCE_STATE_FLUSHED)
if (nouveau_pushbuf_kick(screen->pushbuf, screen->pushbuf->channel))
return FALSE;
- }
+
+ if (fence == screen->fence.current)
+ nouveau_fence_next(screen);
do {
nouveau_fence_update(screen, FALSE);