Re: [PATCH 1/3] drm/nouveau: wait for moving fence after pinning v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 22, 2021 at 1:45 PM Christian König
<ckoenig.leichtzumerken@xxxxxxxxx> wrote:
>
> 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@xxxxxxx>
> References: https://lore.kernel.org/dri-devel/20210621151758.2347474-1-daniel.vetter@xxxxxxxx/
> CC: stable@xxxxxxxxxx

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/nouveau/nouveau_prime.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
> index 347488685f74..60019d0532fc 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_prime.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
> @@ -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)
> --
> 2.25.1
>


-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux