On Tue, 13 Jun 2023 11:44:24 +0200 Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote: > Drivers that can delegate waits to the firmware/GPU pass the scheduled > fence to drm_sched_job_add_dependency(), and issue wait commands to > the firmware/GPU at job submission time. For this to be possible, they > need all their 'native' dependencies to have a valid parent since this > is where the actual HW fence information are encoded. > > In drm_sched_main(), we currently call drm_sched_fence_set_parent() > after drm_sched_fence_set_parent(), leaving a short period of time after drm_sched_fence_scheduled(), ... > during which the job depending on this fence can be submitted. > > Since setting parent and signaling the fence are two things that are > kinda related (you can't have a parent if the job hasn't been scheduled), > it probably makes sense to pass the parent fence to > drm_sched_fence_scheduled() and let it call drm_sched_fence_set_parent() > before it signals the scheduled fence.