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
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 <[email protected]>
Reviewed-by: Daniel Vetter <[email protected]>
References: https://lore.kernel.org/dri-devel/[email protected]/
CC: [email protected]
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
ChristianKoenigAMD committed Jun 22, 2021
1 parent f54b3ca commit 17b11f7
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/gpu/drm/nouveau/nouveau_prime.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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 17b11f7

Please sign in to comment.