]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/amdgpu: refuse to reserve io mem for split VRAM buffers
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 16 Feb 2017 22:49:12 +0000 (23:49 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Feb 2017 22:16:28 +0000 (17:16 -0500)
When the fast blit path fails while attempting to move a buffer from RAM
to VRAM, we fall back to a CPU-based memcpy that cannot handle split VRAM
buffers. Instead of crashing, simply fail the buffer move.

Ideally, we would teach TTM about split buffers so that the fallback still
works in this case, but that is quite involved. So for now, apply the
simplest possible fix.

Fixes: 40361bb1704b ("drm/amdgpu: add VRAM manager v2")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@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_ttm.c

index 1154b0a8881d6f9d70194f971c7fb04cffc2d6a7..4c6094eefc51ccd638cf7f73759cd1f4d55e95e5 100644 (file)
@@ -529,6 +529,9 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_
        case TTM_PL_TT:
                break;
        case TTM_PL_VRAM:
+               if (mem->start == AMDGPU_BO_INVALID_OFFSET)
+                       return -EINVAL;
+
                mem->bus.offset = mem->start << PAGE_SHIFT;
                /* check if it's visible */
                if ((mem->bus.offset + mem->bus.size) > adev->mc.visible_vram_size)