Skip to content

Commit a667cf5

Browse files
matt-auldrodrigovivi
authored andcommitted
drm/xe/bo: consider dma-resv fences for clear job
There could be active fences already in the dma-resv for the object prior to clearing. Make sure to input them as dependencies for the clear job. v2 (Matt B): - We can use USAGE_KERNEL here, since it's only the move fences we care about here. Also add a comment. Signed-off-by: Matthew Auld <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Matthew Brost <[email protected]> Reviewed-by: Thomas Hellström <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 4202dd9 commit a667cf5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,8 +980,6 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
980980

981981
size -= clear_L0;
982982

983-
/* TODO: Add dependencies here */
984-
985983
/* Preemption is enabled again by the ring ops. */
986984
if (!clear_vram) {
987985
emit_pte(m, bb, clear_L0_pt, clear_vram, &src_it, clear_L0,
@@ -1010,6 +1008,18 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
10101008
}
10111009

10121010
xe_sched_job_add_migrate_flush(job, flush_flags);
1011+
if (!fence) {
1012+
/*
1013+
* There can't be anything userspace related at this
1014+
* point, so we just need to respect any potential move
1015+
* fences, which are always tracked as
1016+
* DMA_RESV_USAGE_KERNEL.
1017+
*/
1018+
err = job_add_deps(job, bo->ttm.base.resv,
1019+
DMA_RESV_USAGE_KERNEL);
1020+
if (err)
1021+
goto err_job;
1022+
}
10131023

10141024
xe_sched_job_arm(job);
10151025
dma_fence_put(fence);
@@ -1024,6 +1034,8 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m,
10241034
xe_bb_free(bb, fence);
10251035
continue;
10261036

1037+
err_job:
1038+
xe_sched_job_put(job);
10271039
err:
10281040
mutex_unlock(&m->job_mutex);
10291041
xe_bb_free(bb, NULL);

0 commit comments

Comments
 (0)