[PATCH] drm/v3d: replace open-coded implementation of drm_gem_object_lookup

Melissa Wen mwen at igalia.com
Wed Dec 28 14:35:09 UTC 2022


On 12/27, Maíra Canal wrote:
> As v3d_submit_tfu_ioctl() performs the same steps as drm_gem_object_lookup(),
> replace the open-code implementation in v3d with its DRM core equivalent.
> 
> Signed-off-by: Maíra Canal <mcanal at igalia.com>
> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> index 6e152ef26358..5da1806f3969 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -861,7 +861,6 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data,
>  
>  	job->args = *args;
>  
> -	spin_lock(&file_priv->table_lock);
>  	for (job->base.bo_count = 0;
>  	     job->base.bo_count < ARRAY_SIZE(args->bo_handles);
>  	     job->base.bo_count++) {
> @@ -870,20 +869,16 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data,
>  		if (!args->bo_handles[job->base.bo_count])
>  			break;
>  
> -		bo = idr_find(&file_priv->object_idr,
> -			      args->bo_handles[job->base.bo_count]);
> +		bo = drm_gem_object_lookup(file_priv, args->bo_handles[job->base.bo_count]);
>  		if (!bo) {
>  			DRM_DEBUG("Failed to look up GEM BO %d: %d\n",
>  				  job->base.bo_count,
>  				  args->bo_handles[job->base.bo_count]);
>  			ret = -ENOENT;
> -			spin_unlock(&file_priv->table_lock);
>  			goto fail;
>  		}
> -		drm_gem_object_get(bo);
>  		job->base.bo[job->base.bo_count] = bo;
>  	}
> -	spin_unlock(&file_priv->table_lock);

Hi Maíra,

Thanks for you patch.

LGTM

Reviewed-by: Melissa Wen <mwen at igalia.com>

>  
>  	ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx);
>  	if (ret)
> -- 
> 2.38.1
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221228/4aa1996f/attachment-0001.sig>


More information about the dri-devel mailing list