nouveau: reinstate fencing on screen destroy

As it turns out, the wait is required as the driver expects for
rendering to be quiesced on exit. This can trigger channel failures,
which in turn trigger recovery. This can fail and destroy the whole
system.

Fixes: 28a781323f ("nouveau: change fence destruction logic on screen destroy")
References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4223
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8867>
This commit is contained in:
Ilia Mirkin 2021-02-04 12:15:43 -05:00 committed by Marge Bot
parent 0464117ad9
commit 92f12952f3

View file

@ -111,17 +111,15 @@ nouveau_fence_del(struct nouveau_fence *fence)
void
nouveau_fence_cleanup(struct nouveau_screen *screen)
{
struct nouveau_fence *fence, *next;
for (fence = screen->fence.head; fence; fence = next) {
next = fence->next;
nouveau_fence_trigger_work(fence);
nouveau_fence_ref(NULL, &fence);
}
screen->fence.head = NULL;
screen->fence.tail = NULL;
if (screen->fence.current) {
nouveau_fence_trigger_work(screen->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->fence.current, &current);
nouveau_fence_wait(current, NULL);
nouveau_fence_ref(NULL, &current);
nouveau_fence_ref(NULL, &screen->fence.current);
}
}