[PATCH 38/45] drm/nouveau/ttm: use helper to allocate tt temp
Dave Airlie
airlied at gmail.com
Thu Sep 24 05:18:38 UTC 2020
From: Dave Airlie <airlied at redhat.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/nouveau/nouveau_bo.c | 30 +++-------------------------
1 file changed, 3 insertions(+), 27 deletions(-)
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;
--
2.27.0
More information about the dri-devel
mailing list