diff mbox series

[v2,5/5] drm/v3d: Use drm_sched_job_add_syncobj_dependency()

Message ID 20230209124447.467867-6-mcanal@igalia.com (mailing list archive)
State New, archived
Headers show
Series drm/sched: Create wrapper to add a syncobj dependency to job | expand

Commit Message

Maíra Canal Feb. 9, 2023, 12:44 p.m. UTC
As v3d_job_add_deps() performs the same steps as
drm_sched_job_add_syncobj_dependency(), replace the open-coded
implementation in v3d in order to simply use the DRM function.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 drivers/gpu/drm/v3d/v3d_gem.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

Comments

Melissa Wen Feb. 10, 2023, 1:48 p.m. UTC | #1
On 02/09, Maíra Canal wrote:
> As v3d_job_add_deps() performs the same steps as
> drm_sched_job_add_syncobj_dependency(), replace the open-coded
> implementation in v3d in order to simply use the DRM function.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>  drivers/gpu/drm/v3d/v3d_gem.c | 22 ++++------------------
>  1 file changed, 4 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
> index 5da1806f3969..24cc65ffb4df 100644
> --- a/drivers/gpu/drm/v3d/v3d_gem.c
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -396,20 +396,6 @@ v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
>  	return ret;
>  }
>  
> -static int
> -v3d_job_add_deps(struct drm_file *file_priv, struct v3d_job *job,
> -		 u32 in_sync, u32 point)
> -{
> -	struct dma_fence *in_fence = NULL;
> -	int ret;
> -
> -	ret = drm_syncobj_find_fence(file_priv, in_sync, point, 0, &in_fence);
> -	if (ret == -EINVAL)
> -		return ret;
> -
> -	return drm_sched_job_add_dependency(&job->base, in_fence);
> -}
> -
>  static int
>  v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
>  	     void **container, size_t size, void (*free)(struct kref *ref),
> @@ -447,14 +433,14 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
>  					DRM_DEBUG("Failed to copy wait dep handle.\n");
>  					goto fail_deps;
>  				}
> -				ret = v3d_job_add_deps(file_priv, job, in.handle, 0);
> -				if (ret)
> +				ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in.handle, 0);
> +				if (ret && ret != -ENOENT)
>  					goto fail_deps;
>  			}
>  		}
>  	} else {
> -		ret = v3d_job_add_deps(file_priv, job, in_sync, 0);
> -		if (ret)
> +		ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in_sync, 0);
> +		if (ret && ret != -ENOENT)
>  			goto fail_deps;
Hi Maíra,

LGTM. Can you add the comment suggested by Christian?

With that, for v3d:

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

Thanks,

Melissa

>  	}
>  
> -- 
> 2.39.1
>
Maíra Canal Feb. 24, 2023, 9:25 p.m. UTC | #2
On 2/9/23 09:44, Maíra Canal wrote:
> As v3d_job_add_deps() performs the same steps as
> drm_sched_job_add_syncobj_dependency(), replace the open-coded
> implementation in v3d in order to simply use the DRM function.
> 
> Signed-off-by: Maíra Canal <mcanal@igalia.com>
> ---
>   drivers/gpu/drm/v3d/v3d_gem.c | 22 ++++------------------
>   1 file changed, 4 insertions(+), 18 deletions(-)
> 

Applied to drm-misc-next.

Best Regards,
- Maíra Canal
diff mbox series

Patch

diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index 5da1806f3969..24cc65ffb4df 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -396,20 +396,6 @@  v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
 	return ret;
 }
 
-static int
-v3d_job_add_deps(struct drm_file *file_priv, struct v3d_job *job,
-		 u32 in_sync, u32 point)
-{
-	struct dma_fence *in_fence = NULL;
-	int ret;
-
-	ret = drm_syncobj_find_fence(file_priv, in_sync, point, 0, &in_fence);
-	if (ret == -EINVAL)
-		return ret;
-
-	return drm_sched_job_add_dependency(&job->base, in_fence);
-}
-
 static int
 v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
 	     void **container, size_t size, void (*free)(struct kref *ref),
@@ -447,14 +433,14 @@  v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
 					DRM_DEBUG("Failed to copy wait dep handle.\n");
 					goto fail_deps;
 				}
-				ret = v3d_job_add_deps(file_priv, job, in.handle, 0);
-				if (ret)
+				ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in.handle, 0);
+				if (ret && ret != -ENOENT)
 					goto fail_deps;
 			}
 		}
 	} else {
-		ret = v3d_job_add_deps(file_priv, job, in_sync, 0);
-		if (ret)
+		ret = drm_sched_job_add_syncobj_dependency(&job->base, file_priv, in_sync, 0);
+		if (ret && ret != -ENOENT)
 			goto fail_deps;
 	}