aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_syncobj.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drm_syncobj.h')
-rw-r--r--include/drm/drm_syncobj.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/include/drm/drm_syncobj.h b/include/drm/drm_syncobj.h
index 43e2f382d2f0..3980602472c0 100644
--- a/include/drm/drm_syncobj.h
+++ b/include/drm/drm_syncobj.h
@@ -33,36 +33,31 @@ struct drm_syncobj_cb;
33/** 33/**
34 * struct drm_syncobj - sync object. 34 * struct drm_syncobj - sync object.
35 * 35 *
36 * This structure defines a generic sync object which wraps a dma fence. 36 * This structure defines a generic sync object which wraps a &dma_fence.
37 */ 37 */
38struct drm_syncobj { 38struct drm_syncobj {
39 /** 39 /**
40 * @refcount: 40 * @refcount: Reference count of this object.
41 *
42 * Reference count of this object.
43 */ 41 */
44 struct kref refcount; 42 struct kref refcount;
45 /** 43 /**
46 * @fence: 44 * @fence:
47 * NULL or a pointer to the fence bound to this object. 45 * NULL or a pointer to the fence bound to this object.
48 * 46 *
49 * This field should not be used directly. Use drm_syncobj_fence_get 47 * This field should not be used directly. Use drm_syncobj_fence_get()
50 * and drm_syncobj_replace_fence instead. 48 * and drm_syncobj_replace_fence() instead.
51 */ 49 */
52 struct dma_fence *fence; 50 struct dma_fence __rcu *fence;
53 /** 51 /**
54 * @cb_list: 52 * @cb_list: List of callbacks to call when the &fence gets replaced.
55 * List of callbacks to call when the fence gets replaced
56 */ 53 */
57 struct list_head cb_list; 54 struct list_head cb_list;
58 /** 55 /**
59 * @lock: 56 * @lock: Protects &cb_list and write-locks &fence.
60 * locks cb_list and write-locks fence.
61 */ 57 */
62 spinlock_t lock; 58 spinlock_t lock;
63 /** 59 /**
64 * @file: 60 * @file: A file backing for this syncobj.
65 * a file backing for this syncobj.
66 */ 61 */
67 struct file *file; 62 struct file *file;
68}; 63};
@@ -73,7 +68,7 @@ typedef void (*drm_syncobj_func_t)(struct drm_syncobj *syncobj,
73/** 68/**
74 * struct drm_syncobj_cb - callback for drm_syncobj_add_callback 69 * struct drm_syncobj_cb - callback for drm_syncobj_add_callback
75 * @node: used by drm_syncob_add_callback to append this struct to 70 * @node: used by drm_syncob_add_callback to append this struct to
76 * syncobj::cb_list 71 * &drm_syncobj.cb_list
77 * @func: drm_syncobj_func_t to call 72 * @func: drm_syncobj_func_t to call
78 * 73 *
79 * This struct will be initialized by drm_syncobj_add_callback, additional 74 * This struct will be initialized by drm_syncobj_add_callback, additional
@@ -92,7 +87,7 @@ void drm_syncobj_free(struct kref *kref);
92 * drm_syncobj_get - acquire a syncobj reference 87 * drm_syncobj_get - acquire a syncobj reference
93 * @obj: sync object 88 * @obj: sync object
94 * 89 *
95 * This acquires additional reference to @obj. It is illegal to call this 90 * This acquires an additional reference to @obj. It is illegal to call this
96 * without already holding a reference. No locks required. 91 * without already holding a reference. No locks required.
97 */ 92 */
98static inline void 93static inline void
@@ -111,6 +106,17 @@ drm_syncobj_put(struct drm_syncobj *obj)
111 kref_put(&obj->refcount, drm_syncobj_free); 106 kref_put(&obj->refcount, drm_syncobj_free);
112} 107}
113 108
109/**
110 * drm_syncobj_fence_get - get a reference to a fence in a sync object
111 * @syncobj: sync object.
112 *
113 * This acquires additional reference to &drm_syncobj.fence contained in @obj,
114 * if not NULL. It is illegal to call this without already holding a reference.
115 * No locks required.
116 *
117 * Returns:
118 * Either the fence of @obj or NULL if there's none.
119 */
114static inline struct dma_fence * 120static inline struct dma_fence *
115drm_syncobj_fence_get(struct drm_syncobj *syncobj) 121drm_syncobj_fence_get(struct drm_syncobj *syncobj)
116{ 122{