aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-12-10 11:16:27 -0500
committerDave Airlie <airlied@redhat.com>2009-12-10 23:09:05 -0500
commit09855acb1c2e3779f25317ec9a8ffe1b1784a4a8 (patch)
tree4a96a67c6bc9694036a95aafd4004c9e9b89eadc /include/drm
parent4361e52ad0372e6fd2240a2207b49a4de1f45ca9 (diff)
drm/ttm: Convert ttm_buffer_object_init to use ttm_placement
Convert ttm_buffer_object_init to use struct ttm_placement and rename to ttm_bo_init for consistency with function naming. This allow to give more complex placement at buffer creation. For instance you ask to allocate bo into vram first but if there is not enough vram you can give system as a second possible placement. It also allow to create buffer in a specific range. Also rename ttm_buffer_object_validate to ttm_bo_validate. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/ttm/ttm_bo_api.h63
1 files changed, 30 insertions, 33 deletions
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 4fd498523ce3..81eb9f45883c 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -308,7 +308,7 @@ ttm_bo_reference(struct ttm_buffer_object *bo)
308extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, 308extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
309 bool interruptible, bool no_wait); 309 bool interruptible, bool no_wait);
310/** 310/**
311 * ttm_buffer_object_validate 311 * ttm_bo_validate
312 * 312 *
313 * @bo: The buffer object. 313 * @bo: The buffer object.
314 * @placement: Proposed placement for the buffer object. 314 * @placement: Proposed placement for the buffer object.
@@ -323,9 +323,9 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
323 * -EBUSY if no_wait is true and buffer busy. 323 * -EBUSY if no_wait is true and buffer busy.
324 * -ERESTARTSYS if interrupted by a signal. 324 * -ERESTARTSYS if interrupted by a signal.
325 */ 325 */
326extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo, 326extern int ttm_bo_validate(struct ttm_buffer_object *bo,
327 struct ttm_placement *placement, 327 struct ttm_placement *placement,
328 bool interruptible, bool no_wait); 328 bool interruptible, bool no_wait);
329 329
330/** 330/**
331 * ttm_bo_unref 331 * ttm_bo_unref
@@ -362,7 +362,7 @@ ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
362extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo); 362extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
363 363
364/** 364/**
365 * ttm_buffer_object_init 365 * ttm_bo_init
366 * 366 *
367 * @bdev: Pointer to a ttm_bo_device struct. 367 * @bdev: Pointer to a ttm_bo_device struct.
368 * @bo: Pointer to a ttm_buffer_object to be initialized. 368 * @bo: Pointer to a ttm_buffer_object to be initialized.
@@ -393,17 +393,17 @@ extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
393 * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources. 393 * -ERESTARTSYS: Interrupted by signal while sleeping waiting for resources.
394 */ 394 */
395 395
396extern int ttm_buffer_object_init(struct ttm_bo_device *bdev, 396extern int ttm_bo_init(struct ttm_bo_device *bdev,
397 struct ttm_buffer_object *bo, 397 struct ttm_buffer_object *bo,
398 unsigned long size, 398 unsigned long size,
399 enum ttm_bo_type type, 399 enum ttm_bo_type type,
400 uint32_t flags, 400 struct ttm_placement *placement,
401 uint32_t page_alignment, 401 uint32_t page_alignment,
402 unsigned long buffer_start, 402 unsigned long buffer_start,
403 bool interrubtible, 403 bool interrubtible,
404 struct file *persistant_swap_storage, 404 struct file *persistant_swap_storage,
405 size_t acc_size, 405 size_t acc_size,
406 void (*destroy) (struct ttm_buffer_object *)); 406 void (*destroy) (struct ttm_buffer_object *));
407/** 407/**
408 * ttm_bo_synccpu_object_init 408 * ttm_bo_synccpu_object_init
409 * 409 *
@@ -424,40 +424,37 @@ extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
424 * GEM user interface. 424 * GEM user interface.
425 * @p_bo: On successful completion *p_bo points to the created object. 425 * @p_bo: On successful completion *p_bo points to the created object.
426 * 426 *
427 * This function allocates a ttm_buffer_object, and then calls 427 * This function allocates a ttm_buffer_object, and then calls ttm_bo_init
428 * ttm_buffer_object_init on that object. 428 * on that object. The destroy function is set to kfree().
429 * The destroy function is set to kfree().
430 * Returns 429 * Returns
431 * -ENOMEM: Out of memory. 430 * -ENOMEM: Out of memory.
432 * -EINVAL: Invalid placement flags. 431 * -EINVAL: Invalid placement flags.
433 * -ERESTARTSYS: Interrupted by signal while waiting for resources. 432 * -ERESTARTSYS: Interrupted by signal while waiting for resources.
434 */ 433 */
435 434
436extern int ttm_buffer_object_create(struct ttm_bo_device *bdev, 435extern int ttm_bo_create(struct ttm_bo_device *bdev,
437 unsigned long size, 436 unsigned long size,
438 enum ttm_bo_type type, 437 enum ttm_bo_type type,
439 uint32_t flags, 438 struct ttm_placement *placement,
440 uint32_t page_alignment, 439 uint32_t page_alignment,
441 unsigned long buffer_start, 440 unsigned long buffer_start,
442 bool interruptible, 441 bool interruptible,
443 struct file *persistant_swap_storage, 442 struct file *persistant_swap_storage,
444 struct ttm_buffer_object **p_bo); 443 struct ttm_buffer_object **p_bo);
445 444
446/** 445/**
447 * ttm_bo_check_placement 446 * ttm_bo_check_placement
448 * 447 *
449 * @bo: the buffer object. 448 * @bo: the buffer object.
450 * @set_flags: placement flags to set. 449 * @placement: placements
451 * @clr_flags: placement flags to clear.
452 * 450 *
453 * Performs minimal validity checking on an intended change of 451 * Performs minimal validity checking on an intended change of
454 * placement flags. 452 * placement flags.
455 * Returns 453 * Returns
456 * -EINVAL: Intended change is invalid or not allowed. 454 * -EINVAL: Intended change is invalid or not allowed.
457 */ 455 */
458
459extern int ttm_bo_check_placement(struct ttm_buffer_object *bo, 456extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
460 uint32_t set_flags, uint32_t clr_flags); 457 struct ttm_placement *placement);
461 458
462/** 459/**
463 * ttm_bo_init_mm 460 * ttm_bo_init_mm