Rev 5078 | Rev 6296 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5078 | Rev 5271 | ||
---|---|---|---|
Line 39... | Line 39... | ||
39 | #include |
39 | #include |
40 | //#include |
40 | //#include |
41 | #include |
41 | #include |
Line 42... | Line 42... | ||
42 | 42 | ||
43 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
- | |
Line 44... | Line 43... | ||
44 | #define PAGE_KERNEL __pgprot(3) |
43 | #define __pgprot(x) ((pgprot_t) { (x) } ) |
45 | 44 | ||
Line 46... | Line 45... | ||
46 | void *vmap(struct page **pages, unsigned int count, |
45 | void *vmap(struct page **pages, unsigned int count, |
Line 427... | Line 426... | ||
427 | 426 | ||
428 | static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, |
427 | static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, |
429 | struct ttm_buffer_object **new_obj) |
428 | struct ttm_buffer_object **new_obj) |
430 | { |
429 | { |
431 | struct ttm_buffer_object *fbo; |
- | |
432 | struct ttm_bo_device *bdev = bo->bdev; |
- | |
433 | struct ttm_bo_driver *driver = bdev->driver; |
430 | struct ttm_buffer_object *fbo; |
Line 434... | Line 431... | ||
434 | int ret; |
431 | int ret; |
435 | 432 | ||
436 | fbo = kmalloc(sizeof(*fbo), GFP_KERNEL); |
433 | fbo = kmalloc(sizeof(*fbo), GFP_KERNEL); |
Line 449... | Line 446... | ||
449 | INIT_LIST_HEAD(&fbo->swap); |
446 | INIT_LIST_HEAD(&fbo->swap); |
450 | INIT_LIST_HEAD(&fbo->io_reserve_lru); |
447 | INIT_LIST_HEAD(&fbo->io_reserve_lru); |
451 | drm_vma_node_reset(&fbo->vma_node); |
448 | drm_vma_node_reset(&fbo->vma_node); |
452 | atomic_set(&fbo->cpu_writers, 0); |
449 | atomic_set(&fbo->cpu_writers, 0); |
Line 453... | Line -... | ||
453 | - | ||
454 | spin_lock(&bdev->fence_lock); |
- | |
455 | if (bo->sync_obj) |
- | |
456 | fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); |
- | |
457 | else |
- | |
458 | fbo->sync_obj = NULL; |
- | |
459 | spin_unlock(&bdev->fence_lock); |
450 | |
460 | kref_init(&fbo->list_kref); |
451 | kref_init(&fbo->list_kref); |
461 | kref_init(&fbo->kref); |
452 | kref_init(&fbo->kref); |
462 | fbo->destroy = &ttm_transfered_destroy; |
453 | fbo->destroy = &ttm_transfered_destroy; |
463 | fbo->acc_size = 0; |
454 | fbo->acc_size = 0; |
Line 602... | Line 593... | ||
602 | map->page = NULL; |
593 | map->page = NULL; |
603 | } |
594 | } |
604 | EXPORT_SYMBOL(ttm_bo_kunmap); |
595 | EXPORT_SYMBOL(ttm_bo_kunmap); |
Line 605... | Line 596... | ||
605 | 596 | ||
606 | int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, |
597 | int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, |
607 | void *sync_obj, |
598 | struct fence *fence, |
608 | bool evict, |
599 | bool evict, |
609 | bool no_wait_gpu, |
600 | bool no_wait_gpu, |
610 | struct ttm_mem_reg *new_mem) |
601 | struct ttm_mem_reg *new_mem) |
611 | { |
602 | { |
612 | struct ttm_bo_device *bdev = bo->bdev; |
- | |
613 | struct ttm_bo_driver *driver = bdev->driver; |
603 | struct ttm_bo_device *bdev = bo->bdev; |
614 | struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type]; |
604 | struct ttm_mem_type_manager *man = &bdev->man[new_mem->mem_type]; |
615 | struct ttm_mem_reg *old_mem = &bo->mem; |
605 | struct ttm_mem_reg *old_mem = &bo->mem; |
616 | int ret; |
606 | int ret; |
617 | struct ttm_buffer_object *ghost_obj; |
- | |
Line 618... | Line -... | ||
618 | void *tmp_obj = NULL; |
- | |
619 | - | ||
620 | spin_lock(&bdev->fence_lock); |
- | |
621 | if (bo->sync_obj) { |
- | |
622 | tmp_obj = bo->sync_obj; |
- | |
623 | bo->sync_obj = NULL; |
607 | struct ttm_buffer_object *ghost_obj; |
624 | } |
608 | |
625 | bo->sync_obj = driver->sync_obj_ref(sync_obj); |
609 | reservation_object_add_excl_fence(bo->resv, fence); |
626 | if (evict) { |
- | |
627 | ret = ttm_bo_wait(bo, false, false, false); |
- | |
628 | spin_unlock(&bdev->fence_lock); |
- | |
629 | if (tmp_obj) |
610 | if (evict) { |
630 | driver->sync_obj_unref(&tmp_obj); |
611 | ret = ttm_bo_wait(bo, false, false, false); |
Line 631... | Line 612... | ||
631 | if (ret) |
612 | if (ret) |
632 | return ret; |
613 | return ret; |
Line 646... | Line 627... | ||
646 | * and leave it to be released when the GPU |
627 | * and leave it to be released when the GPU |
647 | * operation has completed. |
628 | * operation has completed. |
648 | */ |
629 | */ |
Line 649... | Line 630... | ||
649 | 630 | ||
650 | set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); |
- | |
651 | spin_unlock(&bdev->fence_lock); |
- | |
652 | if (tmp_obj) |
- | |
Line 653... | Line 631... | ||
653 | driver->sync_obj_unref(&tmp_obj); |
631 | set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); |
654 | 632 | ||
655 | ret = ttm_buffer_object_transfer(bo, &ghost_obj); |
633 | ret = ttm_buffer_object_transfer(bo, &ghost_obj); |
Line -... | Line 634... | ||
- | 634 | if (ret) |
|
- | 635 | return ret; |
|
656 | if (ret) |
636 | |
657 | return ret; |
637 | reservation_object_add_excl_fence(ghost_obj->resv, fence); |
658 | 638 | ||
659 | /** |
639 | /** |
660 | * If we're not moving to fixed memory, the TTM object |
640 | * If we're not moving to fixed memory, the TTM object |