diff options
author | Christian König <deathsimple@vodafone.de> | 2012-09-11 10:10:00 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-09-20 13:10:42 -0400 |
commit | 421ca7ab86aef01b4e22fb171d3d6bad6f1a5b96 (patch) | |
tree | 25cc4f585579dc2fecd7a7778b9a6fd5b97122ee | |
parent | ca19f21ece0ad96c77f45a01c43f3bb582f1a35c (diff) |
drm/radeon: move and rename radeon_bo_va function
It doesn't really belong into the object functions,
also rename it to avoid collisions with struct radeon_bo_va.
Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gart.c | 34 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_object.h | 2 |
5 files changed, 33 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 55f17f9bc095..8cca1d2f0510 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1846,6 +1846,8 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
1846 | struct ttm_mem_reg *mem); | 1846 | struct ttm_mem_reg *mem); |
1847 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, | 1847 | void radeon_vm_bo_invalidate(struct radeon_device *rdev, |
1848 | struct radeon_bo *bo); | 1848 | struct radeon_bo *bo); |
1849 | struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm, | ||
1850 | struct radeon_bo *bo); | ||
1849 | int radeon_vm_bo_add(struct radeon_device *rdev, | 1851 | int radeon_vm_bo_add(struct radeon_device *rdev, |
1850 | struct radeon_vm *vm, | 1852 | struct radeon_vm *vm, |
1851 | struct radeon_bo *bo, | 1853 | struct radeon_bo *bo, |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 1b1c001e269a..2c594910064d 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -662,7 +662,31 @@ void radeon_vm_fence(struct radeon_device *rdev, | |||
662 | vm->fence = radeon_fence_ref(fence); | 662 | vm->fence = radeon_fence_ref(fence); |
663 | } | 663 | } |
664 | 664 | ||
665 | /* object have to be reserved */ | 665 | /** |
666 | * radeon_vm_bo_find - find the bo_va for a specific vm & bo | ||
667 | * | ||
668 | * @vm: requested vm | ||
669 | * @bo: requested buffer object | ||
670 | * | ||
671 | * Find @bo inside the requested vm (cayman+). | ||
672 | * Search inside the @bos vm list for the requested vm | ||
673 | * Returns the found bo_va or NULL if none is found | ||
674 | * | ||
675 | * Object has to be reserved! | ||
676 | */ | ||
677 | struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm, | ||
678 | struct radeon_bo *bo) | ||
679 | { | ||
680 | struct radeon_bo_va *bo_va; | ||
681 | |||
682 | list_for_each_entry(bo_va, &bo->va, bo_list) { | ||
683 | if (bo_va->vm == vm) { | ||
684 | return bo_va; | ||
685 | } | ||
686 | } | ||
687 | return NULL; | ||
688 | } | ||
689 | |||
666 | /** | 690 | /** |
667 | * radeon_vm_bo_add - add a bo to a specific vm | 691 | * radeon_vm_bo_add - add a bo to a specific vm |
668 | * | 692 | * |
@@ -676,6 +700,8 @@ void radeon_vm_fence(struct radeon_device *rdev, | |||
676 | * Add @bo to the list of bos associated with the vm and validate | 700 | * Add @bo to the list of bos associated with the vm and validate |
677 | * the offset requested within the vm address space. | 701 | * the offset requested within the vm address space. |
678 | * Returns 0 for success, error for failure. | 702 | * Returns 0 for success, error for failure. |
703 | * | ||
704 | * Object has to be reserved! | ||
679 | */ | 705 | */ |
680 | int radeon_vm_bo_add(struct radeon_device *rdev, | 706 | int radeon_vm_bo_add(struct radeon_device *rdev, |
681 | struct radeon_vm *vm, | 707 | struct radeon_vm *vm, |
@@ -823,7 +849,7 @@ int radeon_vm_bo_update_pte(struct radeon_device *rdev, | |||
823 | if (vm->sa_bo == NULL) | 849 | if (vm->sa_bo == NULL) |
824 | return 0; | 850 | return 0; |
825 | 851 | ||
826 | bo_va = radeon_bo_va(bo, vm); | 852 | bo_va = radeon_vm_bo_find(vm, bo); |
827 | if (bo_va == NULL) { | 853 | if (bo_va == NULL) { |
828 | dev_err(rdev->dev, "bo %p not in vm %p\n", bo, vm); | 854 | dev_err(rdev->dev, "bo %p not in vm %p\n", bo, vm); |
829 | return -EINVAL; | 855 | return -EINVAL; |
@@ -912,7 +938,7 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
912 | struct radeon_bo_va *bo_va; | 938 | struct radeon_bo_va *bo_va; |
913 | int r; | 939 | int r; |
914 | 940 | ||
915 | bo_va = radeon_bo_va(bo, vm); | 941 | bo_va = radeon_vm_bo_find(vm, bo); |
916 | if (bo_va == NULL) | 942 | if (bo_va == NULL) |
917 | return 0; | 943 | return 0; |
918 | 944 | ||
@@ -1009,7 +1035,7 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm) | |||
1009 | */ | 1035 | */ |
1010 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); | 1036 | r = radeon_bo_reserve(rdev->ring_tmp_bo.bo, false); |
1011 | if (!r) { | 1037 | if (!r) { |
1012 | bo_va = radeon_bo_va(rdev->ring_tmp_bo.bo, vm); | 1038 | bo_va = radeon_vm_bo_find(vm, rdev->ring_tmp_bo.bo); |
1013 | list_del_init(&bo_va->bo_list); | 1039 | list_del_init(&bo_va->bo_list); |
1014 | list_del_init(&bo_va->vm_list); | 1040 | list_del_init(&bo_va->vm_list); |
1015 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); | 1041 | radeon_bo_unreserve(rdev->ring_tmp_bo.bo); |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 1b57b0058ad6..6cac5cca3d81 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -461,7 +461,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, | |||
461 | } | 461 | } |
462 | switch (args->operation) { | 462 | switch (args->operation) { |
463 | case RADEON_VA_MAP: | 463 | case RADEON_VA_MAP: |
464 | bo_va = radeon_bo_va(rbo, &fpriv->vm); | 464 | bo_va = radeon_vm_bo_find(&fpriv->vm, rbo); |
465 | if (bo_va) { | 465 | if (bo_va) { |
466 | args->operation = RADEON_VA_RESULT_VA_EXIST; | 466 | args->operation = RADEON_VA_RESULT_VA_EXIST; |
467 | args->offset = bo_va->soffset; | 467 | args->offset = bo_va->soffset; |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 9024e7222839..2844e0b204b0 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -646,16 +646,3 @@ int radeon_bo_reserve(struct radeon_bo *bo, bool no_wait) | |||
646 | } | 646 | } |
647 | return 0; | 647 | return 0; |
648 | } | 648 | } |
649 | |||
650 | /* object have to be reserved */ | ||
651 | struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, struct radeon_vm *vm) | ||
652 | { | ||
653 | struct radeon_bo_va *bo_va; | ||
654 | |||
655 | list_for_each_entry(bo_va, &rbo->va, bo_list) { | ||
656 | if (bo_va->vm == vm) { | ||
657 | return bo_va; | ||
658 | } | ||
659 | } | ||
660 | return NULL; | ||
661 | } | ||
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h index 17fb99f177cf..2aaf6e305e42 100644 --- a/drivers/gpu/drm/radeon/radeon_object.h +++ b/drivers/gpu/drm/radeon/radeon_object.h | |||
@@ -141,8 +141,6 @@ extern void radeon_bo_move_notify(struct ttm_buffer_object *bo, | |||
141 | struct ttm_mem_reg *mem); | 141 | struct ttm_mem_reg *mem); |
142 | extern int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo); | 142 | extern int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo); |
143 | extern int radeon_bo_get_surface_reg(struct radeon_bo *bo); | 143 | extern int radeon_bo_get_surface_reg(struct radeon_bo *bo); |
144 | extern struct radeon_bo_va *radeon_bo_va(struct radeon_bo *rbo, | ||
145 | struct radeon_vm *vm); | ||
146 | 144 | ||
147 | /* | 145 | /* |
148 | * sub allocation | 146 | * sub allocation |