[PATCH 7/8] drm/imagination: Update check to skip prepare_job() for fragment jobs

Alessio Belle
2026-03-30T07:57:33Z

By the time prepare_job() is called on a paired fragment job, the paired
geometry job might already be finished and its PM reference dropped.

Check the fragment job's PM reference instead which is a bit more likely
to be still set. This is a very minor optimization.

Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
---
drivers/gpu/drm/imagination/pvr_queue.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c
index 4a49d954562e..303f4d6cc09e 100644
--- a/drivers/gpu/drm/imagination/pvr_queue.c
+++ b/drivers/gpu/drm/imagination/pvr_queue.c
@@ -553,12 +553,13 @@ pvr_queue_prepare_job(struct drm_sched_job *sched_job,

if (job->type == DRM_PVR_JOB_TYPE_FRAGMENT && job->paired_job) {
/*
- * This will be called on a paired fragment job after being
- * submitted to firmware. We can tell if this is the case and
- * bail early from whether run_job() has been called on the
- * geometry job, which would issue a pm ref.
+ * This will be called on a paired fragment job after being submitted
+ * to the firmware as part of the paired geometry job's submission.
+ * We can tell if this is the case and bail early from whether run_job()
+ * has been called on the geometry job, which would issue a pm ref on
+ * this job as well.
*/
- if (job->paired_job->has_pm_ref)
+ if (job->has_pm_ref)
return NULL;
}

--
2.43.0