[PATCH 40/45] drm/amdgpu/ttm: use new ttm helper to create temp tt

Dave Airlie airlied at gmail.com
Thu Sep 24 05:18:40 UTC 2020


From: Dave Airlie <airlied at redhat.com>

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 29 ++-----------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e1133acb8536..1fbcb16a3c24 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -526,22 +526,9 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
 {
 	struct ttm_resource *old_mem = &bo->mem;
 	struct ttm_resource tmp_mem;
-	struct ttm_place placements;
-	struct ttm_placement placement;
 	int r;
 
-	/* create space/pages for new_mem in GTT space */
-	tmp_mem = *new_mem;
-	tmp_mem.mm_node = NULL;
-	placement.num_placement = 1;
-	placement.placement = &placements;
-	placement.num_busy_placement = 1;
-	placement.busy_placement = &placements;
-	placements.fpfn = 0;
-	placements.lpfn = 0;
-	placements.mem_type = TTM_PL_TT;
-	placements.flags = TTM_PL_MASK_CACHING;
-	r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx);
+	r = ttm_bo_create_tt_tmp(bo, ctx, new_mem, &tmp_mem);
 	if (unlikely(r)) {
 		pr_err("Failed to find GTT space for blit from VRAM\n");
 		return r;
@@ -597,22 +584,10 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
 {
 	struct ttm_resource *old_mem = &bo->mem;
 	struct ttm_resource tmp_mem;
-	struct ttm_placement placement;
-	struct ttm_place placements;
 	int r;
 
 	/* make space in GTT for old_mem buffer */
-	tmp_mem = *new_mem;
-	tmp_mem.mm_node = NULL;
-	placement.num_placement = 1;
-	placement.placement = &placements;
-	placement.num_busy_placement = 1;
-	placement.busy_placement = &placements;
-	placements.fpfn = 0;
-	placements.lpfn = 0;
-	placements.mem_type = TTM_PL_TT;
-	placements.flags = TTM_PL_MASK_CACHING;
-	r = ttm_bo_mem_space(bo, &placement, &tmp_mem, ctx);
+	r = ttm_bo_create_tt_tmp(bo, ctx, new_mem, &tmp_mem);
 	if (unlikely(r)) {
 		pr_err("Failed to find GTT space for blit to VRAM\n");
 		return r;
-- 
2.27.0



More information about the dri-devel mailing list