Blame view

drivers/dma-buf/sync_debug.h 2.14 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
16
  #include <linux/list.h>
  #include <linux/spinlock.h>
0f0d8406f   Maarten Lankhorst   android: convert ...
17
  #include <linux/fence.h>
7ad530bf2   Erik Gilling   staging: sync: Ad...
18

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

7ad530bf2   Erik Gilling   staging: sync: Ad...
22
23
  /**
   * struct sync_timeline - sync object
c5b86b741   Erik Gilling   staging: sync: Ad...
24
   * @kref:		reference count on fence.
7ad530bf2   Erik Gilling   staging: sync: Ad...
25
   * @name:		name of the sync_timeline. Useful for debugging
7ad530bf2   Erik Gilling   staging: sync: Ad...
26
   * @child_list_head:	list of children sync_pts for this sync_timeline
342952d3a   Gustavo Padovan   staging/android: ...
27
   * @child_list_lock:	lock protecting @child_list_head and fence.status
7ad530bf2   Erik Gilling   staging: sync: Ad...
28
   * @active_list_head:	list of active (unsignaled/errored) sync_pts
af7582f29   Erik Gilling   staging: sync: Ad...
29
   * @sync_timeline_list:	membership in global sync_timeline_list
7ad530bf2   Erik Gilling   staging: sync: Ad...
30
31
   */
  struct sync_timeline {
c5b86b741   Erik Gilling   staging: sync: Ad...
32
  	struct kref		kref;
7ad530bf2   Erik Gilling   staging: sync: Ad...
33
34
35
  	char			name[32];
  
  	/* protected by child_list_lock */
731c7d3a2   Linus Torvalds   Merge tag 'drm-fo...
36
37
  	u64			context;
  	int			value;
7ad530bf2   Erik Gilling   staging: sync: Ad...
38
39
40
41
42
  
  	struct list_head	child_list_head;
  	spinlock_t		child_list_lock;
  
  	struct list_head	active_list_head;
af7582f29   Erik Gilling   staging: sync: Ad...
43
44
  
  	struct list_head	sync_timeline_list;
7ad530bf2   Erik Gilling   staging: sync: Ad...
45
  };
b55b54b5d   Gustavo Padovan   staging/android: ...
46
  static inline struct sync_timeline *fence_parent(struct fence *fence)
0f0d8406f   Maarten Lankhorst   android: convert ...
47
  {
b55b54b5d   Gustavo Padovan   staging/android: ...
48
  	return container_of(fence->lock, struct sync_timeline,
0f0d8406f   Maarten Lankhorst   android: convert ...
49
50
  			    child_list_lock);
  }
97a84843a   Erik Gilling   staging: sync: Ad...
51

0431b9065   Gustavo Padovan   staging/android: ...
52
53
54
55
56
57
58
59
60
61
62
  /**
   * struct sync_pt - sync_pt object
   * @base: base fence object
   * @child_list: sync timeline child's list
   * @active_list: sync timeline active child's list
   */
  struct sync_pt {
  	struct fence base;
  	struct list_head child_list;
  	struct list_head active_list;
  };
b1f656044   Gustavo Padovan   staging/android: ...
63
  #ifdef CONFIG_SW_SYNC
0f0d8406f   Maarten Lankhorst   android: convert ...
64

1867a23b1   Gustavo Padovan   staging/android: ...
65
  extern const struct file_operations sw_sync_debugfs_fops;
d30649a8b   Joe Perches   staging: android:...
66
67
  void sync_timeline_debug_add(struct sync_timeline *obj);
  void sync_timeline_debug_remove(struct sync_timeline *obj);
d7fdb0ae9   Gustavo Padovan   staging/android: ...
68
69
  void sync_file_debug_add(struct sync_file *fence);
  void sync_file_debug_remove(struct sync_file *fence);
d30649a8b   Joe Perches   staging: android:...
70
  void sync_dump(void);
0f0d8406f   Maarten Lankhorst   android: convert ...
71
72
73
74
  
  #else
  # define sync_timeline_debug_add(obj)
  # define sync_timeline_debug_remove(obj)
d7fdb0ae9   Gustavo Padovan   staging/android: ...
75
76
  # define sync_file_debug_add(fence)
  # define sync_file_debug_remove(fence)
0f0d8406f   Maarten Lankhorst   android: convert ...
77
78
  # define sync_dump()
  #endif
0f0d8406f   Maarten Lankhorst   android: convert ...
79

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