Skip to content
Snippets Groups Projects
Commit b8b99c7d authored by Dave Airlie's avatar Dave Airlie
Browse files
parent 87ed9423
No related branches found
No related tags found
No related merge requests found
...@@ -65,27 +65,38 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo, ...@@ -65,27 +65,38 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
return 0; return 0;
} }
int ttm_bo_move_ttm(struct ttm_buffer_object *bo, static int ttm_bo_move_to_system(struct ttm_buffer_object *bo,
struct ttm_operation_ctx *ctx, struct ttm_operation_ctx *ctx)
struct ttm_resource *new_mem)
{ {
struct ttm_resource *old_mem = &bo->mem; struct ttm_resource *old_mem = &bo->mem;
int ret; int ret;
if (old_mem->mem_type != TTM_PL_SYSTEM) { if (old_mem->mem_type == TTM_PL_SYSTEM)
ret = ttm_bo_wait_ctx(bo, ctx); return 0;
if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS)
pr_err("Failed to expire sync object before unbinding TTM\n");
return ret;
}
ttm_bo_tt_unbind(bo); ret = ttm_bo_wait_ctx(bo, ctx);
ttm_resource_free(bo, &bo->mem); if (unlikely(ret != 0)) {
old_mem->mem_type = TTM_PL_SYSTEM; if (ret != -ERESTARTSYS)
pr_err("Failed to expire sync object before unbinding TTM\n");
return ret;
} }
ttm_bo_tt_unbind(bo);
ttm_resource_free(bo, &bo->mem);
old_mem->mem_type = TTM_PL_SYSTEM;
return 0;
}
int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
struct ttm_operation_ctx *ctx,
struct ttm_resource *new_mem)
{
int ret;
ret = ttm_bo_move_to_system(bo, ctx);
if (unlikely(ret != 0))
return ret;
ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem); ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment