[PATCH 20/45] drm/vmwgfx/ttm: handle move notify inside move.
Dave Airlie
airlied at gmail.com
Thu Sep 24 05:18:20 UTC 2020
From: Dave Airlie <airlied at redhat.com>
This means move notify isn't used for the cleanup path, since
mem would be NULL, so the callback can be removed
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index 6e36fc932aeb..d3262e07e76d 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -704,11 +704,8 @@ static int vmw_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_resourc
* (currently only resources).
*/
static void vmw_move_notify(struct ttm_buffer_object *bo,
- bool evict,
struct ttm_resource *mem)
{
- if (!mem)
- return;
vmw_bo_move_notify(bo, mem);
vmw_query_move_notify(bo, mem);
}
@@ -732,15 +729,21 @@ static int vmw_move(struct ttm_buffer_object *bo,
{
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);
+ int ret;
+ vmw_move_notify(bo, new_mem);
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);
+ ret = ttm_bo_move_ttm(bo, ctx, new_mem);
} else
- return ttm_bo_move_memcpy(bo, ctx, new_mem);
+ ret = ttm_bo_move_memcpy(bo, ctx, new_mem);
+
+ if (ret)
+ vmw_move_notify(bo, &bo->mem);
+ return ret;
}
struct ttm_bo_driver vmw_bo_driver = {
@@ -754,7 +757,6 @@ struct ttm_bo_driver vmw_bo_driver = {
.evict_flags = vmw_evict_flags,
.move = vmw_move,
.verify_access = vmw_verify_access,
- .move_notify = vmw_move_notify,
.swap_notify = vmw_swap_notify,
.io_mem_reserve = &vmw_ttm_io_mem_reserve,
};
--
2.27.0
More information about the dri-devel
mailing list