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.h56
1 files changed, 37 insertions, 19 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 491146170522..4fd498523ce3 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -44,6 +44,29 @@ struct ttm_bo_device;
44 44
45struct drm_mm_node; 45struct drm_mm_node;
46 46
47
48/**
49 * struct ttm_placement
50 *
51 * @fpfn: first 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
54 * @placement: prefered placements
55 * @num_busy_placement: number of prefered placements when need to evict buffer
56 * @busy_placement: prefered placements when need to evict buffer
57 *
58 * Structure indicating the placement you request for an object.
59 */
60struct ttm_placement {
61 unsigned fpfn;
62 unsigned lpfn;
63 unsigned num_placement;
64 const uint32_t *placement;
65 unsigned num_busy_placement;
66 const uint32_t *busy_placement;
67};
68
69
47/** 70/**
48 * struct ttm_mem_reg 71 * struct ttm_mem_reg
49 * 72 *
@@ -109,10 +132,6 @@ struct ttm_tt;
109 * the object is destroyed. 132 * the object is destroyed.
110 * @event_queue: Queue for processes waiting on buffer object status change. 133 * @event_queue: Queue for processes waiting on buffer object status change.
111 * @lock: spinlock protecting mostly synchronization members. 134 * @lock: spinlock protecting mostly synchronization members.
112 * @proposed_placement: Proposed placement for the buffer. Changed only by the
113 * creator prior to validation as opposed to bo->mem.proposed_flags which is
114 * changed by the implementation prior to a buffer move if it wants to outsmart
115 * the buffer creator / user. This latter happens, for example, at eviction.
116 * @mem: structure describing current placement. 135 * @mem: structure describing current placement.
117 * @persistant_swap_storage: Usually the swap storage is deleted for buffers 136 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
118 * pinned in physical memory. If this behaviour is not desired, this member 137 * pinned in physical memory. If this behaviour is not desired, this member
@@ -177,7 +196,6 @@ struct ttm_buffer_object {
177 * Members protected by the bo::reserved lock. 196 * Members protected by the bo::reserved lock.
178 */ 197 */
179 198
180 uint32_t proposed_placement;
181 struct ttm_mem_reg mem; 199 struct ttm_mem_reg mem;
182 struct file *persistant_swap_storage; 200 struct file *persistant_swap_storage;
183 struct ttm_tt *ttm; 201 struct ttm_tt *ttm;
@@ -285,7 +303,7 @@ ttm_bo_reference(struct ttm_buffer_object *bo)
285 * Note: It might be necessary to block validations before the 303 * Note: It might be necessary to block validations before the
286 * wait by reserving the buffer. 304 * wait by reserving the buffer.
287 * Returns -EBUSY if no_wait is true and the buffer is busy. 305 * Returns -EBUSY if no_wait is true and the buffer is busy.
288 * Returns -ERESTART if interrupted by a signal. 306 * Returns -ERESTARTSYS if interrupted by a signal.
289 */ 307 */
290extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, 308extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
291 bool interruptible, bool no_wait); 309 bool interruptible, bool no_wait);
@@ -293,21 +311,22 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
293 * ttm_buffer_object_validate 311 * ttm_buffer_object_validate
294 * 312 *
295 * @bo: The buffer object. 313 * @bo: The buffer object.
296 * @proposed_placement: Proposed_placement for the buffer object. 314 * @placement: Proposed placement for the buffer object.
297 * @interruptible: Sleep interruptible if sleeping. 315 * @interruptible: Sleep interruptible if sleeping.
298 * @no_wait: Return immediately if the buffer is busy. 316 * @no_wait: Return immediately if the buffer is busy.
299 * 317 *
300 * Changes placement and caching policy of the buffer object 318 * Changes placement and caching policy of the buffer object
301 * according to bo::proposed_flags. 319 * according proposed placement.
302 * Returns 320 * Returns
303 * -EINVAL on invalid proposed_flags. 321 * -EINVAL on invalid proposed placement.
304 * -ENOMEM on out-of-memory condition. 322 * -ENOMEM on out-of-memory condition.
305 * -EBUSY if no_wait is true and buffer busy. 323 * -EBUSY if no_wait is true and buffer busy.
306 * -ERESTART if interrupted by a signal. 324 * -ERESTARTSYS if interrupted by a signal.
307 */ 325 */
308extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, 326extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
309 uint32_t proposed_placement, 327 struct ttm_placement *placement,
310 bool interruptible, bool no_wait); 328 bool interruptible, bool no_wait);
329
311/** 330/**
312 * ttm_bo_unref 331 * ttm_bo_unref
313 * 332 *
@@ -328,7 +347,7 @@ extern void ttm_bo_unref(struct ttm_buffer_object **bo);
328 * waiting for buffer idle. This lock is recursive. 347 * waiting for buffer idle. This lock is recursive.
329 * Returns 348 * Returns
330 * -EBUSY if the buffer is busy and no_wait is true. 349 * -EBUSY if the buffer is busy and no_wait is true.
331 * -ERESTART if interrupted by a signal. 350 * -ERESTARTSYS if interrupted by a signal.
332 */ 351 */
333 352
334extern int 353extern int
@@ -371,7 +390,7 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
371 * Returns 390 * Returns
372 * -ENOMEM: Out of memory. 391 * -ENOMEM: Out of memory.
373 * -EINVAL: Invalid placement flags. 392 * -EINVAL: Invalid placement flags.
374 * -ERESTART: Interrupted by signal while sleeping waiting for resources. 393 * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
375 */ 394 */
376 395
377extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, 396extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
@@ -411,7 +430,7 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
411 * Returns 430 * Returns
412 * -ENOMEM: Out of memory. 431 * -ENOMEM: Out of memory.
413 * -EINVAL: Invalid placement flags. 432 * -EINVAL: Invalid placement flags.
414 * -ERESTART: Interrupted by signal while waiting for resources. 433 * -ERESTARTSYS: Interrupted by signal while waiting for resources.
415 */ 434 */
416 435
417extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, 436extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
@@ -445,7 +464,6 @@ extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
445 * 464 *
446 * @bdev: Pointer to a ttm_bo_device struct. 465 * @bdev: Pointer to a ttm_bo_device struct.
447 * @mem_type: The memory type. 466 * @mem_type: The memory type.
448 * @p_offset: offset for managed area in pages.
449 * @p_size: size managed area in pages. 467 * @p_size: size managed area in pages.
450 * 468 *
451 * Initialize a manager for a given memory type. 469 * Initialize a manager for a given memory type.
@@ -458,7 +476,7 @@ extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
458 */ 476 */
459 477
460extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type, 478extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
461 unsigned long p_offset, unsigned long p_size); 479 unsigned long p_size);
462/** 480/**
463 * ttm_bo_clean_mm 481 * ttm_bo_clean_mm
464 * 482 *
@@ -503,7 +521,7 @@ extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
503 * 521 *
504 * Returns: 522 * Returns:
505 * -EINVAL: Invalid or uninitialized memory type. 523 * -EINVAL: Invalid or uninitialized memory type.
506 * -ERESTART: The call was interrupted by a signal while waiting to 524 * -ERESTARTSYS: The call was interrupted by a signal while waiting to
507 * evict a buffer. 525 * evict a buffer.
508 */ 526 */
509 527
@@ -606,7 +624,7 @@ extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
606 * be called from the fops::read and fops::write method. 624 * be called from the fops::read and fops::write method.
607 * Returns: 625 * Returns:
608 * See man (2) write, man(2) read. In particular, 626 * See man (2) write, man(2) read. In particular,
609 * the function may return -EINTR if 627 * the function may return -ERESTARTSYS if
610 * interrupted by a signal. 628 * interrupted by a signal.
611 */ 629 */
612 630