All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Airlie <airlied@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: christian.koenig@amd.com, bskeggs@redhat.com
Subject: [PATCH 25/45] drm/ttm: don't call ttm_bo_move_ttm from drivers
Date: Thu, 24 Sep 2020 15:18:25 +1000	[thread overview]
Message-ID: <20200924051845.397177-26-airlied@gmail.com> (raw)
In-Reply-To: <20200924051845.397177-1-airlied@gmail.com>

From: Dave Airlie <airlied@redhat.com>

Drop the interface completely

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 12 ++++++++++--
 drivers/gpu/drm/nouveau/nouveau_bo.c       | 10 ++++++++--
 drivers/gpu/drm/radeon/radeon_ttm.c        | 12 ++++++++++--
 drivers/gpu/drm/ttm/ttm_bo_util.c          | 19 -------------------
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 10 +++++++++-
 include/drm/ttm/ttm_bo_driver.h            | 21 ---------------------
 6 files changed, 37 insertions(+), 47 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 18b7d28a0c94..50362f56d2d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -708,8 +708,16 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
 	}
 
 	if (old_mem->mem_type == TTM_PL_TT &&
-	    new_mem->mem_type == TTM_PL_SYSTEM)
-		return ttm_bo_move_ttm(bo, ctx, new_mem);
+	    new_mem->mem_type == TTM_PL_SYSTEM) {
+		r = ttm_bo_move_old_to_system(bo, ctx);
+		if (r)
+			return r;
+		r = ttm_tt_set_placement_caching(bo->ttm, new_mem->placement);
+		if (r)
+			return r;
+		ttm_bo_assign_mem(bo, new_mem);
+		return 0;
+	}
 
 	if (old_mem->mem_type == AMDGPU_PL_GDS ||
 	    old_mem->mem_type == AMDGPU_PL_GWS ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 1ce13223939b..fc0f9e9232db 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1107,8 +1107,14 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
 
 	if (old_reg->mem_type == TTM_PL_TT &&
 	    new_reg->mem_type == TTM_PL_SYSTEM) {
-		ret = ttm_bo_move_ttm(bo, ctx, new_reg);
-		goto out;
+		ret = ttm_bo_move_old_to_system(bo, ctx);
+		if (ret)
+			goto out;
+		ret = ttm_tt_set_placement_caching(bo->ttm, new_reg->placement);
+		if (ret)
+			goto out;
+		ttm_bo_assign_mem(bo, new_reg);
+		return 0;
 	}
 
 	/* Hardware assisted copy. */
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 435dc37eea34..0ea20dc15cb2 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -353,8 +353,16 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
 	}
 
 	if (old_mem->mem_type == TTM_PL_TT &&
-	    new_mem->mem_type == TTM_PL_SYSTEM)
-		return ttm_bo_move_ttm(bo, ctx, new_mem);
+	    new_mem->mem_type == TTM_PL_SYSTEM) {
+		r = ttm_bo_move_old_to_system(bo, ctx);
+		if (r)
+			return r;
+		r = ttm_tt_set_placement_caching(bo->ttm, new_mem->placement);
+		if (r)
+			return r;
+		ttm_bo_assign_mem(bo, new_mem);
+		return 0;
+	}
 
 	if (!rdev->ring[radeon_copy_ring_index(rdev)].ready ||
 	    rdev->asic->copy.copy == NULL) {
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index ac921d6456b7..4ceef9f7dce6 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -89,25 +89,6 @@ int ttm_bo_move_old_to_system(struct ttm_buffer_object *bo,
 }
 EXPORT_SYMBOL(ttm_bo_move_old_to_system);
 
-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_old_to_system(bo, ctx);
-	if (ret)
-		return ret;
-
-	ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem);
-	if (ret)
-		return ret;
-
-	ttm_bo_assign_mem(bo, new_mem);
-	return 0;
-}
-EXPORT_SYMBOL(ttm_bo_move_ttm);
-
 int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
 		       struct ttm_resource *mem)
 {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
index 2a99c24abbdf..0b8d5655e416 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
@@ -742,7 +742,15 @@ static int vmw_move(struct ttm_buffer_object *bo,
 			ttm_bo_assign_mem(bo, new_mem);
 			return 0;
 		}
-		ret = ttm_bo_move_ttm(bo, ctx, new_mem);
+		ret = ttm_bo_move_old_to_system(bo, ctx);
+		if (ret)
+			return ret;
+
+		ret = ttm_bo_move_to_new_tt_mem(bo, ctx, new_mem);
+		if (ret)
+			return ret;
+
+		ttm_bo_assign_mem(bo, new_mem);
 	} else
 		ret = ttm_bo_move_memcpy(bo, ctx, new_mem);
 
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 65cf86b3ba0b..58d2d3a5ed20 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -583,27 +583,6 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
 		       struct ttm_resource *mem);
 void ttm_mem_io_free(struct ttm_bo_device *bdev,
 		     struct ttm_resource *mem);
-/**
- * ttm_bo_move_ttm
- *
- * @bo: A pointer to a struct ttm_buffer_object.
- * @interruptible: Sleep interruptible if waiting.
- * @no_wait_gpu: Return immediately if the GPU is busy.
- * @new_mem: struct ttm_resource indicating where to move.
- *
- * Optimized move function for a buffer object with both old and
- * new placement backed by a TTM. The function will, if successful,
- * free any old aperture space, and set (@new_mem)->mm_node to NULL,
- * and update the (@bo)->mem placement flags. If unsuccessful, the old
- * data remains untouched, and it's up to the caller to free the
- * memory space indicated by @new_mem.
- * Returns:
- * !0: Failure.
- */
-
-int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
-		    struct ttm_operation_ctx *ctx,
-		    struct ttm_resource *new_mem);
 
 int ttm_bo_move_old_to_system(struct ttm_buffer_object *bo,
 			      struct ttm_operation_ctx *ctx);
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-09-24  5:19 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  5:18 [PATCH 00/45] TTM move refactoring Dave Airlie
2020-09-24  5:18 ` [PATCH 01/45] drm/qxl: drop unused code Dave Airlie
2020-09-24 10:23   ` Christian König
2020-09-24  5:18 ` [PATCH 02/45] drm/ttm: handle the SYSTEM->TT path in same place as others Dave Airlie
2020-09-24 10:24   ` Christian König
2020-09-24  5:18 ` [PATCH 03/45] drm/amdgpu/ttm: handle tt moves properly Dave Airlie
2020-09-24 11:10   ` Christian König
2020-09-24  5:18 ` [PATCH 04/45] drm/radeon/ttm: handle ttm " Dave Airlie
2020-09-24 11:10   ` Christian König
2020-09-24  5:18 ` [PATCH 05/45] drm/nouveau/ttm: " Dave Airlie
2020-09-24 11:11   ` Christian König
2020-09-24  5:18 ` [PATCH 06/45] drm/vmwgfx: move null mem checks outside move notifies Dave Airlie
2020-09-24 11:12   ` Christian König
2020-09-24  5:18 ` [PATCH 07/45] drm/vmwgfx: add a move callback Dave Airlie
2020-09-24 11:13   ` Christian König
2020-09-24  5:18 ` [PATCH 08/45] drm/vram_helper: implement a ttm " Dave Airlie
2020-09-24 11:14   ` Christian König
2020-09-24  5:18 ` [PATCH 09/45] drm/ttm: make move callback compulstory Dave Airlie
2020-09-24 11:15   ` Christian König
2020-09-24  5:18 ` [PATCH 10/45] drm/ttm: refactor out common code to setup a new tt backed resource Dave Airlie
2020-09-24 11:17   ` Christian König
2020-09-24  5:18 ` [PATCH 11/45] drm/ttm: split out the move to system from move ttm code Dave Airlie
2020-09-24 11:22   ` Christian König
2020-09-24  5:18 ` [PATCH 12/45] drm/ttm: drop free old node wrapper Dave Airlie
2020-09-24 11:23   ` Christian König
2020-09-24  5:18 ` [PATCH 13/45] drm/ttm: use new move interface for known system->ttm moves Dave Airlie
2020-09-24 11:26   ` Christian König
2020-09-24  5:18 ` [PATCH 14/45] drm/ttm: add move old to system to drivers Dave Airlie
2020-09-24 12:02   ` Christian König
2020-09-24  5:18 ` [PATCH 15/45] drm/ttm: push copy unbind into drivers Dave Airlie
2020-09-24 12:17   ` Christian König
2020-09-24  5:18 ` [PATCH 16/45] drm/radeon/ttm: do move notify actions inside move Dave Airlie
2020-09-24  5:18 ` [PATCH 17/45] drm/amdgpu/ttm: handle invalidation in move callback Dave Airlie
2020-09-24  5:18 ` [PATCH 18/45] drm/nouveau: handle move notify inside " Dave Airlie
2020-09-30  5:53   ` Ben Skeggs
2020-09-24  5:18 ` [PATCH 19/45] drm/qxl/ttm: " Dave Airlie
2020-09-24  5:18 ` [PATCH 20/45] drm/vmwgfx/ttm: handle move notify inside move Dave Airlie
2020-09-24  5:18 ` [PATCH 21/45] drm/vram_helper: call move notify from the move callback Dave Airlie
2020-09-24  5:18 ` [PATCH 22/45] drm/ttm: don't call move notify around move Dave Airlie
2020-09-24  5:18 ` [PATCH 23/45] drm/ttm: move bind out of move_to_new_tt_mem Dave Airlie
2020-09-24  5:18 ` [PATCH 24/45] drm/ttm: handle binding in move callback Dave Airlie
2020-09-24  5:18 ` Dave Airlie [this message]
2020-09-24  5:18 ` [PATCH 26/45] drm/ttm: remove bind/unbind callbacks Dave Airlie
2020-09-24 13:32   ` Christian König
2020-09-24  5:18 ` [PATCH 27/45] drm/radeon/ttm: cleanup move exit paths Dave Airlie
2020-09-24  5:18 ` [PATCH 28/45] drm/nouveau/ttm: memcpy waits for bo already Dave Airlie
2020-09-24  5:18 ` [PATCH 29/45] drm/ttm: don't expose move old to system helper to drivers Dave Airlie
2020-09-24  5:18 ` [PATCH 30/45] drm/ttm: add a new invalidate notify callback Dave Airlie
2020-09-24  9:33   ` Daniel Vetter
2020-09-24 12:25   ` Christian König
2020-09-29  3:23     ` Dave Airlie
2020-09-29  7:05       ` Christian König
2020-09-24  5:18 ` [PATCH 31/45] drm/radeon: switch to " Dave Airlie
2020-09-24  5:18 ` [PATCH 32/45] drm/amdgpu/ttm: " Dave Airlie
2020-09-24  5:18 ` [PATCH 33/45] drm/nouveau/ttm: " Dave Airlie
2020-09-24  5:18 ` [PATCH 34/45] drm/qxl/ttm: move " Dave Airlie
2020-09-24  5:18 ` [PATCH 35/45] drm/vram-helper: move to invalidate callback Dave Airlie
2020-09-24  7:10   ` Thomas Zimmermann
2020-09-24  5:18 ` [PATCH 36/45] drm/ttm: drop move_notify callback Dave Airlie
2020-09-24  5:18 ` [PATCH 37/45] drm/ttm: add a helper to allocate a temp tt for copies Dave Airlie
2020-09-24 12:42   ` Christian König
2020-09-24 23:14     ` Dave Airlie
2020-09-25  7:39       ` Christian König
2020-09-25  8:16         ` Daniel Vetter
2020-09-25  8:18           ` Daniel Vetter
2020-09-25  9:34             ` Christian König
2020-09-25 13:17               ` Daniel Vetter
2020-09-25 13:40                 ` Christian König
2020-09-25 13:56                   ` Daniel Vetter
2020-09-24  5:18 ` [PATCH 38/45] drm/nouveau/ttm: use helper to allocate tt temp Dave Airlie
2020-09-24  5:18 ` [PATCH 39/45] drm/radeon/ttm: use new helper to create tmp tt Dave Airlie
2020-09-24  5:18 ` [PATCH 40/45] drm/amdgpu/ttm: use new ttm helper to create temp tt Dave Airlie
2020-09-24  5:18 ` [PATCH 41/45] drm/amdgpu/ttm: use helper function for caching/populate Dave Airlie
2020-09-24  5:18 ` [PATCH 42/45] drm/radeon/ttm: " Dave Airlie
2020-09-24  5:18 ` [PATCH 43/45] drm/nouveau/ttm: use helper for placement + populaate Dave Airlie
2020-09-24  5:18 ` [PATCH 44/45] drm/ttm: move more functionality into helper function Dave Airlie
2020-09-24  5:18 ` [PATCH 45/45] drm/ttm: add a new helper for a cleaning up after a ram move Dave Airlie
2020-09-24  6:40 ` [PATCH 00/45] TTM move refactoring Dave Airlie
2020-09-30  5:51 ` Ben Skeggs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200924051845.397177-26-airlied@gmail.com \
    --to=airlied@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.