xref: /linux/drivers/gpu/drm/xe/xe_sync.h (revision bde5d79d00255db609fe9d859eef8c7b6d38b137)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2021 Intel Corporation
4  */
5 
6 #ifndef _XE_SYNC_H_
7 #define _XE_SYNC_H_
8 
9 #include "xe_sync_types.h"
10 
11 struct xe_device;
12 struct xe_exec_queue;
13 struct xe_file;
14 struct xe_sched_job;
15 struct xe_vm;
16 
17 #define SYNC_PARSE_FLAG_EXEC			BIT(0)
18 #define SYNC_PARSE_FLAG_LR_MODE			BIT(1)
19 #define SYNC_PARSE_FLAG_DISALLOW_USER_FENCE	BIT(2)
20 
21 int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,
22 			struct xe_sync_entry *sync,
23 			struct drm_xe_sync __user *sync_user,
24 			unsigned int flags);
25 int xe_sync_entry_add_deps(struct xe_sync_entry *sync,
26 			   struct xe_sched_job *job);
27 void xe_sync_entry_signal(struct xe_sync_entry *sync,
28 			  struct dma_fence *fence);
29 void xe_sync_entry_cleanup(struct xe_sync_entry *sync);
30 struct dma_fence *
31 xe_sync_in_fence_get(struct xe_sync_entry *sync, int num_sync,
32 		     struct xe_exec_queue *q, struct xe_vm *vm);
33 
34 static inline bool xe_sync_is_ufence(struct xe_sync_entry *sync)
35 {
36 	return !!sync->ufence;
37 }
38 
39 struct xe_user_fence *__xe_sync_ufence_get(struct xe_user_fence *ufence);
40 struct xe_user_fence *xe_sync_ufence_get(struct xe_sync_entry *sync);
41 void xe_sync_ufence_put(struct xe_user_fence *ufence);
42 int xe_sync_ufence_get_status(struct xe_user_fence *ufence);
43 
44 #endif
45