Re: [PATCH 15/45] drm/ttm: push copy unbind into drivers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 24.09.20 um 07:18 schrieb Dave Airlie:
From: Dave Airlie <airlied@xxxxxxxxxx>

This uninlines ttm_bo_move_old_to_system into 3 places

Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

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

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++++++-
  drivers/gpu/drm/nouveau/nouveau_bo.c    | 7 +++++--
  drivers/gpu/drm/radeon/radeon_ttm.c     | 7 ++++++-
  3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e20ce380f627..d165edacc347 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -66,6 +66,8 @@
  static int amdgpu_ttm_backend_bind(struct ttm_bo_device *bdev,
  				   struct ttm_tt *ttm,
  				   struct ttm_resource *bo_mem);
+static void amdgpu_ttm_backend_unbind(struct ttm_bo_device *bdev,
+				      struct ttm_tt *ttm);
static int amdgpu_ttm_init_on_chip(struct amdgpu_device *adev,
  				    unsigned int type,
@@ -568,10 +570,13 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
  	}
/* move BO (in tmp_mem) to new_mem */
-	r = ttm_bo_move_old_to_system(bo, ctx);
+	r = ttm_bo_wait_ctx(bo, ctx);
  	if (unlikely(r))
  		goto out_cleanup;
+ amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
+	ttm_resource_free(bo, &bo->mem);
+
  	r = ttm_tt_set_placement_caching(bo->ttm, new_mem->placement);
  	if (unlikely(r))
  		goto out_cleanup;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index a95d208c76a1..1e6c2561d692 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -46,7 +46,7 @@
static int nouveau_ttm_tt_bind(struct ttm_bo_device *bdev, struct ttm_tt *ttm,
  			       struct ttm_resource *reg);
-
+static void nouveau_ttm_tt_unbind(struct ttm_bo_device *bdev, struct ttm_tt *ttm);
  /*
   * NV10-NV40 tiling helpers
   */
@@ -915,10 +915,13 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict,
  	if (ret)
  		goto out;
- ret = ttm_bo_move_old_to_system(bo, ctx);
+	ret = ttm_bo_wait_ctx(bo, ctx);
  	if (ret)
  		goto out;
+ nouveau_ttm_tt_unbind(bo->bdev, bo->ttm);
+	ttm_resource_free(bo, &bo->mem);
+
  	ret = ttm_tt_set_placement_caching(bo->ttm, new_reg->placement);
  	if (ret)
  		goto out;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 89455f2d3bb6..10d25d3b83f2 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -59,6 +59,8 @@ static void radeon_ttm_debugfs_fini(struct radeon_device *rdev);
  static int radeon_ttm_tt_bind(struct ttm_bo_device *bdev,
  			      struct ttm_tt *ttm,
  			      struct ttm_resource *bo_mem);
+static void radeon_ttm_tt_unbind(struct ttm_bo_device *bdev,
+				 struct ttm_tt *ttm);
struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev)
  {
@@ -249,10 +251,13 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
  	if (unlikely(r)) {
  		goto out_cleanup;
  	}
-	r = ttm_bo_move_old_to_system(bo, ctx);
+	r = ttm_bo_wait_ctx(bo, ctx);
  	if (unlikely(r))
  		goto out_cleanup;
+ radeon_ttm_tt_unbind(bo->bdev, bo->ttm);
+	ttm_resource_free(bo, &bo->mem);
+
  	r = ttm_tt_set_placement_caching(bo->ttm, new_mem->placement);
  	if (unlikely(r))
  		goto out_cleanup;

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




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux