diff options
| author | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2013-12-17 09:27:08 -0500 |
| commit | bb799d3b980eb803ca2da4a4eefbd9308f8d988a (patch) | |
| tree | 69fbe0cd6d47b23a50f5e1d87bf7489532fae149 /include/drm | |
| parent | 919fc6e34831d1c2b58bfb5ae261dc3facc9b269 (diff) | |
| parent | 319e2e3f63c348a9b66db4667efa73178e18b17d (diff) | |
Merge tag 'v3.13-rc4' into core/locking
Merge Linux 3.13-rc4, to refresh this rather old tree with the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/ttm/ttm_bo_api.h | 4 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_execbuf_util.h | 3 | ||||
| -rw-r--r-- | include/drm/ttm/ttm_object.h | 61 |
3 files changed, 64 insertions, 4 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h index 751eaffbf0d5..ee127ec33c60 100644 --- a/include/drm/ttm/ttm_bo_api.h +++ b/include/drm/ttm/ttm_bo_api.h | |||
| @@ -169,6 +169,7 @@ struct ttm_tt; | |||
| 169 | * @offset: The current GPU offset, which can have different meanings | 169 | * @offset: The current GPU offset, which can have different meanings |
| 170 | * depending on the memory type. For SYSTEM type memory, it should be 0. | 170 | * depending on the memory type. For SYSTEM type memory, it should be 0. |
| 171 | * @cur_placement: Hint of current placement. | 171 | * @cur_placement: Hint of current placement. |
| 172 | * @wu_mutex: Wait unreserved mutex. | ||
| 172 | * | 173 | * |
| 173 | * Base class for TTM buffer object, that deals with data placement and CPU | 174 | * Base class for TTM buffer object, that deals with data placement and CPU |
| 174 | * mappings. GPU mappings are really up to the driver, but for simpler GPUs | 175 | * mappings. GPU mappings are really up to the driver, but for simpler GPUs |
| @@ -250,6 +251,7 @@ struct ttm_buffer_object { | |||
| 250 | 251 | ||
| 251 | struct reservation_object *resv; | 252 | struct reservation_object *resv; |
| 252 | struct reservation_object ttm_resv; | 253 | struct reservation_object ttm_resv; |
| 254 | struct mutex wu_mutex; | ||
| 253 | }; | 255 | }; |
| 254 | 256 | ||
| 255 | /** | 257 | /** |
| @@ -702,5 +704,5 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
| 702 | size_t count, loff_t *f_pos, bool write); | 704 | size_t count, loff_t *f_pos, bool write); |
| 703 | 705 | ||
| 704 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); | 706 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); |
| 705 | 707 | extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo); | |
| 706 | #endif | 708 | #endif |
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 |
