drm/amdgpu: fix gtt_mgr bo's offset
authorFlora Cui <Flora.Cui@amd.com>
Tue, 20 Sep 2016 09:07:31 +0000 (17:07 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 28 Sep 2016 20:16:23 +0000 (16:16 -0400)
Signed-off-by: Flora Cui <Flora.Cui@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@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_gtt_mgr.c

index 262e872bea0ec80238038643975ef2524516149e..f86c84427778aecb1ccf2cefd61afb95af3ebf38 100644 (file)
@@ -128,8 +128,9 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
 
        if (!r) {
                mem->start = node->start;
-               tbo->offset = (tbo->mem.start << PAGE_SHIFT) +
-                   tbo->bdev->man[tbo->mem.mem_type].gpu_offset;
+               if (&tbo->mem == mem)
+                       tbo->offset = (tbo->mem.start << PAGE_SHIFT) +
+                           tbo->bdev->man[tbo->mem.mem_type].gpu_offset;
        }
 
        return r;