Am Donnerstag, dem 24.06.2021 um 16:00 +0200 schrieb Daniel Vetter: > This is essentially part of drm_sched_dependency_optimized(), which > only amdgpu seems to make use of. Use it a bit more. > > Signed-off-by: Daniel Vetter <daniel.vet...@intel.com>
Reviewed-by: Lucas Stach <l.st...@pengutronix.de> > Cc: "Christian König" <christian.koe...@amd.com> > Cc: Daniel Vetter <daniel.vet...@ffwll.ch> > Cc: Luben Tuikov <luben.tui...@amd.com> > Cc: Andrey Grodzovsky <andrey.grodzov...@amd.com> > Cc: Alex Deucher <alexander.deuc...@amd.com> > Cc: Jack Zhang <jack.zha...@amd.com> > --- > drivers/gpu/drm/scheduler/sched_main.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/gpu/drm/scheduler/sched_main.c > b/drivers/gpu/drm/scheduler/sched_main.c > index 370c336d383f..c31d7cf7df74 100644 > --- a/drivers/gpu/drm/scheduler/sched_main.c > +++ b/drivers/gpu/drm/scheduler/sched_main.c > @@ -649,6 +649,13 @@ int drm_sched_job_await_fence(struct drm_sched_job *job, > if (!fence) > return 0; > > + /* if it's a fence from us it's guaranteed to be earlier */ > + if (fence->context == job->entity->fence_context || > + fence->context == job->entity->fence_context + 1) { > + dma_fence_put(fence); > + return 0; > + } > + > /* Deduplicate if we already depend on a fence from the same context. > * This lets the size of the array of deps scale with the number of > * engines involved, rather than the number of BOs.