drm/amdgpu: use domain's gpu_offset for start addr
authorFlora Cui <Flora.Cui@amd.com>
Thu, 18 Aug 2016 05:18:09 +0000 (13:18 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 19 Aug 2016 16:32:38 +0000 (12:32 -0400)
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Ken Wang <Qingqing.Wang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index dbab3c0d096dc3bb96ae9ade0fc9eb2dd3536f0e..2c08e1b38656b2be0eef6a74f23ec92d41b4aed9 100644 (file)
@@ -530,11 +530,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
                        *gpu_addr = amdgpu_bo_gpu_offset(bo);
 
                if (max_offset != 0) {
-                       u64 domain_start;
-                       if (domain == AMDGPU_GEM_DOMAIN_VRAM)
-                               domain_start = bo->adev->mc.vram_start;
-                       else
-                               domain_start = bo->adev->mc.gtt_start;
+                       u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset;
                        WARN_ON_ONCE(max_offset <
                                     (amdgpu_bo_gpu_offset(bo) - domain_start));
                }
index 3cf54c1b21d4cd6c1a65db44d78eade71802044f..783a9703c1607df60e85254d7461cac6e04868d0 100644 (file)
@@ -257,10 +257,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 
        switch (old_mem->mem_type) {
        case TTM_PL_VRAM:
-               old_start += adev->mc.vram_start;
-               break;
        case TTM_PL_TT:
-               old_start += adev->mc.gtt_start;
+               old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;
                break;
        default:
                DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
@@ -268,10 +266,8 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
        }
        switch (new_mem->mem_type) {
        case TTM_PL_VRAM:
-               new_start += adev->mc.vram_start;
-               break;
        case TTM_PL_TT:
-               new_start += adev->mc.gtt_start;
+               new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;
                break;
        default:
                DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);