Rev 3031 | Rev 4065 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3031 | Rev 3262 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | */ |
29 | */ |
Line 30... | Line 30... | ||
30 | 30 | ||
31 | #ifndef _TTM_BO_API_H_ |
31 | #ifndef _TTM_BO_API_H_ |
Line 32... | Line 32... | ||
32 | #define _TTM_BO_API_H_ |
32 | #define _TTM_BO_API_H_ |
33 | 33 | ||
34 | #include "drm_hashtab.h" |
34 | #include |
35 | #include |
35 | #include |
36 | #include |
36 | #include |
37 | //#include |
37 | #include |
38 | #include |
38 | #include |
39 | //#include |
39 | #include |
Line 40... | Line 40... | ||
40 | //#include |
40 | #include |
Line 41... | Line 41... | ||
41 | #include |
41 | #include |
Line 48... | Line 48... | ||
48 | /** |
48 | /** |
49 | * struct ttm_placement |
49 | * struct ttm_placement |
50 | * |
50 | * |
51 | * @fpfn: first valid page frame number to put the object |
51 | * @fpfn: first valid page frame number to put the object |
52 | * @lpfn: last valid page frame number to put the object |
52 | * @lpfn: last valid page frame number to put the object |
53 | * @num_placement: number of prefered placements |
53 | * @num_placement: number of preferred placements |
54 | * @placement: prefered placements |
54 | * @placement: preferred placements |
55 | * @num_busy_placement: number of prefered placements when need to evict buffer |
55 | * @num_busy_placement: number of preferred placements when need to evict buffer |
56 | * @busy_placement: prefered placements when need to evict buffer |
56 | * @busy_placement: preferred placements when need to evict buffer |
57 | * |
57 | * |
58 | * Structure indicating the placement you request for an object. |
58 | * Structure indicating the placement you request for an object. |
59 | */ |
59 | */ |
60 | struct ttm_placement { |
60 | struct ttm_placement { |
61 | unsigned fpfn; |
61 | unsigned fpfn; |
Line 64... | Line 64... | ||
64 | const uint32_t *placement; |
64 | const uint32_t *placement; |
65 | unsigned num_busy_placement; |
65 | unsigned num_busy_placement; |
66 | const uint32_t *busy_placement; |
66 | const uint32_t *busy_placement; |
67 | }; |
67 | }; |
Line -... | Line 68... | ||
- | 68 | ||
- | 69 | /** |
|
- | 70 | * struct ttm_bus_placement |
|
- | 71 | * |
|
- | 72 | * @addr: mapped virtual address |
|
- | 73 | * @base: bus base address |
|
- | 74 | * @is_iomem: is this io memory ? |
|
- | 75 | * @size: size in byte |
|
- | 76 | * @offset: offset from the base address |
|
- | 77 | * @io_reserved_vm: The VM system has a refcount in @io_reserved_count |
|
- | 78 | * @io_reserved_count: Refcounting the numbers of callers to ttm_mem_io_reserve |
|
- | 79 | * |
|
- | 80 | * Structure indicating the bus placement of an object. |
|
- | 81 | */ |
|
- | 82 | struct ttm_bus_placement { |
|
- | 83 | void *addr; |
|
- | 84 | unsigned long base; |
|
- | 85 | unsigned long size; |
|
- | 86 | unsigned long offset; |
|
- | 87 | bool is_iomem; |
|
- | 88 | bool io_reserved_vm; |
|
- | 89 | uint64_t io_reserved_count; |
|
- | 90 | }; |
|
Line 68... | Line 91... | ||
68 | 91 | ||
69 | 92 | ||
70 | /** |
93 | /** |
71 | * struct ttm_mem_reg |
94 | * struct ttm_mem_reg |
72 | * |
95 | * |
73 | * @mm_node: Memory manager node. |
96 | * @mm_node: Memory manager node. |
74 | * @size: Requested size of memory region. |
97 | * @size: Requested size of memory region. |
75 | * @num_pages: Actual size of memory region in pages. |
98 | * @num_pages: Actual size of memory region in pages. |
- | 99 | * @page_alignment: Page alignment. |
|
76 | * @page_alignment: Page alignment. |
100 | * @placement: Placement flags. |
77 | * @placement: Placement flags. |
101 | * @bus: Placement on io bus accessible to the CPU |
78 | * |
102 | * |
79 | * Structure indicating the placement and space resources used by a |
103 | * Structure indicating the placement and space resources used by a |
Line 86... | Line 110... | ||
86 | unsigned long size; |
110 | unsigned long size; |
87 | unsigned long num_pages; |
111 | unsigned long num_pages; |
88 | uint32_t page_alignment; |
112 | uint32_t page_alignment; |
89 | uint32_t mem_type; |
113 | uint32_t mem_type; |
90 | uint32_t placement; |
114 | uint32_t placement; |
91 | // struct ttm_bus_placement bus; |
115 | struct ttm_bus_placement bus; |
92 | }; |
116 | }; |
Line 93... | Line -... | ||
93 | - | ||
94 | 117 | ||
95 | /** |
118 | /** |
96 | * enum ttm_bo_type |
119 | * enum ttm_bo_type |
97 | * |
120 | * |
98 | * @ttm_bo_type_device: These are 'normal' buffers that can |
121 | * @ttm_bo_type_device: These are 'normal' buffers that can |
99 | * be mmapped by user space. Each of these bos occupy a slot in the |
122 | * be mmapped by user space. Each of these bos occupy a slot in the |
100 | * device address space, that can be used for normal vm operations. |
123 | * device address space, that can be used for normal vm operations. |
101 | * |
- | |
102 | * @ttm_bo_type_user: These are user-space memory areas that are made |
- | |
103 | * available to the GPU by mapping the buffer pages into the GPU aperture |
- | |
104 | * space. These buffers cannot be mmaped from the device address space. |
- | |
105 | * |
124 | * |
106 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, |
125 | * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers, |
- | 126 | * but they cannot be accessed from user-space. For kernel-only use. |
|
- | 127 | * |
|
- | 128 | * @ttm_bo_type_sg: Buffer made from dmabuf sg table shared with another |
|
107 | * but they cannot be accessed from user-space. For kernel-only use. |
129 | * driver. |
Line 108... | Line 130... | ||
108 | */ |
130 | */ |
109 | 131 | ||
110 | enum ttm_bo_type { |
132 | enum ttm_bo_type { |
111 | ttm_bo_type_device, |
133 | ttm_bo_type_device, |
112 | ttm_bo_type_user, |
134 | ttm_bo_type_kernel, |
Line 113... | Line 135... | ||
113 | ttm_bo_type_kernel |
135 | ttm_bo_type_sg |
Line 114... | Line 136... | ||
114 | }; |
136 | }; |
115 | 137 | ||
116 | struct ttm_tt; |
138 | struct ttm_tt; |
117 | 139 | ||
118 | /** |
- | |
119 | * struct ttm_buffer_object |
- | |
120 | * |
140 | /** |
121 | * @bdev: Pointer to the buffer object device structure. |
141 | * struct ttm_buffer_object |
122 | * @buffer_start: The virtual user-space start address of ttm_bo_type_user |
142 | * |
123 | * buffers. |
143 | * @bdev: Pointer to the buffer object device structure. |
124 | * @type: The bo type. |
144 | * @type: The bo type. |
Line 132... | Line 152... | ||
132 | * used to avoid destruction while the buffer object is still on a list. |
152 | * used to avoid destruction while the buffer object is still on a list. |
133 | * Lru lists may keep one refcount, the delayed delete list, and kref != 0 |
153 | * Lru lists may keep one refcount, the delayed delete list, and kref != 0 |
134 | * keeps one refcount. When this refcount reaches zero, |
154 | * keeps one refcount. When this refcount reaches zero, |
135 | * the object is destroyed. |
155 | * the object is destroyed. |
136 | * @event_queue: Queue for processes waiting on buffer object status change. |
156 | * @event_queue: Queue for processes waiting on buffer object status change. |
137 | * @lock: spinlock protecting mostly synchronization members. |
- | |
138 | * @mem: structure describing current placement. |
157 | * @mem: structure describing current placement. |
139 | * @persistant_swap_storage: Usually the swap storage is deleted for buffers |
158 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
140 | * 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 |
141 | * holds a pointer to a persistant shmem object. |
160 | * holds a pointer to a persistent shmem object. |
142 | * @ttm: TTM structure holding system pages. |
161 | * @ttm: TTM structure holding system pages. |
143 | * @evicted: Whether the object was evicted without user-space knowing. |
162 | * @evicted: Whether the object was evicted without user-space knowing. |
144 | * @cpu_writes: For synchronization. Number of cpu writers. |
163 | * @cpu_writes: For synchronization. Number of cpu writers. |
145 | * @lru: List head for the lru list. |
164 | * @lru: List head for the lru list. |
146 | * @ddestroy: List head for the delayed destroy list. |
165 | * @ddestroy: List head for the delayed destroy list. |
Line 149... | Line 168... | ||
149 | * Used to avoid starvation when many processes compete to validate the |
168 | * Used to avoid starvation when many processes compete to validate the |
150 | * buffer. This member is protected by the bo_device::lru_lock. |
169 | * buffer. This member is protected by the bo_device::lru_lock. |
151 | * @seq_valid: The value of @val_seq is valid. This value is protected by |
170 | * @seq_valid: The value of @val_seq is valid. This value is protected by |
152 | * the bo_device::lru_lock. |
171 | * the bo_device::lru_lock. |
153 | * @reserved: Deadlock-free lock used for synchronization state transitions. |
172 | * @reserved: Deadlock-free lock used for synchronization state transitions. |
154 | * @sync_obj_arg: Opaque argument to synchronization object function. |
- | |
155 | * @sync_obj: Pointer to a synchronization object. |
173 | * @sync_obj: Pointer to a synchronization object. |
156 | * @priv_flags: Flags describing buffer object internal state. |
174 | * @priv_flags: Flags describing buffer object internal state. |
157 | * @vm_rb: Rb node for the vm rb tree. |
175 | * @vm_rb: Rb node for the vm rb tree. |
158 | * @vm_node: Address space manager node. |
176 | * @vm_node: Address space manager node. |
159 | * @offset: The current GPU offset, which can have different meanings |
177 | * @offset: The current GPU offset, which can have different meanings |
Line 177... | Line 195... | ||
177 | * Members constant at init. |
195 | * Members constant at init. |
178 | */ |
196 | */ |
Line 179... | Line 197... | ||
179 | 197 | ||
180 | struct ttm_bo_global *glob; |
198 | struct ttm_bo_global *glob; |
181 | struct ttm_bo_device *bdev; |
- | |
182 | unsigned long buffer_start; |
199 | struct ttm_bo_device *bdev; |
183 | enum ttm_bo_type type; |
200 | enum ttm_bo_type type; |
184 | void (*destroy) (struct ttm_buffer_object *); |
201 | void (*destroy) (struct ttm_buffer_object *); |
185 | unsigned long num_pages; |
202 | unsigned long num_pages; |
186 | uint64_t addr_space_offset; |
203 | uint64_t addr_space_offset; |
Line 190... | Line 207... | ||
190 | * Members not needing protection. |
207 | * Members not needing protection. |
191 | */ |
208 | */ |
Line 192... | Line 209... | ||
192 | 209 | ||
193 | struct kref kref; |
210 | struct kref kref; |
194 | struct kref list_kref; |
211 | struct kref list_kref; |
195 | // wait_queue_head_t event_queue; |
- | |
Line 196... | Line 212... | ||
196 | spinlock_t lock; |
212 | wait_queue_head_t event_queue; |
197 | 213 | ||
198 | /** |
214 | /** |
Line 199... | Line 215... | ||
199 | * Members protected by the bo::reserved lock. |
215 | * Members protected by the bo::reserved lock. |
200 | */ |
216 | */ |
201 | 217 | ||
202 | struct ttm_mem_reg mem; |
218 | struct ttm_mem_reg mem; |
Line 203... | Line 219... | ||
203 | // struct file *persistant_swap_storage; |
219 | struct file *persistent_swap_storage; |
204 | struct ttm_tt *ttm; |
220 | struct ttm_tt *ttm; |
Line 215... | Line 231... | ||
215 | */ |
231 | */ |
Line 216... | Line 232... | ||
216 | 232 | ||
217 | struct list_head lru; |
233 | struct list_head lru; |
218 | struct list_head ddestroy; |
234 | struct list_head ddestroy; |
- | 235 | struct list_head swap; |
|
219 | struct list_head swap; |
236 | struct list_head io_reserve_lru; |
220 | uint32_t val_seq; |
237 | uint32_t val_seq; |
Line 221... | Line 238... | ||
221 | bool seq_valid; |
238 | bool seq_valid; |
222 | 239 | ||
223 | /** |
240 | /** |
224 | * Members protected by the bdev::lru_lock |
241 | * Members protected by the bdev::lru_lock |
Line 225... | Line 242... | ||
225 | * only when written to. |
242 | * only when written to. |
Line 226... | Line -... | ||
226 | */ |
- | |
227 | 243 | */ |
|
228 | atomic_t reserved; |
244 | |
- | 245 | atomic_t reserved; |
|
- | 246 | ||
- | 247 | /** |
|
229 | 248 | * Members protected by struct buffer_object_device::fence_lock |
|
Line 230... | Line -... | ||
230 | - | ||
231 | /** |
249 | * In addition, setting sync_obj to anything else |
232 | * Members protected by the bo::lock |
250 | * than NULL requires bo::reserved to be held. This allows for |
Line 233... | Line 251... | ||
233 | */ |
251 | * checking NULL while reserved but not holding the mentioned lock. |
234 | 252 | */ |
|
Line 250... | Line 268... | ||
250 | * either of these locks held. |
268 | * either of these locks held. |
251 | */ |
269 | */ |
Line 252... | Line 270... | ||
252 | 270 | ||
253 | unsigned long offset; |
271 | unsigned long offset; |
- | 272 | uint32_t cur_placement; |
|
- | 273 | ||
254 | uint32_t cur_placement; |
274 | struct sg_table *sg; |
Line 255... | Line 275... | ||
255 | }; |
275 | }; |
256 | 276 | ||
257 | /** |
277 | /** |
Line 275... | Line 295... | ||
275 | ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK, |
295 | ttm_bo_map_iomap = 1 | TTM_BO_MAP_IOMEM_MASK, |
276 | ttm_bo_map_vmap = 2, |
296 | ttm_bo_map_vmap = 2, |
277 | ttm_bo_map_kmap = 3, |
297 | ttm_bo_map_kmap = 3, |
278 | ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, |
298 | ttm_bo_map_premapped = 4 | TTM_BO_MAP_IOMEM_MASK, |
279 | } bo_kmap_type; |
299 | } bo_kmap_type; |
- | 300 | struct ttm_buffer_object *bo; |
|
280 | }; |
301 | }; |
Line 281... | Line 302... | ||
281 | 302 | ||
282 | /** |
303 | /** |
283 | * ttm_bo_reference - reference a struct ttm_buffer_object |
304 | * ttm_bo_reference - reference a struct ttm_buffer_object |
Line 314... | Line 335... | ||
314 | * ttm_bo_validate |
335 | * ttm_bo_validate |
315 | * |
336 | * |
316 | * @bo: The buffer object. |
337 | * @bo: The buffer object. |
317 | * @placement: Proposed placement for the buffer object. |
338 | * @placement: Proposed placement for the buffer object. |
318 | * @interruptible: Sleep interruptible if sleeping. |
339 | * @interruptible: Sleep interruptible if sleeping. |
319 | * @no_wait_reserve: Return immediately if other buffers are busy. |
- | |
320 | * @no_wait_gpu: Return immediately if the GPU is busy. |
340 | * @no_wait_gpu: Return immediately if the GPU is busy. |
321 | * |
341 | * |
322 | * Changes placement and caching policy of the buffer object |
342 | * Changes placement and caching policy of the buffer object |
323 | * according proposed placement. |
343 | * according proposed placement. |
324 | * Returns |
344 | * Returns |
Line 327... | Line 347... | ||
327 | * -EBUSY if no_wait is true and buffer busy. |
347 | * -EBUSY if no_wait is true and buffer busy. |
328 | * -ERESTARTSYS if interrupted by a signal. |
348 | * -ERESTARTSYS if interrupted by a signal. |
329 | */ |
349 | */ |
330 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, |
350 | extern int ttm_bo_validate(struct ttm_buffer_object *bo, |
331 | struct ttm_placement *placement, |
351 | struct ttm_placement *placement, |
332 | bool interruptible, bool no_wait_reserve, |
352 | bool interruptible, |
333 | bool no_wait_gpu); |
353 | bool no_wait_gpu); |
Line 334... | Line 354... | ||
334 | 354 | ||
335 | /** |
355 | /** |
336 | * ttm_bo_unref |
356 | * ttm_bo_unref |
Line 339... | Line 359... | ||
339 | * |
359 | * |
340 | * Unreference and clear a pointer to a buffer object. |
360 | * Unreference and clear a pointer to a buffer object. |
341 | */ |
361 | */ |
342 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); |
362 | extern void ttm_bo_unref(struct ttm_buffer_object **bo); |
Line -... | Line 363... | ||
- | 363 | ||
- | 364 | ||
- | 365 | /** |
|
- | 366 | * ttm_bo_list_ref_sub |
|
- | 367 | * |
|
- | 368 | * @bo: The buffer object. |
|
- | 369 | * @count: The number of references with which to decrease @bo::list_kref; |
|
- | 370 | * @never_free: The refcount should not reach zero with this operation. |
|
- | 371 | * |
|
- | 372 | * Release @count lru list references to this buffer object. |
|
- | 373 | */ |
|
- | 374 | extern void ttm_bo_list_ref_sub(struct ttm_buffer_object *bo, int count, |
|
- | 375 | bool never_free); |
|
- | 376 | ||
- | 377 | /** |
|
- | 378 | * ttm_bo_add_to_lru |
|
- | 379 | * |
|
- | 380 | * @bo: The buffer object. |
|
- | 381 | * |
|
- | 382 | * Add this bo to the relevant mem type lru and, if it's backed by |
|
- | 383 | * system pages (ttms) to the swap list. |
|
- | 384 | * This function must be called with struct ttm_bo_global::lru_lock held, and |
|
- | 385 | * is typically called immediately prior to unreserving a bo. |
|
- | 386 | */ |
|
- | 387 | extern void ttm_bo_add_to_lru(struct ttm_buffer_object *bo); |
|
- | 388 | ||
- | 389 | /** |
|
- | 390 | * ttm_bo_del_from_lru |
|
- | 391 | * |
|
- | 392 | * @bo: The buffer object. |
|
- | 393 | * |
|
- | 394 | * Remove this bo from all lru lists used to lookup and reserve an object. |
|
- | 395 | * This function must be called with struct ttm_bo_global::lru_lock held, |
|
- | 396 | * and is usually called just immediately after the bo has been reserved to |
|
- | 397 | * avoid recursive reservation from lru lists. |
|
- | 398 | */ |
|
- | 399 | extern int ttm_bo_del_from_lru(struct ttm_buffer_object *bo); |
|
- | 400 | ||
- | 401 | ||
- | 402 | /** |
|
- | 403 | * ttm_bo_lock_delayed_workqueue |
|
- | 404 | * |
|
- | 405 | * Prevent the delayed workqueue from running. |
|
- | 406 | * Returns |
|
- | 407 | * True if the workqueue was queued at the time |
|
- | 408 | */ |
|
- | 409 | extern int ttm_bo_lock_delayed_workqueue(struct ttm_bo_device *bdev); |
|
- | 410 | ||
- | 411 | /** |
|
- | 412 | * ttm_bo_unlock_delayed_workqueue |
|
- | 413 | * |
|
- | 414 | * Allows the delayed workqueue to run. |
|
- | 415 | */ |
|
- | 416 | extern void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, |
|
- | 417 | int resched); |
|
343 | 418 | ||
344 | /** |
419 | /** |
345 | * ttm_bo_synccpu_write_grab |
420 | * ttm_bo_synccpu_write_grab |
346 | * |
421 | * |
347 | * @bo: The buffer object: |
422 | * @bo: The buffer object: |
348 | * @no_wait: Return immediately if buffer is busy. |
423 | * @no_wait: Return immediately if buffer is busy. |
349 | * |
424 | * |
350 | * Synchronizes a buffer object for CPU RW access. This means |
425 | * Synchronizes a buffer object for CPU RW access. This means |
351 | * blocking command submission that affects the buffer and |
426 | * command submission that affects the buffer will return -EBUSY |
- | 427 | * until ttm_bo_synccpu_write_release is called. |
|
352 | * waiting for buffer idle. This lock is recursive. |
428 | * |
353 | * Returns |
429 | * Returns |
354 | * -EBUSY if the buffer is busy and no_wait is true. |
430 | * -EBUSY if the buffer is busy and no_wait is true. |
355 | * -ERESTARTSYS if interrupted by a signal. |
431 | * -ERESTARTSYS if interrupted by a signal. |
356 | */ |
- | |
357 | 432 | */ |
|
358 | extern int |
433 | extern int |
- | 434 | ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); |
|
359 | ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait); |
435 | |
360 | /** |
436 | /** |
361 | * ttm_bo_synccpu_write_release: |
437 | * ttm_bo_synccpu_write_release: |
362 | * |
438 | * |
363 | * @bo : The buffer object. |
439 | * @bo : The buffer object. |
364 | * |
440 | * |
365 | * Releases a synccpu lock. |
441 | * Releases a synccpu lock. |
366 | */ |
442 | */ |
Line 367... | Line 443... | ||
367 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); |
443 | extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); |
- | 444 | ||
- | 445 | /** |
|
- | 446 | * ttm_bo_acc_size |
|
- | 447 | * |
|
- | 448 | * @bdev: Pointer to a ttm_bo_device struct. |
|
- | 449 | * @bo_size: size of the buffer object in byte. |
|
- | 450 | * @struct_size: size of the structure holding buffer object datas |
|
- | 451 | * |
|
- | 452 | * Returns size to account for a buffer object |
|
- | 453 | */ |
|
- | 454 | size_t ttm_bo_acc_size(struct ttm_bo_device *bdev, |
|
- | 455 | unsigned long bo_size, |
|
- | 456 | unsigned struct_size); |
|
- | 457 | size_t ttm_bo_dma_acc_size(struct ttm_bo_device *bdev, |
|
- | 458 | unsigned long bo_size, |
|
- | 459 | unsigned struct_size); |
|
368 | 460 | ||
369 | /** |
461 | /** |
370 | * ttm_bo_init |
462 | * ttm_bo_init |
371 | * |
463 | * |
372 | * @bdev: Pointer to a ttm_bo_device struct. |
464 | * @bdev: Pointer to a ttm_bo_device struct. |
373 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
465 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
374 | * @size: Requested size of buffer object. |
466 | * @size: Requested size of buffer object. |
375 | * @type: Requested type of buffer object. |
467 | * @type: Requested type of buffer object. |
376 | * @flags: Initial placement flags. |
- | |
377 | * @page_alignment: Data alignment in pages. |
- | |
378 | * @buffer_start: Virtual address of user space data backing a |
468 | * @flags: Initial placement flags. |
379 | * user buffer object. |
469 | * @page_alignment: Data alignment in pages. |
380 | * @interruptible: If needing to sleep to wait for GPU resources, |
470 | * @interruptible: If needing to sleep to wait for GPU resources, |
381 | * sleep interruptible. |
471 | * sleep interruptible. |
382 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
472 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
Line 406... | Line 496... | ||
406 | struct ttm_buffer_object *bo, |
496 | struct ttm_buffer_object *bo, |
407 | unsigned long size, |
497 | unsigned long size, |
408 | enum ttm_bo_type type, |
498 | enum ttm_bo_type type, |
409 | struct ttm_placement *placement, |
499 | struct ttm_placement *placement, |
410 | uint32_t page_alignment, |
500 | uint32_t page_alignment, |
411 | unsigned long buffer_start, |
- | |
412 | bool interrubtible, |
501 | bool interrubtible, |
413 | struct file *persistent_swap_storage, |
502 | struct file *persistent_swap_storage, |
414 | size_t acc_size, |
503 | size_t acc_size, |
- | 504 | struct sg_table *sg, |
|
415 | void (*destroy) (struct ttm_buffer_object *)); |
505 | void (*destroy) (struct ttm_buffer_object *)); |
- | 506 | ||
416 | /** |
507 | /** |
417 | * ttm_bo_synccpu_object_init |
508 | * ttm_bo_synccpu_object_init |
418 | * |
509 | * |
419 | * @bdev: Pointer to a ttm_bo_device struct. |
510 | * @bdev: Pointer to a ttm_bo_device struct. |
420 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
511 | * @bo: Pointer to a ttm_buffer_object to be initialized. |
421 | * @size: Requested size of buffer object. |
512 | * @size: Requested size of buffer object. |
422 | * @type: Requested type of buffer object. |
513 | * @type: Requested type of buffer object. |
423 | * @flags: Initial placement flags. |
514 | * @flags: Initial placement flags. |
424 | * @page_alignment: Data alignment in pages. |
515 | * @page_alignment: Data alignment in pages. |
425 | * @buffer_start: Virtual address of user space data backing a |
- | |
426 | * user buffer object. |
- | |
427 | * @interruptible: If needing to sleep while waiting for GPU resources, |
516 | * @interruptible: If needing to sleep while waiting for GPU resources, |
428 | * sleep interruptible. |
517 | * sleep interruptible. |
429 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
518 | * @persistent_swap_storage: Usually the swap storage is deleted for buffers |
430 | * pinned in physical memory. If this behaviour is not desired, this member |
519 | * pinned in physical memory. If this behaviour is not desired, this member |
431 | * holds a pointer to a persistent shmem object. Typically, this would |
520 | * holds a pointer to a persistent shmem object. Typically, this would |
Line 444... | Line 533... | ||
444 | extern int ttm_bo_create(struct ttm_bo_device *bdev, |
533 | extern int ttm_bo_create(struct ttm_bo_device *bdev, |
445 | unsigned long size, |
534 | unsigned long size, |
446 | enum ttm_bo_type type, |
535 | enum ttm_bo_type type, |
447 | struct ttm_placement *placement, |
536 | struct ttm_placement *placement, |
448 | uint32_t page_alignment, |
537 | uint32_t page_alignment, |
449 | unsigned long buffer_start, |
- | |
450 | bool interruptible, |
538 | bool interruptible, |
451 | struct file *persistent_swap_storage, |
539 | struct file *persistent_swap_storage, |
452 | struct ttm_buffer_object **p_bo); |
540 | struct ttm_buffer_object **p_bo); |
Line 453... | Line 541... | ||
453 | 541 | ||
Line 580... | Line 668... | ||
580 | * Unmaps a kernel map set up by ttm_bo_kmap. |
668 | * Unmaps a kernel map set up by ttm_bo_kmap. |
581 | */ |
669 | */ |
Line 582... | Line 670... | ||
582 | 670 | ||
Line 583... | Line -... | ||
583 | extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); |
- | |
584 | - | ||
585 | #if 0 |
- | |
586 | #endif |
671 | extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map); |
587 | 672 | ||
588 | /** |
673 | /** |
589 | * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object. |
674 | * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object. |
590 | * |
675 | * |
Line 638... | Line 723... | ||
638 | const char __user *wbuf, char __user *rbuf, |
723 | const char __user *wbuf, char __user *rbuf, |
639 | size_t count, loff_t *f_pos, bool write); |
724 | size_t count, loff_t *f_pos, bool write); |
Line 640... | Line 725... | ||
640 | 725 | ||
Line -... | Line 726... | ||
- | 726 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); |
|
- | 727 | ||
- | 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 | */ |
|
- | 737 | static inline bool ttm_bo_is_reserved(struct ttm_buffer_object *bo) |
|
- | 738 | { |
|
- | 739 | return atomic_read(&bo->reserved); |
|
641 | extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev); |
740 | } |