aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/ttm/ttm_bo_api.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/ttm/ttm_bo_api.h')
-rw-r--r--include/drm/ttm/ttm_bo_api.h37
1 files changed, 5 insertions, 32 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 3cb5d848fb66..8a6aa56ece52 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -39,6 +39,7 @@
39#include <linux/mm.h> 39#include <linux/mm.h>
40#include <linux/rbtree.h> 40#include <linux/rbtree.h>
41#include <linux/bitmap.h> 41#include <linux/bitmap.h>
42#include <linux/reservation.h>
42 43
43struct ttm_bo_device; 44struct ttm_bo_device;
44 45
@@ -153,7 +154,6 @@ struct ttm_tt;
153 * Lru lists may keep one refcount, the delayed delete list, and kref != 0 154 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
154 * keeps one refcount. When this refcount reaches zero, 155 * keeps one refcount. When this refcount reaches zero,
155 * the object is destroyed. 156 * the object is destroyed.
156 * @event_queue: Queue for processes waiting on buffer object status change.
157 * @mem: structure describing current placement. 157 * @mem: structure describing current placement.
158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers 158 * @persistent_swap_storage: Usually the swap storage is deleted for buffers
159 * pinned in physical memory. If this behaviour is not desired, this member 159 * pinned in physical memory. If this behaviour is not desired, this member
@@ -164,12 +164,6 @@ struct ttm_tt;
164 * @lru: List head for the lru list. 164 * @lru: List head for the lru list.
165 * @ddestroy: List head for the delayed destroy list. 165 * @ddestroy: List head for the delayed destroy list.
166 * @swap: List head for swap LRU list. 166 * @swap: List head for swap LRU list.
167 * @val_seq: Sequence of the validation holding the @reserved lock.
168 * Used to avoid starvation when many processes compete to validate the
169 * buffer. This member is protected by the bo_device::lru_lock.
170 * @seq_valid: The value of @val_seq is valid. This value is protected by
171 * the bo_device::lru_lock.
172 * @reserved: Deadlock-free lock used for synchronization state transitions.
173 * @sync_obj: Pointer to a synchronization object. 167 * @sync_obj: Pointer to a synchronization object.
174 * @priv_flags: Flags describing buffer object internal state. 168 * @priv_flags: Flags describing buffer object internal state.
175 * @vm_rb: Rb node for the vm rb tree. 169 * @vm_rb: Rb node for the vm rb tree.
@@ -209,10 +203,9 @@ struct ttm_buffer_object {
209 203
210 struct kref kref; 204 struct kref kref;
211 struct kref list_kref; 205 struct kref list_kref;
212 wait_queue_head_t event_queue;
213 206
214 /** 207 /**
215 * Members protected by the bo::reserved lock. 208 * Members protected by the bo::resv::reserved lock.
216 */ 209 */
217 210
218 struct ttm_mem_reg mem; 211 struct ttm_mem_reg mem;
@@ -234,15 +227,6 @@ struct ttm_buffer_object {
234 struct list_head ddestroy; 227 struct list_head ddestroy;
235 struct list_head swap; 228 struct list_head swap;
236 struct list_head io_reserve_lru; 229 struct list_head io_reserve_lru;
237 uint32_t val_seq;
238 bool seq_valid;
239
240 /**
241 * Members protected by the bdev::lru_lock
242 * only when written to.
243 */
244
245 atomic_t reserved;
246 230
247 /** 231 /**
248 * Members protected by struct buffer_object_device::fence_lock 232 * Members protected by struct buffer_object_device::fence_lock
@@ -272,6 +256,9 @@ struct ttm_buffer_object {
272 uint32_t cur_placement; 256 uint32_t cur_placement;
273 257
274 struct sg_table *sg; 258 struct sg_table *sg;
259
260 struct reservation_object *resv;
261 struct reservation_object ttm_resv;
275}; 262};
276 263
277/** 264/**
@@ -725,18 +712,4 @@ extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
725 712
726extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); 713extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
727 714
728/**
729 * ttm_bo_is_reserved - return an indication if a ttm buffer object is reserved
730 *
731 * @bo: The buffer object to check.
732 *
733 * This function returns an indication if a bo is reserved or not, and should
734 * only be used to print an error when it is not from incorrect api usage, since
735 * there's no guarantee that it is the caller that is holding the reservation.
736 */
737static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo)
738{
739 return atomic_read(&bo->reserved);
740}
741
742#endif 715#endif