|
@@ -717,6 +717,9 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
|
|
|
}
|
|
|
|
|
|
mutex_lock(&cli->mutex);
|
|
|
+ ret = ttm_bo_reserve(&new_bo->bo, true, false, false, NULL);
|
|
|
+ if (ret)
|
|
|
+ goto fail_unpin;
|
|
|
|
|
|
/* synchronise rendering channel with the kernel's channel */
|
|
|
spin_lock(&new_bo->bo.bdev->fence_lock);
|
|
@@ -724,12 +727,18 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
|
|
|
spin_unlock(&new_bo->bo.bdev->fence_lock);
|
|
|
ret = nouveau_fence_sync(fence, chan);
|
|
|
nouveau_fence_unref(&fence);
|
|
|
- if (ret)
|
|
|
+ if (ret) {
|
|
|
+ ttm_bo_unreserve(&new_bo->bo);
|
|
|
goto fail_unpin;
|
|
|
+ }
|
|
|
|
|
|
- ret = ttm_bo_reserve(&old_bo->bo, true, false, false, NULL);
|
|
|
- if (ret)
|
|
|
- goto fail_unpin;
|
|
|
+ if (new_bo != old_bo) {
|
|
|
+ ttm_bo_unreserve(&new_bo->bo);
|
|
|
+
|
|
|
+ ret = ttm_bo_reserve(&old_bo->bo, true, false, false, NULL);
|
|
|
+ if (ret)
|
|
|
+ goto fail_unpin;
|
|
|
+ }
|
|
|
|
|
|
/* Initialize a page flip struct */
|
|
|
*s = (struct nouveau_page_flip_state)
|