Skip to content

Commit 223583d

Browse files
committed
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: Melissa Wen <mwen@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/825f5fdd540b0aa2eb57bd5ff93c0777808b108c.1633016479.git.mwen@igalia.com
1 parent 77d40e0 commit 223583d

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

‎drivers/gpu/drm/v3d/v3d_gem.c‎

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
416416
return -EINVAL;
417417

418418
ret = drm_gem_dma_resv_wait(file_priv, args->handle,
419-
true, timeout_jiffies);
419+
true, timeout_jiffies);
420420

421421
/* Decrement the user's timeout, in case we got interrupted
422422
* such that the ioctl will be restarted.
@@ -434,12 +434,25 @@ v3d_wait_bo_ioctl(struct drm_device *dev, void *data,
434434
return ret;
435435
}
436436

437+
static int
438+
v3d_job_add_deps(struct drm_file *file_priv, struct v3d_job *job,
439+
u32 in_sync, u32 point)
440+
{
441+
struct dma_fence *in_fence = NULL;
442+
int ret;
443+
444+
ret = drm_syncobj_find_fence(file_priv, in_sync, point, 0, &in_fence);
445+
if (ret == -EINVAL)
446+
return ret;
447+
448+
return drm_sched_job_add_dependency(&job->base, in_fence);
449+
}
450+
437451
static int
438452
v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
439453
struct v3d_job *job, void (*free)(struct kref *ref),
440454
u32 in_sync, enum v3d_queue queue)
441455
{
442-
struct dma_fence *in_fence = NULL;
443456
struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
444457
int ret;
445458

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

458-
ret = drm_syncobj_find_fence(file_priv, in_sync, 0, 0, &in_fence);
459-
if (ret == -EINVAL)
460-
goto fail_job;
461-
462-
ret = drm_sched_job_add_dependency(&job->base, in_fence);
471+
ret = v3d_job_add_deps(file_priv, job, in_sync, 0);
463472
if (ret)
464473
goto fail_job;
465474

@@ -499,7 +508,7 @@ v3d_attach_fences_and_unlock_reservation(struct drm_file *file_priv,
499508
for (i = 0; i < job->bo_count; i++) {
500509
/* XXX: Use shared fences for read-only objects. */
501510
dma_resv_add_excl_fence(job->bo[i]->resv,
502-
job->done_fence);
511+
job->done_fence);
503512
}
504513

505514
drm_gem_unlock_reservations(job->bo, job->bo_count, acquire_ctx);
@@ -903,8 +912,7 @@ v3d_gem_init(struct drm_device *dev)
903912
if (!v3d->pt) {
904913
drm_mm_takedown(&v3d->mm);
905914
dev_err(v3d->drm.dev,
906-
"Failed to allocate page tables. "
907-
"Please ensure you have CMA enabled.\n");
915+
"Failed to allocate page tables. Please ensure you have CMA enabled.\n");
908916
return -ENOMEM;
909917
}
910918

0 commit comments

Comments
 (0)