Blame view

drivers/dma-buf/sync_debug.h 1.83 KB
7ad530bf2   Erik Gilling   staging: sync: Ad...
1
  /*
e912c881f   Gustavo Padovan   staging/android: ...
2
   * Sync File validation framework and debug infomation
7ad530bf2   Erik Gilling   staging: sync: Ad...
3
4
5
6
7
8
9
10
11
12
13
14
   *
   * Copyright (C) 2012 Google, Inc.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   */
  
  #ifndef _LINUX_SYNC_H
  #define _LINUX_SYNC_H
7ad530bf2   Erik Gilling   staging: sync: Ad...
15
  #include <linux/list.h>
f1e8c6712   Chris Wilson   dma-buf/sw-sync: ...
16
  #include <linux/rbtree.h>
7ad530bf2   Erik Gilling   staging: sync: Ad...
17
  #include <linux/spinlock.h>
f54d18670   Chris Wilson   dma-buf: Rename s...
18
  #include <linux/dma-fence.h>
7ad530bf2   Erik Gilling   staging: sync: Ad...
19

460bfc41f   Gustavo Padovan   dma-buf/sync_file...
20
21
  #include <linux/sync_file.h>
  #include <uapi/linux/sync_file.h>
64907b94d   Colin Cross   staging: android:...
22

7ad530bf2   Erik Gilling   staging: sync: Ad...
23
24
  /**
   * struct sync_timeline - sync object
c5b86b741   Erik Gilling   staging: sync: Ad...
25
   * @kref:		reference count on fence.
7ad530bf2   Erik Gilling   staging: sync: Ad...
26
   * @name:		name of the sync_timeline. Useful for debugging
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
27
   * @lock:		lock protecting @pt_list and @value
f1e8c6712   Chris Wilson   dma-buf/sw-sync: ...
28
   * @pt_tree:		rbtree of active (unsignaled/errored) sync_pts
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
29
   * @pt_list:		list of active (unsignaled/errored) sync_pts
af7582f29   Erik Gilling   staging: sync: Ad...
30
   * @sync_timeline_list:	membership in global sync_timeline_list
7ad530bf2   Erik Gilling   staging: sync: Ad...
31
32
   */
  struct sync_timeline {
c5b86b741   Erik Gilling   staging: sync: Ad...
33
  	struct kref		kref;
7ad530bf2   Erik Gilling   staging: sync: Ad...
34
  	char			name[32];
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
35
  	/* protected by lock */
731c7d3a2   Linus Torvalds   Merge tag 'drm-fo...
36
37
  	u64			context;
  	int			value;
7ad530bf2   Erik Gilling   staging: sync: Ad...
38

f1e8c6712   Chris Wilson   dma-buf/sw-sync: ...
39
  	struct rb_root		pt_tree;
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
40
41
  	struct list_head	pt_list;
  	spinlock_t		lock;
af7582f29   Erik Gilling   staging: sync: Ad...
42
43
  
  	struct list_head	sync_timeline_list;
7ad530bf2   Erik Gilling   staging: sync: Ad...
44
  };
f54d18670   Chris Wilson   dma-buf: Rename s...
45
  static inline struct sync_timeline *dma_fence_parent(struct dma_fence *fence)
0f0d8406f   Maarten Lankhorst   android: convert ...
46
  {
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
47
  	return container_of(fence->lock, struct sync_timeline, lock);
0f0d8406f   Maarten Lankhorst   android: convert ...
48
  }
97a84843a   Erik Gilling   staging: sync: Ad...
49

0431b9065   Gustavo Padovan   staging/android: ...
50
51
52
  /**
   * struct sync_pt - sync_pt object
   * @base: base fence object
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
53
   * @link: link on the sync timeline's list
f1e8c6712   Chris Wilson   dma-buf/sw-sync: ...
54
   * @node: node in the sync timeline's tree
0431b9065   Gustavo Padovan   staging/android: ...
55
56
   */
  struct sync_pt {
f54d18670   Chris Wilson   dma-buf: Rename s...
57
  	struct dma_fence base;
d3862e44d   Chris Wilson   dma-buf/sw-sync: ...
58
  	struct list_head link;
f1e8c6712   Chris Wilson   dma-buf/sw-sync: ...
59
  	struct rb_node node;
0431b9065   Gustavo Padovan   staging/android: ...
60
  };
1867a23b1   Gustavo Padovan   staging/android: ...
61
  extern const struct file_operations sw_sync_debugfs_fops;
d30649a8b   Joe Perches   staging: android:...
62
63
  void sync_timeline_debug_add(struct sync_timeline *obj);
  void sync_timeline_debug_remove(struct sync_timeline *obj);
d7fdb0ae9   Gustavo Padovan   staging/android: ...
64
65
  void sync_file_debug_add(struct sync_file *fence);
  void sync_file_debug_remove(struct sync_file *fence);
0f0d8406f   Maarten Lankhorst   android: convert ...
66

7ad530bf2   Erik Gilling   staging: sync: Ad...
67
  #endif /* _LINUX_SYNC_H */