Skip to content

Commit 6236d95

Browse files
committed
drm/ttm: handle the SYSTEM->TT path in same place as others.
This just consolidates the code making the flow easier to understand and also helps when moving move to the driver side. Reviewed-by: Christian König <[email protected]>. Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b809979 commit 6236d95

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/gpu/drm/ttm/ttm_bo.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -265,24 +265,22 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
265265
if (ret)
266266
goto out_err;
267267
}
268-
269-
if (bo->mem.mem_type == TTM_PL_SYSTEM) {
270-
if (bdev->driver->move_notify)
271-
bdev->driver->move_notify(bo, evict, mem);
272-
bo->mem = *mem;
273-
goto moved;
274-
}
275268
}
276269

277270
if (bdev->driver->move_notify)
278271
bdev->driver->move_notify(bo, evict, mem);
279272

280-
if (old_man->use_tt && new_man->use_tt)
281-
ret = ttm_bo_move_ttm(bo, ctx, mem);
282-
else if (bdev->driver->move)
273+
if (old_man->use_tt && new_man->use_tt) {
274+
if (bo->mem.mem_type == TTM_PL_SYSTEM) {
275+
ttm_bo_assign_mem(bo, mem);
276+
ret = 0;
277+
} else
278+
ret = ttm_bo_move_ttm(bo, ctx, mem);
279+
} else if (bdev->driver->move) {
283280
ret = bdev->driver->move(bo, evict, ctx, mem);
284-
else
281+
} else {
285282
ret = ttm_bo_move_memcpy(bo, ctx, mem);
283+
}
286284

287285
if (ret) {
288286
if (bdev->driver->move_notify) {
@@ -294,7 +292,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
294292
goto out_err;
295293
}
296294

297-
moved:
298295
ctx->bytes_moved += bo->num_pages << PAGE_SHIFT;
299296
return 0;
300297

0 commit comments

Comments
 (0)