Commit 54409259 authored by Christian König's avatar Christian König

drm/radeon: also try GART for CPU accessed buffers

Placing them exclusively into VRAM might not work all the time.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=78297Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent 4ba4801d
...@@ -699,22 +699,30 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo) ...@@ -699,22 +699,30 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
rbo = container_of(bo, struct radeon_bo, tbo); rbo = container_of(bo, struct radeon_bo, tbo);
radeon_bo_check_tiling(rbo, 0, 0); radeon_bo_check_tiling(rbo, 0, 0);
rdev = rbo->rdev; rdev = rbo->rdev;
if (bo->mem.mem_type == TTM_PL_VRAM) { if (bo->mem.mem_type != TTM_PL_VRAM)
size = bo->mem.num_pages << PAGE_SHIFT; return 0;
offset = bo->mem.start << PAGE_SHIFT;
if ((offset + size) > rdev->mc.visible_vram_size) { size = bo->mem.num_pages << PAGE_SHIFT;
/* hurrah the memory is not visible ! */ offset = bo->mem.start << PAGE_SHIFT;
radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); if ((offset + size) <= rdev->mc.visible_vram_size)
rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; return 0;
r = ttm_bo_validate(bo, &rbo->placement, false, false);
if (unlikely(r != 0)) /* hurrah the memory is not visible ! */
return r; radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
offset = bo->mem.start << PAGE_SHIFT; rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;
/* this should not happen */ r = ttm_bo_validate(bo, &rbo->placement, false, false);
if ((offset + size) > rdev->mc.visible_vram_size) if (unlikely(r == -ENOMEM)) {
return -EINVAL; radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_GTT);
} return ttm_bo_validate(bo, &rbo->placement, false, false);
} else if (unlikely(r != 0)) {
return r;
} }
offset = bo->mem.start << PAGE_SHIFT;
/* this should never happen */
if ((offset + size) > rdev->mc.visible_vram_size)
return -EINVAL;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment