On 11/19/26 15:40, Benjamin Cheng wrote:
> This helper is deprecated since it is incorrect in most circumstances.
> This was a circumstance where it was mostly correct but it is the only
> remaining usage, so get rid of it here.
> 
> Signed-off-by: Benjamin Cheng <[email protected]>

Reviewed-by: Christian König <[email protected]>

> ---
> v3:
> - Moved the reserve_fences call above submit (Christian)
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index d88dde859615..1d9a18203d39 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -1154,16 +1154,27 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring 
> *ring, struct amdgpu_bo *bo,
>               if (r)
>                       goto err_free;
>       } else {
> +             r = amdgpu_bo_reserve(bo, true);
> +             if (r)
> +                     goto err_free;
> +
>               r = drm_sched_job_add_resv_dependencies(&job->base,
>                                                       bo->tbo.base.resv,
>                                                       DMA_RESV_USAGE_KERNEL);
>               if (r)
> -                     goto err_free;
> +                     goto err_unreserve;
> +
> +             r = dma_resv_reserve_fences(bo->tbo.base.resv, 1);
>  
>               f = amdgpu_job_submit(job);
>  
> -             amdgpu_bo_reserve(bo, true);
> -             amdgpu_bo_fence(bo, f, false);
> +             if (r) {
> +                     dma_fence_wait(f, false);
> +                     r = 0;
> +             } else {
> +                     dma_resv_add_fence(bo->tbo.base.resv, f,
> +                                        DMA_RESV_USAGE_BOOKKEEP);
> +             }
>               amdgpu_bo_unreserve(bo);
>       }
>  
> @@ -1173,6 +1184,9 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring 
> *ring, struct amdgpu_bo *bo,
>  
>       return 0;
>  
> +err_unreserve:
> +     amdgpu_bo_unreserve(bo);
> +
>  err_free:
>       amdgpu_job_free(job);
>       return r;

Reply via email to