On 11/18/26 19:52, 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]>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 17 ++++++++++++++---
>  1 file changed, 14 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..9570db033b18 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -1154,16 +1154,24 @@ 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;
>  
>               f = amdgpu_job_submit(job);
>  
> -             amdgpu_bo_reserve(bo, true);
> -             amdgpu_bo_fence(bo, f, false);
> +             r = dma_resv_reserve_fences(bo->tbo.base.resv, 1);

That line should come before the amdgpu_job_submit().

> +             if (r) {
> +                     dma_fence_wait(f, false);

This way you also don't need that hack here.

Regards,
Christian.

> +                     r = 0;
> +             } else
> +                     dma_resv_add_fence(bo->tbo.base.resv, f, 
> DMA_RESV_USAGE_BOOKKEEP);
>               amdgpu_bo_unreserve(bo);
>       }
>  
> @@ -1173,6 +1181,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