diff options
author | Dave Airlie <airlied@redhat.com> | 2013-11-21 03:46:26 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2013-11-21 03:46:26 -0500 |
commit | 28adb3026d01da3f6acded3cec817e1a3ba37f44 (patch) | |
tree | 26df1bf50f9ccf6fd282f3b22d103cb3b30ecaa3 /include | |
parent | cf969677945e6e19810d616873617320da002e32 (diff) | |
parent | c486d4f894d7c7d0e4148426360aa354384f6dc8 (diff) |
Merge branch 'vmwgfx-fixes-3.13' of git://people.freedesktop.org/~thomash/linux into drm-fixes
Below is a fix for a false lockep warning,
and the vmwgfx prime implementation.
* 'vmwgfx-fixes-3.13' of git://people.freedesktop.org/~thomash/linux:
drm/vmwgfx: Make vmwgfx dma buffers prime aware
drm/vmwgfx: Make surfaces prime-aware
drm/vmwgfx: Hook up the prime ioctls
drm/ttm: Add a minimal prime implementation for ttm base objects
drm/vmwgfx: Fix false lockdep warning
drm/ttm: Allow execbuf util reserves without ticket
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 3 | ||||
-rw-r--r-- | include/drm/ttm/ttm_object.h | 61 |
2 files changed, 61 insertions, 3 deletions
diff --git a/include/drm/ttm/ttm_execbuf_util.h b/include/drm/ttm/ttm_execbuf_util.h index ec8a1d306510..16db7d01a336 100644 --- a/include/drm/ttm/ttm_execbuf_util.h +++ b/include/drm/ttm/ttm_execbuf_util.h | |||
@@ -70,7 +70,8 @@ extern void ttm_eu_backoff_reservation(struct ww_acquire_ctx *ticket, | |||
70 | /** | 70 | /** |
71 | * function ttm_eu_reserve_buffers | 71 | * function ttm_eu_reserve_buffers |
72 | * | 72 | * |
73 | * @ticket: [out] ww_acquire_ctx returned by call. | 73 | * @ticket: [out] ww_acquire_ctx filled in by call, or NULL if only |
74 | * non-blocking reserves should be tried. | ||
74 | * @list: thread private list of ttm_validate_buffer structs. | 75 | * @list: thread private list of ttm_validate_buffer structs. |
75 | * | 76 | * |
76 | * Tries to reserve bos pointed to by the list entries for validation. | 77 | * Tries to reserve bos pointed to by the list entries for validation. |
diff --git a/include/drm/ttm/ttm_object.h b/include/drm/ttm/ttm_object.h index fc0cf0649901..58b029894eb3 100644 --- a/include/drm/ttm/ttm_object.h +++ b/include/drm/ttm/ttm_object.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <drm/drm_hashtab.h> | 41 | #include <drm/drm_hashtab.h> |
42 | #include <linux/kref.h> | 42 | #include <linux/kref.h> |
43 | #include <linux/rcupdate.h> | 43 | #include <linux/rcupdate.h> |
44 | #include <linux/dma-buf.h> | ||
44 | #include <ttm/ttm_memory.h> | 45 | #include <ttm/ttm_memory.h> |
45 | 46 | ||
46 | /** | 47 | /** |
@@ -77,6 +78,7 @@ enum ttm_object_type { | |||
77 | ttm_fence_type, | 78 | ttm_fence_type, |
78 | ttm_buffer_type, | 79 | ttm_buffer_type, |
79 | ttm_lock_type, | 80 | ttm_lock_type, |
81 | ttm_prime_type, | ||
80 | ttm_driver_type0 = 256, | 82 | ttm_driver_type0 = 256, |
81 | ttm_driver_type1, | 83 | ttm_driver_type1, |
82 | ttm_driver_type2, | 84 | ttm_driver_type2, |
@@ -132,6 +134,30 @@ struct ttm_base_object { | |||
132 | enum ttm_ref_type ref_type); | 134 | enum ttm_ref_type ref_type); |
133 | }; | 135 | }; |
134 | 136 | ||
137 | |||
138 | /** | ||
139 | * struct ttm_prime_object - Modified base object that is prime-aware | ||
140 | * | ||
141 | * @base: struct ttm_base_object that we derive from | ||
142 | * @mutex: Mutex protecting the @dma_buf member. | ||
143 | * @size: Size of the dma_buf associated with this object | ||
144 | * @real_type: Type of the underlying object. Needed since we're setting | ||
145 | * the value of @base::object_type to ttm_prime_type | ||
146 | * @dma_buf: Non ref-coutned pointer to a struct dma_buf created from this | ||
147 | * object. | ||
148 | * @refcount_release: The underlying object's release method. Needed since | ||
149 | * we set @base::refcount_release to our own release method. | ||
150 | */ | ||
151 | |||
152 | struct ttm_prime_object { | ||
153 | struct ttm_base_object base; | ||
154 | struct mutex mutex; | ||
155 | size_t size; | ||
156 | enum ttm_object_type real_type; | ||
157 | struct dma_buf *dma_buf; | ||
158 | void (*refcount_release) (struct ttm_base_object **); | ||
159 | }; | ||
160 | |||
135 | /** | 161 | /** |
136 | * ttm_base_object_init | 162 | * ttm_base_object_init |
137 | * | 163 | * |
@@ -248,14 +274,18 @@ extern void ttm_object_file_release(struct ttm_object_file **p_tfile); | |||
248 | /** | 274 | /** |
249 | * ttm_object device init - initialize a struct ttm_object_device | 275 | * ttm_object device init - initialize a struct ttm_object_device |
250 | * | 276 | * |
277 | * @mem_glob: struct ttm_mem_global for memory accounting. | ||
251 | * @hash_order: Order of hash table used to hash the base objects. | 278 | * @hash_order: Order of hash table used to hash the base objects. |
279 | * @ops: DMA buf ops for prime objects of this device. | ||
252 | * | 280 | * |
253 | * This function is typically called on device initialization to prepare | 281 | * This function is typically called on device initialization to prepare |
254 | * data structures needed for ttm base and ref objects. | 282 | * data structures needed for ttm base and ref objects. |
255 | */ | 283 | */ |
256 | 284 | ||
257 | extern struct ttm_object_device *ttm_object_device_init | 285 | extern struct ttm_object_device * |
258 | (struct ttm_mem_global *mem_glob, unsigned int hash_order); | 286 | ttm_object_device_init(struct ttm_mem_global *mem_glob, |
287 | unsigned int hash_order, | ||
288 | const struct dma_buf_ops *ops); | ||
259 | 289 | ||
260 | /** | 290 | /** |
261 | * ttm_object_device_release - release data held by a ttm_object_device | 291 | * ttm_object_device_release - release data held by a ttm_object_device |
@@ -272,4 +302,31 @@ extern void ttm_object_device_release(struct ttm_object_device **p_tdev); | |||
272 | 302 | ||
273 | #define ttm_base_object_kfree(__object, __base)\ | 303 | #define ttm_base_object_kfree(__object, __base)\ |
274 | kfree_rcu(__object, __base.rhead) | 304 | kfree_rcu(__object, __base.rhead) |
305 | |||
306 | extern int ttm_prime_object_init(struct ttm_object_file *tfile, | ||
307 | size_t size, | ||
308 | struct ttm_prime_object *prime, | ||
309 | bool shareable, | ||
310 | enum ttm_object_type type, | ||
311 | void (*refcount_release) | ||
312 | (struct ttm_base_object **), | ||
313 | void (*ref_obj_release) | ||
314 | (struct ttm_base_object *, | ||
315 | enum ttm_ref_type ref_type)); | ||
316 | |||
317 | static inline enum ttm_object_type | ||
318 | ttm_base_object_type(struct ttm_base_object *base) | ||
319 | { | ||
320 | return (base->object_type == ttm_prime_type) ? | ||
321 | container_of(base, struct ttm_prime_object, base)->real_type : | ||
322 | base->object_type; | ||
323 | } | ||
324 | extern int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, | ||
325 | int fd, u32 *handle); | ||
326 | extern int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, | ||
327 | uint32_t handle, uint32_t flags, | ||
328 | int *prime_fd); | ||
329 | |||
330 | #define ttm_prime_object_kfree(__obj, __prime) \ | ||
331 | kfree_rcu(__obj, __prime.base.rhead) | ||
275 | #endif | 332 | #endif |