[PATCH v6 3/7] drm/xe: Add xe_exec_queue_last_fence_test_dep
Matthew Auld
matthew.auld at intel.com
Thu Jun 27 16:36:42 UTC 2024
On 26/06/2024 22:15, Matthew Brost wrote:
> Helpful to determine if a bind can immediately use CPU or needs to be
> deferred a drm scheduler job.
>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_exec_queue.c | 23 +++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_exec_queue.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.c b/drivers/gpu/drm/xe/xe_exec_queue.c
> index 0ba37835849b..65b4d1da6c93 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.c
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.c
> @@ -906,3 +906,26 @@ void xe_exec_queue_last_fence_set(struct xe_exec_queue *q, struct xe_vm *vm,
> xe_exec_queue_last_fence_put(q, vm);
> q->last_fence = dma_fence_get(fence);
> }
> +
> +/**
> + * xe_exec_queue_last_fence_test_dep - Test last fence dependency of queue
> + * @q: The exec queue
> + * @vm: The VM the engine does a bind or exec for
> + *
> + * Returns:
> + * 0 on success on dependency, -ETIME on dependency
Could maybe improve the wording here?
"-ETIME if there exists an unsignalled last fence dependency, zero
otherwise."
?
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
> + */
> +int xe_exec_queue_last_fence_test_dep(struct xe_exec_queue *q, struct xe_vm *vm)
> +{
> + struct dma_fence *fence;
> + int err = 0;
> +
> + fence = xe_exec_queue_last_fence_get(q, vm);
> + if (fence) {
> + err = test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) ?
> + 0 : -ETIME;
> + dma_fence_put(fence);
> + }
> +
> + return err;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_exec_queue.h b/drivers/gpu/drm/xe/xe_exec_queue.h
> index 289a3a51d2a2..ded77b0f3b90 100644
> --- a/drivers/gpu/drm/xe/xe_exec_queue.h
> +++ b/drivers/gpu/drm/xe/xe_exec_queue.h
> @@ -75,6 +75,8 @@ struct dma_fence *xe_exec_queue_last_fence_get(struct xe_exec_queue *e,
> struct xe_vm *vm);
> void xe_exec_queue_last_fence_set(struct xe_exec_queue *e, struct xe_vm *vm,
> struct dma_fence *fence);
> +int xe_exec_queue_last_fence_test_dep(struct xe_exec_queue *q,
> + struct xe_vm *vm);
> void xe_exec_queue_update_run_ticks(struct xe_exec_queue *q);
>
> #endif
More information about the Intel-xe
mailing list