diff mbox series

[2/4] drm/qxl: clean up qxl_bo_move_notify

Message ID 20210211131659.276275-2-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/vram-helper: cleanup drm_gem_vram_bo_driver_move_notify | expand

Commit Message

Christian König Feb. 11, 2021, 1:16 p.m. UTC
Remove the unused evict parameter and drop swapping bo->mem.

Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/qxl/qxl_ttm.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

Comments

Thomas Zimmermann Feb. 11, 2021, 2:53 p.m. UTC | #1
Hi

Am 11.02.21 um 14:16 schrieb Christian König:
> Remove the unused evict parameter and drop swapping bo->mem.

Could you provide the same patch for vram-helpers as well?

Best regards
Thomas

> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/qxl/qxl_ttm.c | 16 ++++------------
>   1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
> index b7f77eb685cb..47afe95d04a1 100644
> --- a/drivers/gpu/drm/qxl/qxl_ttm.c
> +++ b/drivers/gpu/drm/qxl/qxl_ttm.c
> @@ -121,7 +121,6 @@ static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,
>   }
>   
>   static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
> -			       bool evict,
>   			       struct ttm_resource *new_mem)
>   {
>   	struct qxl_bo *qbo;
> @@ -144,29 +143,22 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
>   	struct ttm_resource *old_mem = &bo->mem;
>   	int ret;
>   
> -	qxl_bo_move_notify(bo, evict, new_mem);
> +	qxl_bo_move_notify(bo, new_mem);
>   
>   	ret = ttm_bo_wait_ctx(bo, ctx);
>   	if (ret)
> -		goto out;
> +		return ret;
>   
>   	if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
>   		ttm_bo_move_null(bo, new_mem);
>   		return 0;
>   	}
> -	ret = ttm_bo_move_memcpy(bo, ctx, new_mem);
> -out:
> -	if (ret) {
> -		swap(*new_mem, bo->mem);
> -		qxl_bo_move_notify(bo, false, new_mem);
> -		swap(*new_mem, bo->mem);
> -	}
> -	return ret;
> +	return ttm_bo_move_memcpy(bo, ctx, new_mem);
>   }
>   
>   static void qxl_bo_delete_mem_notify(struct ttm_buffer_object *bo)
>   {
> -	qxl_bo_move_notify(bo, false, NULL);
> +	qxl_bo_move_notify(bo, NULL);
>   }
>   
>   static struct ttm_device_funcs qxl_bo_driver = {
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index b7f77eb685cb..47afe95d04a1 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -121,7 +121,6 @@  static struct ttm_tt *qxl_ttm_tt_create(struct ttm_buffer_object *bo,
 }
 
 static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
-			       bool evict,
 			       struct ttm_resource *new_mem)
 {
 	struct qxl_bo *qbo;
@@ -144,29 +143,22 @@  static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
 	struct ttm_resource *old_mem = &bo->mem;
 	int ret;
 
-	qxl_bo_move_notify(bo, evict, new_mem);
+	qxl_bo_move_notify(bo, new_mem);
 
 	ret = ttm_bo_wait_ctx(bo, ctx);
 	if (ret)
-		goto out;
+		return ret;
 
 	if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
 		ttm_bo_move_null(bo, new_mem);
 		return 0;
 	}
-	ret = ttm_bo_move_memcpy(bo, ctx, new_mem);
-out:
-	if (ret) {
-		swap(*new_mem, bo->mem);
-		qxl_bo_move_notify(bo, false, new_mem);
-		swap(*new_mem, bo->mem);
-	}
-	return ret;
+	return ttm_bo_move_memcpy(bo, ctx, new_mem);
 }
 
 static void qxl_bo_delete_mem_notify(struct ttm_buffer_object *bo)
 {
-	qxl_bo_move_notify(bo, false, NULL);
+	qxl_bo_move_notify(bo, NULL);
 }
 
 static struct ttm_device_funcs qxl_bo_driver = {