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, ¤t);
+ nouveau_fence_wait(current);
+ nouveau_fence_ref(NULL, ¤t);
+ nouveau_fence_ref(NULL, &screen->base.fence.current);
}
nouveau_object_del(&screen->query);
return;
if (screen->base.fence.current) {
- nouveau_fence_wait(screen->base.fence.current);
- nouveau_fence_ref (NULL, &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, ¤t);
+ nouveau_fence_wait(current);
+ nouveau_fence_ref(NULL, ¤t);
+ nouveau_fence_ref(NULL, &screen->base.fence.current);
}
if (screen->base.pushbuf)
screen->base.pushbuf->user_priv = NULL;
return;
if (screen->base.fence.current) {
- nouveau_fence_wait(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, ¤t);
+ nouveau_fence_wait(current);
+ nouveau_fence_ref(NULL, ¤t);
nouveau_fence_ref(NULL, &screen->base.fence.current);
}
if (screen->base.pushbuf)