diff mbox series

drm/v3d: replace open-coded implementation of drm_gem_object_lookup

Message ID 20221227200010.191351-1-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/v3d: replace open-coded implementation of drm_gem_object_lookup | expand

Commit Message

Maíra Canal Dec. 27, 2022, 8 p.m. UTC
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@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_gem.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Melissa Wen Dec. 28, 2022, 2:35 p.m. UTC | #1
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@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@igalia.com>

>  
>  	ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx);
>  	if (ret)
> -- 
> 2.38.1
>
Melissa Wen Jan. 3, 2023, 7:20 p.m. UTC | #2
On 12/28, Melissa Wen wrote:
> 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@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@igalia.com>

Applied to drm-misc-next.

Thanks,

Melissa
> 
> >  
> >  	ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx);
> >  	if (ret)
> > -- 
> > 2.38.1
> >
diff mbox series

Patch

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);
 
 	ret = v3d_lock_bo_reservations(&job->base, &acquire_ctx);
 	if (ret)