]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/imagination: Move repeated job fence check to its own function
authorAlessio Belle <alessio.belle@imgtec.com>
Mon, 30 Mar 2026 07:56:41 +0000 (08:56 +0100)
committerMatt Coster <matt.coster@imgtec.com>
Wed, 8 Apr 2026 10:17:14 +0000 (11:17 +0100)
This should make the code slightly clearer.

Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
Reviewed-by: Brajesh Gupta <brajesh.gupta@imgtec.com>
Link: https://patch.msgid.link/20260330-job-submission-fixes-cleanup-v1-6-7de8c09cef8c@imgtec.com
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
drivers/gpu/drm/imagination/pvr_queue.c

index df0a110ed96fe3d12594967d2c7ba14204205e30..4a49d954562e02c6a94bf978aa6e3cab6d471c05 100644 (file)
@@ -177,6 +177,24 @@ static const struct dma_fence_ops pvr_queue_job_fence_ops = {
        .release = pvr_queue_fence_release,
 };
 
+/**
+ * pvr_queue_fence_is_ufo_backed() - Check if a dma_fence is backed by a UFO.
+ * @f: The dma_fence to check.
+ *
+ * Return:
+ * * true if the dma_fence is backed by a UFO, or
+ * * false otherwise.
+ */
+static inline bool
+pvr_queue_fence_is_ufo_backed(struct dma_fence *f)
+{
+       /*
+        * Currently the only dma_fence backed by a UFO object is the job fence,
+        * e.g. pvr_job::done_fence, wrapped by a pvr_queue_fence object.
+        */
+       return f && f->ops == &pvr_queue_job_fence_ops;
+}
+
 /**
  * to_pvr_queue_job_fence() - Return a pvr_queue_fence object if the fence is
  * already backed by a UFO.
@@ -194,7 +212,7 @@ to_pvr_queue_job_fence(struct dma_fence *f)
        if (sched_fence)
                f = sched_fence->parent;
 
-       if (f && f->ops == &pvr_queue_job_fence_ops)
+       if (pvr_queue_fence_is_ufo_backed(f))
                return container_of(f, struct pvr_queue_fence, base);
 
        return NULL;
@@ -915,10 +933,7 @@ bool pvr_queue_fence_is_native(struct dma_fence *f)
            sched_fence->sched->ops == &pvr_queue_sched_ops)
                return true;
 
-       if (f && f->ops == &pvr_queue_job_fence_ops)
-               return true;
-
-       return false;
+       return pvr_queue_fence_is_ufo_backed(f);
 }
 
 /**