Skip to content

Commit

Permalink
drm/nouveau: wait for moving fence after pinning v2
Browse files Browse the repository at this point in the history
commit 17b11f7 upstream.

We actually need to wait for the moving fence after pinning
the BO to make sure that the pin is completed.

v2: grab the lock while waiting

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
References: https://lore.kernel.org/dri-devel/20210621151758.2347474-1-daniel.vetter@ffwll.ch/
CC: stable@kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20210622114506.106349-1-christian.koenig@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
ChristianKoenigAMD authored and Sasha Levin committed Jun 30, 2021
1 parent 3ef0ca0 commit bcfea24
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_prime.c
Expand Up @@ -111,7 +111,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)
if (ret)
return -EINVAL;

return 0;
ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL);
if (ret)
goto error;

if (nvbo->bo.moving)
ret = dma_fence_wait(nvbo->bo.moving, true);

ttm_bo_unreserve(&nvbo->bo);
if (ret)
goto error;

return ret;

error:
nouveau_bo_unpin(nvbo);
return ret;
}

void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
Expand Down

0 comments on commit bcfea24

Please sign in to comment.