aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
diff options
context:
space:
mode:
authorJohn Brooks <john@fastquake.com>2017-06-27 22:33:21 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:06:34 -0400
commit41d9a6a728ea34d697dc74bc5fea1b6f6c5fce80 (patch)
treebeeb238adeb2626fe55bac93d466250e5a5fe75c /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
parent96cf8271df546d0f4cfc9ddddbc42dce633e0190 (diff)
drm/amdgpu: Don't force BOs into visible VRAM for page faults
There is no need for page faults to force BOs into visible VRAM if it's full, and the time it takes to do so is great enough to cause noticeable stuttering. Add GTT as a possible placement so that if visible VRAM is full, page faults move BOs to GTT instead of evicting other BOs from VRAM. Suggested-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: John Brooks <john@fastquake.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> 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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 93601fbea695..6e24339ecc46 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -974,18 +974,21 @@ int amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
974 974
975 /* hurrah the memory is not visible ! */ 975 /* hurrah the memory is not visible ! */
976 atomic64_inc(&adev->num_vram_cpu_page_faults); 976 atomic64_inc(&adev->num_vram_cpu_page_faults);
977 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM); 977 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_VRAM |
978 AMDGPU_GEM_DOMAIN_GTT);
979
980 /* Avoid costly evictions; only set GTT as a busy placement */
981 abo->placement.num_busy_placement = 1;
982 abo->placement.busy_placement = &abo->placements[1];
983
978 r = ttm_bo_validate(bo, &abo->placement, false, false); 984 r = ttm_bo_validate(bo, &abo->placement, false, false);
979 if (unlikely(r == -ENOMEM)) { 985 if (unlikely(r != 0))
980 amdgpu_ttm_placement_from_domain(abo, AMDGPU_GEM_DOMAIN_GTT);
981 return ttm_bo_validate(bo, &abo->placement, false, false);
982 } else if (unlikely(r != 0)) {
983 return r; 986 return r;
984 }
985 987
986 offset = bo->mem.start << PAGE_SHIFT; 988 offset = bo->mem.start << PAGE_SHIFT;
987 /* this should never happen */ 989 /* this should never happen */
988 if ((offset + size) > adev->mc.visible_vram_size) 990 if (bo->mem.mem_type == TTM_PL_VRAM &&
991 (offset + size) > adev->mc.visible_vram_size)
989 return -EINVAL; 992 return -EINVAL;
990 993
991 return 0; 994 return 0;