Skip to content

Commit

Permalink
drm/radeon: wait for moving fence after pinning
Browse files Browse the repository at this point in the history
commit 4b41726 upstream.

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

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-2-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 bcfea24 commit 694bb36
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions drivers/gpu/drm/radeon/radeon_prime.c
Expand Up @@ -94,9 +94,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj)

/* pin buffer into GTT */
ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
if (likely(ret == 0))
bo->prime_shared_count++;

if (unlikely(ret))
goto error;

if (bo->tbo.moving) {
ret = dma_fence_wait(bo->tbo.moving, false);
if (unlikely(ret)) {
radeon_bo_unpin(bo);
goto error;
}
}

bo->prime_shared_count++;
error:
radeon_bo_unreserve(bo);
return ret;
}
Expand Down

0 comments on commit 694bb36

Please sign in to comment.