diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4702-drm-amdgpu-Make-amdgpu_vram_mgr_bo_invisible_size-al.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.14.71/4702-drm-amdgpu-Make-amdgpu_vram_mgr_bo_invisible_size-al.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4702-drm-amdgpu-Make-amdgpu_vram_mgr_bo_invisible_size-al.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4702-drm-amdgpu-Make-amdgpu_vram_mgr_bo_invisible_size-al.patch new file mode 100644 index 00000000..9571dfc8 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4702-drm-amdgpu-Make-amdgpu_vram_mgr_bo_invisible_size-al.patch @@ -0,0 +1,60 @@ +From 7bdb23c7e8b5159862fff4872f4b0c7e55741f3b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com> +Date: Thu, 14 Jun 2018 13:02:07 +0200 +Subject: [PATCH 4702/5725] drm/amdgpu: Make amdgpu_vram_mgr_bo_invisible_size + always accurate +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Even BOs with AMDGPU_GEM_CREATE_NO_CPU_ACCESS may end up at least +partially in CPU visible VRAM, in particular when all VRAM is visible. + +v2: +* Don't take VRAM mgr spinlock, not needed (Christian König) +* Make loop logic simpler and clearer. + +Cc: stable@vger.kernel.org +Signed-off-by: Michel Dänzer <michel.daenzer@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_vram_mgr.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +index cce71d3..dc1cb22 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +@@ -107,10 +107,26 @@ static u64 amdgpu_vram_mgr_vis_size(struct amdgpu_device *adev, + */ + u64 amdgpu_vram_mgr_bo_invisible_size(struct amdgpu_bo *bo) + { +- if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS) ++ struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); ++ struct ttm_mem_reg *mem = &bo->tbo.mem; ++ struct drm_mm_node *nodes = mem->mm_node; ++ unsigned pages = mem->num_pages; ++ u64 usage = 0; ++ ++ if (adev->gmc.visible_vram_size == adev->gmc.real_vram_size) ++ return 0; ++ ++ if (mem->start >= adev->gmc.visible_vram_size >> PAGE_SHIFT) + return amdgpu_bo_size(bo); + +- return 0; ++ while (nodes && pages) { ++ usage += nodes->size << PAGE_SHIFT; ++ usage -= amdgpu_vram_mgr_vis_size(adev, nodes); ++ pages -= nodes->size; ++ ++nodes; ++ } ++ ++ return usage; + } + + /** +-- +2.7.4 + |