From: Dave Airlie Date: Thu, 24 Sep 2020 05:18:05 +0000 (+1000) Subject: drm/nouveau/ttm: handle ttm moves properly. X-Git-Tag: v5.15~303^2~28^2~1673 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12b68474e6d550ccbe7c47b8e293b6ef05cea3eb;p=platform%2Fkernel%2Flinux-starfive.git drm/nouveau/ttm: handle ttm moves properly. The idea is to flip the core over to calling the driver always, so add support for moves here. Signed-off-by: Dave Airlie Acked-by: Christian König Reviewed-by: Ben Skeggs Signed-off-by: Dave Airlie Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-6-airlied@gmail.com --- diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 1d4b16c..c7f42c4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -1057,6 +1057,18 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, goto out; } + if (old_reg->mem_type == TTM_PL_SYSTEM && + new_reg->mem_type == TTM_PL_TT) { + ttm_bo_move_null(bo, new_reg); + goto out; + } + + if (old_reg->mem_type == TTM_PL_TT && + new_reg->mem_type == TTM_PL_SYSTEM) { + ret = ttm_bo_move_ttm(bo, ctx, new_reg); + goto out; + } + /* Hardware assisted copy. */ if (drm->ttm.move) { if (new_reg->mem_type == TTM_PL_SYSTEM)