[RFC PATCH 4/6] drm/sched: Teach scheduler about dma_fence_prempt type

Matthew Brost matthew.brost at intel.com
Sat Nov 9 17:29:40 UTC 2024


Update drm_sched_job_add_dependency to detect dma_fence_preempt and
correctly store it in the dedicated preemptive fence xarray ensuring
preempt fence semantics are followed.

Cc: Philipp Stanner <pstanner at redhat.com>
Cc: Danilo Krummrich <dakr at kernel.org>
Cc: Luben Tuikov <ltuikov89 at gmail.com>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Simona Vetter <simona.vetter at ffwll.ch>
Cc: Christian Koenig <christian.koenig at amd.com>
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
 drivers/gpu/drm/scheduler/sched_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index eceb9b8c6f5f..607722364876 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -76,6 +76,7 @@
 #include <linux/sched.h>
 #include <linux/completion.h>
 #include <linux/dma-resv.h>
+#include <linux/dma-fence-preempt.h>
 #include <uapi/linux/sched/types.h>
 
 #include <drm/drm_print.h>
@@ -916,7 +917,8 @@ static int __drm_sched_job_add_dependency(struct drm_sched_job *job,
 int drm_sched_job_add_dependency(struct drm_sched_job *job,
 				 struct dma_fence *fence)
 {
-	return __drm_sched_job_add_dependency(job, fence, false);
+	return __drm_sched_job_add_dependency(job, fence,
+					      dma_fence_is_preempt(fence));
 }
 EXPORT_SYMBOL(drm_sched_job_add_dependency);
 
-- 
2.34.1



More information about the dri-devel mailing list