diff mbox series

[5/7] drm/ttm: remove move to new and inline into remainging place.

Message ID 20201020010319.1692445-6-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/ttm: get rid of bind/unbind | expand

Commit Message

Dave Airlie Oct. 20, 2020, 1:03 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

This show the remaining bind callback, which my next series of
patches will aim to remove.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c      | 16 +++++++++-------
 drivers/gpu/drm/ttm/ttm_bo_util.c | 20 --------------------
 include/drm/ttm/ttm_bo_driver.h   |  4 ----
 3 files changed, 9 insertions(+), 31 deletions(-)

Comments

Christian König Oct. 20, 2020, 12:06 p.m. UTC | #1
Am 20.10.20 um 03:03 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> This show the remaining bind callback, which my next series of
> patches will aim to remove.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_bo.c      | 16 +++++++++-------
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 20 --------------------
>   include/drm/ttm/ttm_bo_driver.h   |  4 ----
>   3 files changed, 9 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 358d09ef852a..705ea3ef91f9 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -252,9 +252,15 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
>   		if (ret)
>   			goto out_err;
>   
> -		ret = ttm_bo_move_to_new_tt_mem(bo, ctx, mem);
> -		if (ret)
> -			goto out_err;
> +		if (mem->mem_type != TTM_PL_SYSTEM) {
> +			ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
> +			if (ret)
> +				goto out_err;
> +
> +			ret = bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
> +			if (ret)
> +				goto out_err;
> +		}
>   	}
>   
>   	if (bdev->driver->move_notify)
> @@ -1489,7 +1495,3 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
>   	bo->ttm = NULL;
>   }
>   
> -int ttm_bo_tt_bind(struct ttm_buffer_object *bo, struct ttm_resource *mem)
> -{
> -	return bo->bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
> -}
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 21811bbda2e4..fae31f7f5c35 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -45,26 +45,6 @@ struct ttm_transfer_obj {
>   	struct ttm_buffer_object *bo;
>   };
>   
> -int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
> -			      struct ttm_operation_ctx *ctx,
> -			      struct ttm_resource *new_mem)
> -{
> -	int ret;
> -
> -	if (new_mem->mem_type == TTM_PL_SYSTEM)
> -		return 0;
> -
> -	ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
> -	if (unlikely(ret != 0))
> -		return ret;
> -
> -	ret = ttm_bo_tt_bind(bo, new_mem);
> -	if (unlikely(ret != 0))
> -		return ret;
> -
> -	return 0;
> -}
> -
>   int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
>   		       struct ttm_resource *mem)
>   {
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index fbbcf10670c1..0c4efc169f46 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -560,10 +560,6 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
>   void ttm_mem_io_free(struct ttm_bo_device *bdev,
>   		     struct ttm_resource *mem);
>   
> -int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
> -			      struct ttm_operation_ctx *ctx,
> -			      struct ttm_resource *new_mem);
> -
>   /**
>    * ttm_bo_move_memcpy
>    *
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 358d09ef852a..705ea3ef91f9 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -252,9 +252,15 @@  static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 		if (ret)
 			goto out_err;
 
-		ret = ttm_bo_move_to_new_tt_mem(bo, ctx, mem);
-		if (ret)
-			goto out_err;
+		if (mem->mem_type != TTM_PL_SYSTEM) {
+			ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
+			if (ret)
+				goto out_err;
+
+			ret = bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
+			if (ret)
+				goto out_err;
+		}
 	}
 
 	if (bdev->driver->move_notify)
@@ -1489,7 +1495,3 @@  void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
 	bo->ttm = NULL;
 }
 
-int ttm_bo_tt_bind(struct ttm_buffer_object *bo, struct ttm_resource *mem)
-{
-	return bo->bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
-}
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 21811bbda2e4..fae31f7f5c35 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -45,26 +45,6 @@  struct ttm_transfer_obj {
 	struct ttm_buffer_object *bo;
 };
 
-int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
-			      struct ttm_operation_ctx *ctx,
-			      struct ttm_resource *new_mem)
-{
-	int ret;
-
-	if (new_mem->mem_type == TTM_PL_SYSTEM)
-		return 0;
-
-	ret = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
-	if (unlikely(ret != 0))
-		return ret;
-
-	ret = ttm_bo_tt_bind(bo, new_mem);
-	if (unlikely(ret != 0))
-		return ret;
-
-	return 0;
-}
-
 int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
 		       struct ttm_resource *mem)
 {
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index fbbcf10670c1..0c4efc169f46 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -560,10 +560,6 @@  int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
 void ttm_mem_io_free(struct ttm_bo_device *bdev,
 		     struct ttm_resource *mem);
 
-int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
-			      struct ttm_operation_ctx *ctx,
-			      struct ttm_resource *new_mem);
-
 /**
  * ttm_bo_move_memcpy
  *