Re: [PATCH 3/5] drm/ttm: use new move interface for known system->ttm moves

2020-10-19 Thread Christian König

Am 19.10.20 um 09:13 schrieb Dave Airlie:

From: Dave Airlie 

In all 3 drivers there is a case where the driver knows the
bo is in SYSTEM so don't call the api that checks that.

Reviewed-by: Ben Skeggs 
Signed-off-by: Dave Airlie 


Reviewed-by: Christian König 


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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8cdec58b9106..f8c9d66d3ef7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -601,11 +601,11 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object 
*bo, bool evict,
}
  
  	/* move/bind old memory to GTT space */

-   r = ttm_bo_move_ttm(bo, ctx, _mem);
+   r = ttm_bo_move_to_new_tt_mem(bo, ctx, _mem);
if (unlikely(r)) {
goto out_cleanup;
}
-
+   ttm_bo_assign_mem(bo, _mem);
/* copy to VRAM */
r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
if (unlikely(r)) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 4ccb3329014b..63baa9367851 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -927,10 +927,11 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool 
evict,
if (ret)
return ret;
  
-	ret = ttm_bo_move_ttm(bo, ctx, _reg);

+   ret = ttm_bo_move_to_new_tt_mem(bo, ctx, _reg);
if (ret)
goto out;
  
+	ttm_bo_assign_mem(bo, _reg);

ret = nouveau_bo_move_m2mf(bo, true, ctx, new_reg);
if (ret)
goto out;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index d6f42fbc81f4..9437d29248fd 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -275,10 +275,11 @@ static int radeon_move_ram_vram(struct ttm_buffer_object 
*bo,
if (unlikely(r)) {
return r;
}
-   r = ttm_bo_move_ttm(bo, ctx, _mem);
+   r = ttm_bo_move_to_new_tt_mem(bo, ctx, _mem);
if (unlikely(r)) {
goto out_cleanup;
}
+   ttm_bo_assign_mem(bo, _mem);
r = radeon_move_blit(bo, true, new_mem, old_mem);
if (unlikely(r)) {
goto out_cleanup;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 29726652fef7..39e03d99a377 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -64,6 +64,7 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
  
  	return 0;

  }
+EXPORT_SYMBOL(ttm_bo_move_to_new_tt_mem);
  
  static int ttm_bo_move_old_to_system(struct ttm_buffer_object *bo,

 struct ttm_operation_ctx *ctx)


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


[PATCH 3/5] drm/ttm: use new move interface for known system->ttm moves

2020-10-19 Thread Dave Airlie
From: Dave Airlie 

In all 3 drivers there is a case where the driver knows the
bo is in SYSTEM so don't call the api that checks that.

Reviewed-by: Ben Skeggs 
Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 drivers/gpu/drm/nouveau/nouveau_bo.c| 3 ++-
 drivers/gpu/drm/radeon/radeon_ttm.c | 3 ++-
 drivers/gpu/drm/ttm/ttm_bo_util.c   | 1 +
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8cdec58b9106..f8c9d66d3ef7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -601,11 +601,11 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object 
*bo, bool evict,
}
 
/* move/bind old memory to GTT space */
-   r = ttm_bo_move_ttm(bo, ctx, _mem);
+   r = ttm_bo_move_to_new_tt_mem(bo, ctx, _mem);
if (unlikely(r)) {
goto out_cleanup;
}
-
+   ttm_bo_assign_mem(bo, _mem);
/* copy to VRAM */
r = amdgpu_move_blit(bo, evict, new_mem, old_mem);
if (unlikely(r)) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 4ccb3329014b..63baa9367851 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -927,10 +927,11 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool 
evict,
if (ret)
return ret;
 
-   ret = ttm_bo_move_ttm(bo, ctx, _reg);
+   ret = ttm_bo_move_to_new_tt_mem(bo, ctx, _reg);
if (ret)
goto out;
 
+   ttm_bo_assign_mem(bo, _reg);
ret = nouveau_bo_move_m2mf(bo, true, ctx, new_reg);
if (ret)
goto out;
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c 
b/drivers/gpu/drm/radeon/radeon_ttm.c
index d6f42fbc81f4..9437d29248fd 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -275,10 +275,11 @@ static int radeon_move_ram_vram(struct ttm_buffer_object 
*bo,
if (unlikely(r)) {
return r;
}
-   r = ttm_bo_move_ttm(bo, ctx, _mem);
+   r = ttm_bo_move_to_new_tt_mem(bo, ctx, _mem);
if (unlikely(r)) {
goto out_cleanup;
}
+   ttm_bo_assign_mem(bo, _mem);
r = radeon_move_blit(bo, true, new_mem, old_mem);
if (unlikely(r)) {
goto out_cleanup;
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c 
b/drivers/gpu/drm/ttm/ttm_bo_util.c
index 29726652fef7..39e03d99a377 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -64,6 +64,7 @@ int ttm_bo_move_to_new_tt_mem(struct ttm_buffer_object *bo,
 
return 0;
 }
+EXPORT_SYMBOL(ttm_bo_move_to_new_tt_mem);
 
 static 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