summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nouveau/nv30
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/nouveau/nv30')
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_screen.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 82f2c069467..5378913884f 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -308,10 +308,16 @@ nv30_screen_destroy(struct pipe_screen *pscreen)
if (!nouveau_drm_screen_unref(&screen->base))
return;
- if (screen->base.fence.current &&
- screen->base.fence.current->state >= NOUVEAU_FENCE_STATE_EMITTED) {
- nouveau_fence_wait(screen->base.fence.current);
- nouveau_fence_ref (NULL, &screen->base.fence.current);
+ if (screen->base.fence.current) {
+ struct nouveau_fence *current = NULL;
+
+ /* nouveau_fence_wait will create a new current fence, so wait on the
+ * _current_ one, and remove both.
+ */
+ nouveau_fence_ref(screen->base.fence.current, &current);
+ nouveau_fence_wait(current);
+ nouveau_fence_ref(NULL, &current);
+ nouveau_fence_ref(NULL, &screen->base.fence.current);
}
nouveau_object_del(&screen->query);