drm/nouveau/ttm: handle ttm moves properly.
authorDave Airlie <airlied@redhat.com>
Thu, 24 Sep 2020 05:18:05 +0000 (15:18 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 5 Oct 2020 23:59:25 +0000 (09:59 +1000)
The idea is to flip the core over to calling the driver always,
so add support for moves here.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-6-airlied@gmail.com
drivers/gpu/drm/nouveau/nouveau_bo.c

index 1d4b16c0e353bd00cf6f9919c15b387111f72ec4..c7f42c4a93952e3b93204dfa954020f410dbc45d 100644 (file)
@@ -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)