Commit 223583dd authored by Melissa Wen's avatar Melissa Wen Committed by Melissa Wen
Browse files

drm/v3d: decouple adding job dependencies steps from job init



Prep work to enable a job to wait for more than one syncobj before
start. Also get rid of old checkpatch warnings in the v3d_gem file.
No functional changes.

Signed-off-by: default avatarMelissa Wen <mwen@igalia.com>
Reviewed-by: default avatarIago Toral Quiroga <itoral@igalia.com>
Signed-off-by: default avatarMelissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/825f5fdd540b0aa2eb57bd5ff93c0777808b108c.1633016479.git.mwen@igalia.com
parent 77d40e01
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -434,12 +434,25 @@ 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,
	     struct v3d_job *job, void (*free)(struct kref *ref),
	     u32 in_sync, enum v3d_queue queue)
{
	struct dma_fence *in_fence = NULL;
	struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
	int ret;

@@ -455,11 +468,7 @@ v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
	if (ret)
		goto fail;

	ret = drm_syncobj_find_fence(file_priv, in_sync, 0, 0, &in_fence);
	if (ret == -EINVAL)
		goto fail_job;

	ret = drm_sched_job_add_dependency(&job->base, in_fence);
	ret = v3d_job_add_deps(file_priv, job, in_sync, 0);
	if (ret)
		goto fail_job;

@@ -903,8 +912,7 @@ v3d_gem_init(struct drm_device *dev)
	if (!v3d->pt) {
		drm_mm_takedown(&v3d->mm);
		dev_err(v3d->drm.dev,
			"Failed to allocate page tables. "
			"Please ensure you have CMA enabled.\n");
			"Failed to allocate page tables. Please ensure you have CMA enabled.\n");
		return -ENOMEM;
	}