diff options
author | Dave Airlie <airlied@redhat.com> | 2020-10-20 11:03:18 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-10-21 13:44:28 +1000 |
commit | 6d820003295977f865257f1845bcdebc5dab4fb5 (patch) | |
tree | efc350a2cdc7df99d2ac7c1a17fce656d2333c5a /drivers/gpu/drm/qxl | |
parent | 28ee846e83782e61d86075444c5848ab4a329241 (diff) |
drm/ttm: drop move notify around move.
The drivers now do this in the move callback.
move_notify is still needed in the destroy path.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201020010319.1692445-7-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/qxl')
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_ttm.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index 95c4f2c7ab79..a6149e3cc3d2 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -136,24 +136,6 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo, return ttm; } -static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict, - struct ttm_operation_ctx *ctx, - struct ttm_resource *new_mem) -{ - struct ttm_resource *old_mem = &bo->mem; - int ret; - - ret = ttm_bo_wait_ctx(bo, ctx); - if (ret) - return ret; - - if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { - ttm_bo_move_null(bo, new_mem); - return 0; - } - return ttm_bo_move_memcpy(bo, ctx, new_mem); -} - static void qxl_bo_move_notify(struct ttm_buffer_object *bo, bool evict, struct ttm_resource *new_mem) @@ -170,6 +152,33 @@ static void qxl_bo_move_notify(struct ttm_buffer_object *bo, qxl_surface_evict(qdev, qbo, new_mem ? true : false); } +static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict, + struct ttm_operation_ctx *ctx, + struct ttm_resource *new_mem) +{ + struct ttm_resource *old_mem = &bo->mem; + int ret; + + qxl_bo_move_notify(bo, evict, new_mem); + + ret = ttm_bo_wait_ctx(bo, ctx); + if (ret) + goto out; + + if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) { + ttm_bo_move_null(bo, new_mem); + return 0; + } + ret = ttm_bo_move_memcpy(bo, ctx, new_mem); +out: + if (ret) { + swap(*new_mem, bo->mem); + qxl_bo_move_notify(bo, false, new_mem); + swap(*new_mem, bo->mem); + } + return ret; +} + static struct ttm_bo_driver qxl_bo_driver = { .ttm_tt_create = &qxl_ttm_tt_create, .ttm_tt_bind = &qxl_ttm_backend_bind, |