drm/imagination: Move repeated job fence check to its own function

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>
This commit is contained in:
Alessio Belle 2026-03-30 08:56:41 +01:00 committed by Matt Coster
parent 5dae1a21f1
commit 402562e60c
No known key found for this signature in database
GPG Key ID: 79BC19F3D9DE6AB0

View 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);
}
/**