aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-03-28 03:39:14 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-03-28 11:54:51 -0400
commite1a575ada8d2a3c3f107fdd12ac9215f983a7c80 (patch)
tree4e67cb07960cfa27696fde8d5bd4ba7ea3650643
parent0e5585dc870af947fab2af96a88c2d8b4270247c (diff)
drm/radeon: Don't move pinned BOs
The purpose of pinning is to prevent a buffer from moving. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index dd46c38676db..2d901bf28a94 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -799,6 +799,10 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
799 if ((offset + size) <= rdev->mc.visible_vram_size) 799 if ((offset + size) <= rdev->mc.visible_vram_size)
800 return 0; 800 return 0;
801 801
802 /* Can't move a pinned BO to visible VRAM */
803 if (rbo->pin_count > 0)
804 return -EINVAL;
805
802 /* hurrah the memory is not visible ! */ 806 /* hurrah the memory is not visible ! */
803 radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); 807 radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
804 lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; 808 lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index e06ac546a90f..636c1cf7d106 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -397,9 +397,15 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
397 struct ttm_mem_reg *new_mem) 397 struct ttm_mem_reg *new_mem)
398{ 398{
399 struct radeon_device *rdev; 399 struct radeon_device *rdev;
400 struct radeon_bo *rbo;
400 struct ttm_mem_reg *old_mem = &bo->mem; 401 struct ttm_mem_reg *old_mem = &bo->mem;
401 int r; 402 int r;
402 403
404 /* Can't move a pinned BO */
405 rbo = container_of(bo, struct radeon_bo, tbo);
406 if (WARN_ON_ONCE(rbo->pin_count > 0))
407 return -EINVAL;
408
403 rdev = radeon_get_rdev(bo->bdev); 409 rdev = radeon_get_rdev(bo->bdev);
404 if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { 410 if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
405 radeon_move_null(bo, new_mem); 411 radeon_move_null(bo, new_mem);