summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-09-24 15:18:02 +1000
committerDave Airlie <airlied@redhat.com>2020-09-25 05:48:00 +1000
commit6236d953f7aca13403a1fada9d1dd12978cf93e8 (patch)
tree397963cced05cd9d0187823b5a9312056351ffae /drivers
parentb809979f112b6079acdae2649e2696f0cc812f84 (diff)
downloadlinux-stable-6236d953f7aca13403a1fada9d1dd12978cf93e8.tar.gz
linux-stable-6236d953f7aca13403a1fada9d1dd12978cf93e8.tar.bz2
linux-stable-6236d953f7aca13403a1fada9d1dd12978cf93e8.zip
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 <christian.koenig@amd.com>. Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200924051845.397177-3-airlied@gmail.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 77a998b81843..e11e8eaa6602 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -265,24 +265,22 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
if (ret)
goto out_err;
}
-
- if (bo->mem.mem_type == TTM_PL_SYSTEM) {
- if (bdev->driver->move_notify)
- bdev->driver->move_notify(bo, evict, mem);
- bo->mem = *mem;
- goto moved;
- }
}
if (bdev->driver->move_notify)
bdev->driver->move_notify(bo, evict, mem);
- if (old_man->use_tt && new_man->use_tt)
- ret = ttm_bo_move_ttm(bo, ctx, mem);
- else if (bdev->driver->move)
+ if (old_man->use_tt && new_man->use_tt) {
+ if (bo->mem.mem_type == TTM_PL_SYSTEM) {
+ ttm_bo_assign_mem(bo, mem);
+ ret = 0;
+ } else
+ ret = ttm_bo_move_ttm(bo, ctx, mem);
+ } else if (bdev->driver->move) {
ret = bdev->driver->move(bo, evict, ctx, mem);
- else
+ } else {
ret = ttm_bo_move_memcpy(bo, ctx, mem);
+ }
if (ret) {
if (bdev->driver->move_notify) {
@@ -294,7 +292,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
goto out_err;
}
-moved:
ctx->bytes_moved += bo->num_pages << PAGE_SHIFT;
return 0;