drm/ttm: add operation ctx to ttm_bo_validate v2

Give moving a BO into place an operation context to work with.

v2: rebased

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Christian König
2017-04-12 14:24:39 +02:00
committed by Alex Deucher
parent 750a25037c
commit 19be557010
27 changed files with 131 additions and 76 deletions

View File

@@ -1091,9 +1091,8 @@ bool ttm_bo_mem_compat(struct ttm_placement *placement,
EXPORT_SYMBOL(ttm_bo_mem_compat);
int ttm_bo_validate(struct ttm_buffer_object *bo,
struct ttm_placement *placement,
bool interruptible,
bool no_wait_gpu)
struct ttm_placement *placement,
struct ttm_operation_ctx *ctx)
{
int ret;
uint32_t new_flags;
@@ -1103,8 +1102,8 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
* Check whether we need to move buffer.
*/
if (!ttm_bo_mem_compat(placement, &bo->mem, &new_flags)) {
ret = ttm_bo_move_buffer(bo, placement, interruptible,
no_wait_gpu);
ret = ttm_bo_move_buffer(bo, placement, ctx->interruptible,
ctx->no_wait_gpu);
if (ret)
return ret;
} else {
@@ -1219,8 +1218,11 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
WARN_ON(!locked);
}
if (likely(!ret))
ret = ttm_bo_validate(bo, placement, interruptible, false);
if (likely(!ret)) {
struct ttm_operation_ctx ctx = { interruptible, false };
ret = ttm_bo_validate(bo, placement, &ctx);
}
if (unlikely(ret)) {
if (!resv)