Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Add xe_exec_queue_last_fence_test_dep

Helpful to determine if a bind can immediately use CPU or needs to be
deferred a drm scheduler job.

v7:
- Better wording in kernel doc (Matthew Auld)

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240704041652.272920-4-matthew.brost@intel.com

+25
+23
drivers/gpu/drm/xe/xe_exec_queue.c
··· 906 906 xe_exec_queue_last_fence_put(q, vm); 907 907 q->last_fence = dma_fence_get(fence); 908 908 } 909 + 910 + /** 911 + * xe_exec_queue_last_fence_test_dep - Test last fence dependency of queue 912 + * @q: The exec queue 913 + * @vm: The VM the engine does a bind or exec for 914 + * 915 + * Returns: 916 + * -ETIME if there exists an unsignalled last fence dependency, zero otherwise. 917 + */ 918 + int xe_exec_queue_last_fence_test_dep(struct xe_exec_queue *q, struct xe_vm *vm) 919 + { 920 + struct dma_fence *fence; 921 + int err = 0; 922 + 923 + fence = xe_exec_queue_last_fence_get(q, vm); 924 + if (fence) { 925 + err = test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) ? 926 + 0 : -ETIME; 927 + dma_fence_put(fence); 928 + } 929 + 930 + return err; 931 + }
+2
drivers/gpu/drm/xe/xe_exec_queue.h
··· 75 75 struct xe_vm *vm); 76 76 void xe_exec_queue_last_fence_set(struct xe_exec_queue *e, struct xe_vm *vm, 77 77 struct dma_fence *fence); 78 + int xe_exec_queue_last_fence_test_dep(struct xe_exec_queue *q, 79 + struct xe_vm *vm); 78 80 void xe_exec_queue_update_run_ticks(struct xe_exec_queue *q); 79 81 80 82 #endif