Commit 0ef1ed81 authored by Dave Airlie's avatar Dave Airlie

drm/ttm: add bo wait that takes a ctx wrapper.

I'm thinking of pushing the wait into the drivers.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200923030454.362731-6-airlied@gmail.com
parent 54661867
...@@ -1062,7 +1062,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -1062,7 +1062,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
struct nouveau_drm_tile *new_tile = NULL; struct nouveau_drm_tile *new_tile = NULL;
int ret = 0; int ret = 0;
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait_ctx(bo, ctx);
if (ret) if (ret)
return ret; return ret;
...@@ -1097,7 +1097,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -1097,7 +1097,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
} }
/* Fallback to software copy. */ /* Fallback to software copy. */
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait_ctx(bo, ctx);
if (ret == 0) if (ret == 0)
ret = ttm_bo_move_memcpy(bo, ctx, new_reg); ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
......
...@@ -160,7 +160,7 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -160,7 +160,7 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
struct ttm_resource *old_mem = &bo->mem; struct ttm_resource *old_mem = &bo->mem;
int ret; int ret;
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait_ctx(bo, ctx);
if (ret) if (ret)
return ret; return ret;
......
...@@ -302,7 +302,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -302,7 +302,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
struct ttm_resource *old_mem = &bo->mem; struct ttm_resource *old_mem = &bo->mem;
int r; int r;
r = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); r = ttm_bo_wait_ctx(bo, ctx);
if (r) if (r)
return r; return r;
......
...@@ -59,7 +59,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ...@@ -59,7 +59,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
int ret; int ret;
if (old_mem->mem_type != TTM_PL_SYSTEM) { if (old_mem->mem_type != TTM_PL_SYSTEM) {
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait_ctx(bo, ctx);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
...@@ -231,7 +231,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, ...@@ -231,7 +231,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
unsigned long add = 0; unsigned long add = 0;
int dir; int dir;
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait_ctx(bo, ctx);
if (ret) if (ret)
return ret; return ret;
......
...@@ -261,6 +261,11 @@ ttm_bo_get_unless_zero(struct ttm_buffer_object *bo) ...@@ -261,6 +261,11 @@ ttm_bo_get_unless_zero(struct ttm_buffer_object *bo)
*/ */
int ttm_bo_wait(struct ttm_buffer_object *bo, bool interruptible, bool no_wait); int ttm_bo_wait(struct ttm_buffer_object *bo, bool interruptible, bool no_wait);
static inline int ttm_bo_wait_ctx(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx)
{
return ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
}
/** /**
* ttm_bo_mem_compat - Check if proposed placement is compatible with a bo * ttm_bo_mem_compat - Check if proposed placement is compatible with a bo
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment