diff mbox series

[38/45] drm/nouveau/ttm: use helper to allocate tt temp

Message ID 20200924051845.397177-39-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series TTM move refactoring | expand

Commit Message

Dave Airlie Sept. 24, 2020, 5:18 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/nouveau/nouveau_bo.c | 30 +++-------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index a032fdacf5f8..93f24b828ede 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -884,28 +884,16 @@  nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict,
 		      struct ttm_operation_ctx *ctx,
 		      struct ttm_resource *new_reg)
 {
-	struct ttm_place placement_memtype = {
-		.fpfn = 0,
-		.lpfn = 0,
-		.mem_type = TTM_PL_TT,
-		.flags = TTM_PL_MASK_CACHING
-	};
-	struct ttm_placement placement;
 	struct ttm_resource tmp_reg;
 	int ret;
 
-	placement.num_placement = placement.num_busy_placement = 1;
-	placement.placement = placement.busy_placement = &placement_memtype;
-
-	tmp_reg = *new_reg;
-	tmp_reg.mm_node = NULL;
-	ret = ttm_bo_mem_space(bo, &placement, &tmp_reg, ctx);
+	ret = ttm_bo_create_tt_tmp(bo, ctx, new_reg, &tmp_reg);
 	if (ret)
 		return ret;
 
 	ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
 	if (ret)
-		goto out;
+		return ret;
 
 	ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, &tmp_reg);
 	if (ret)
@@ -936,22 +924,10 @@  nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict,
 		      struct ttm_operation_ctx *ctx,
 		      struct ttm_resource *new_reg)
 {
-	struct ttm_place placement_memtype = {
-		.fpfn = 0,
-		.lpfn = 0,
-		.mem_type = TTM_PL_TT,
-		.flags = TTM_PL_MASK_CACHING
-	};
-	struct ttm_placement placement;
 	struct ttm_resource tmp_reg;
 	int ret;
 
-	placement.num_placement = placement.num_busy_placement = 1;
-	placement.placement = placement.busy_placement = &placement_memtype;
-
-	tmp_reg = *new_reg;
-	tmp_reg.mm_node = NULL;
-	ret = ttm_bo_mem_space(bo, &placement, &tmp_reg, ctx);
+	ret = ttm_bo_create_tt_tmp(bo, ctx, new_reg, &tmp_reg);
 	if (ret)
 		return ret;