diff options
author | Dave Airlie <airlied@redhat.com> | 2020-10-06 03:06:42 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-10-07 08:41:54 +0300 |
commit | bcff5d3e3bab979d820bbabd3f0be13ae6ce6cf5 (patch) | |
tree | 2bc37fcb9c892ee2de701d139d79d09426855535 /drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | |
parent | 279a3010218d517284641b7dac2d65c0ecef78ab (diff) | |
download | linux-bcff5d3e3bab979d820bbabd3f0be13ae6ce6cf5.tar.xz |
drm/vmwgfx: add a move callback.
This just copies the fallback to vmwgfx, I'm going to iterate on this
a bit until it's not the same as the fallback path.
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-4-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c index 2f88d2d79f9a..7b5fd5288870 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c @@ -725,6 +725,24 @@ static void vmw_swap_notify(struct ttm_buffer_object *bo) (void) ttm_bo_wait(bo, false, false); } +static int vmw_move(struct ttm_buffer_object *bo, + bool evict, + struct ttm_operation_ctx *ctx, + struct ttm_resource *new_mem) +{ + struct ttm_resource_manager *old_man = ttm_manager_type(bo->bdev, bo->mem.mem_type); + struct ttm_resource_manager *new_man = ttm_manager_type(bo->bdev, new_mem->mem_type); + + if (old_man->use_tt && new_man->use_tt) { + if (bo->mem.mem_type == TTM_PL_SYSTEM) { + ttm_bo_assign_mem(bo, new_mem); + return 0; + } + return ttm_bo_move_ttm(bo, ctx, new_mem); + } else { + return ttm_bo_move_memcpy(bo, ctx, new_mem); + } +} struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_create = &vmw_ttm_tt_create, @@ -735,7 +753,7 @@ struct ttm_bo_driver vmw_bo_driver = { .ttm_tt_destroy = &vmw_ttm_destroy, .eviction_valuable = ttm_bo_eviction_valuable, .evict_flags = vmw_evict_flags, - .move = NULL, + .move = vmw_move, .verify_access = vmw_verify_access, .move_notify = vmw_move_notify, .swap_notify = vmw_swap_notify, |