[PATCH 3/5] drm/amdgpu: set the contiguous flag if possible

Christian König ckoenig.leichtzumerken at gmail.com
Tue Apr 27 10:54:08 UTC 2021


This avoids reallocating scanout BOs on first pin in a lot of cases.

Signed-off-by: Christian König <christian.koenig at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 5 +++--
 1 file changed, 3 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 e2cbe19404c0..87c40c4cdd50 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -446,10 +446,11 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
 	}
 	spin_unlock(&mgr->lock);
 
-	atomic64_add(vis_usage, &mgr->vis_usage);
+	if (i == 1)
+		mem->placement |= TTM_PL_FLAG_CONTIGUOUS;
 
+	atomic64_add(vis_usage, &mgr->vis_usage);
 	mem->mm_node = nodes;
-
 	return 0;
 
 error:
-- 
2.25.1



More information about the amd-gfx mailing list