drm/amdgpu: use explicit limit for VRAM_CONTIGUOUS
authorChristian König <christian.koenig@amd.com>
Wed, 24 Aug 2016 12:30:21 +0000 (14:30 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 25 Oct 2016 18:38:14 +0000 (14:38 -0400)
Split VRAM won't have a valid offset, so just set an explicit limit
when the flag is given to trigger reallocation if necessary.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

index ba41807eb91701757d8196b18a55bbd809df6886..c6754e71e1f5bc41df88b0fc94453d40c313fc0d 100644 (file)
@@ -121,12 +121,17 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
 
        if (domain & AMDGPU_GEM_DOMAIN_VRAM) {
                unsigned visible_pfn = adev->mc.visible_vram_size >> PAGE_SHIFT;
+               unsigned lpfn = 0;
+
+               /* This forces a reallocation if the flag wasn't set before */
+               if (flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)
+                       lpfn = adev->mc.real_vram_size >> PAGE_SHIFT;
 
                if (flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS &&
                    !(flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) &&
                    adev->mc.visible_vram_size < adev->mc.real_vram_size) {
                        places[c].fpfn = visible_pfn;
-                       places[c].lpfn = 0;
+                       places[c].lpfn = lpfn;
                        places[c].flags = TTM_PL_FLAG_WC |
                                TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM |
                                TTM_PL_FLAG_TOPDOWN;
@@ -134,7 +139,7 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
                }
 
                places[c].fpfn = 0;
-               places[c].lpfn = 0;
+               places[c].lpfn = lpfn;
                places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
                        TTM_PL_FLAG_VRAM;
                if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)