]>
Commit | Line | Data |
---|---|---|
7ad530bf | 1 | /* |
e912c881 | 2 | * Sync File validation framework and debug infomation |
7ad530bf EG |
3 | * |
4 | * Copyright (C) 2012 Google, Inc. | |
5 | * | |
6 | * This program is distributed in the hope that it will be useful, | |
7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
9 | * GNU General Public License for more details. | |
10 | * | |
11 | */ | |
12 | ||
13 | #ifndef _LINUX_SYNC_H | |
14 | #define _LINUX_SYNC_H | |
15 | ||
7ad530bf | 16 | #include <linux/list.h> |
f1e8c671 | 17 | #include <linux/rbtree.h> |
7ad530bf | 18 | #include <linux/spinlock.h> |
f54d1867 | 19 | #include <linux/dma-fence.h> |
7ad530bf | 20 | |
460bfc41 GP |
21 | #include <linux/sync_file.h> |
22 | #include <uapi/linux/sync_file.h> | |
64907b94 | 23 | |
7ad530bf EG |
24 | /** |
25 | * struct sync_timeline - sync object | |
c5b86b74 | 26 | * @kref: reference count on fence. |
7ad530bf | 27 | * @name: name of the sync_timeline. Useful for debugging |
d3862e44 | 28 | * @lock: lock protecting @pt_list and @value |
f1e8c671 | 29 | * @pt_tree: rbtree of active (unsignaled/errored) sync_pts |
d3862e44 | 30 | * @pt_list: list of active (unsignaled/errored) sync_pts |
af7582f2 | 31 | * @sync_timeline_list: membership in global sync_timeline_list |
7ad530bf EG |
32 | */ |
33 | struct sync_timeline { | |
c5b86b74 | 34 | struct kref kref; |
7ad530bf EG |
35 | char name[32]; |
36 | ||
d3862e44 | 37 | /* protected by lock */ |
731c7d3a LT |
38 | u64 context; |
39 | int value; | |
7ad530bf | 40 | |
f1e8c671 | 41 | struct rb_root pt_tree; |
d3862e44 CW |
42 | struct list_head pt_list; |
43 | spinlock_t lock; | |
af7582f2 EG |
44 | |
45 | struct list_head sync_timeline_list; | |
7ad530bf EG |
46 | }; |
47 | ||
f54d1867 | 48 | static inline struct sync_timeline *dma_fence_parent(struct dma_fence *fence) |
0f0d8406 | 49 | { |
d3862e44 | 50 | return container_of(fence->lock, struct sync_timeline, lock); |
0f0d8406 | 51 | } |
97a84843 | 52 | |
0431b906 GP |
53 | /** |
54 | * struct sync_pt - sync_pt object | |
55 | * @base: base fence object | |
d3862e44 | 56 | * @link: link on the sync timeline's list |
f1e8c671 | 57 | * @node: node in the sync timeline's tree |
0431b906 GP |
58 | */ |
59 | struct sync_pt { | |
f54d1867 | 60 | struct dma_fence base; |
d3862e44 | 61 | struct list_head link; |
f1e8c671 | 62 | struct rb_node node; |
0431b906 GP |
63 | }; |
64 | ||
1867a23b GP |
65 | extern const struct file_operations sw_sync_debugfs_fops; |
66 | ||
d30649a8 JP |
67 | void sync_timeline_debug_add(struct sync_timeline *obj); |
68 | void sync_timeline_debug_remove(struct sync_timeline *obj); | |
d7fdb0ae GP |
69 | void sync_file_debug_add(struct sync_file *fence); |
70 | void sync_file_debug_remove(struct sync_file *fence); | |
0f0d8406 | 71 | |
7ad530bf | 72 | #endif /* _LINUX_SYNC_H */ |