Skip to contentSkip to conversation

drm/amdgpu: fix BO move offsets

PATCH In review Christian König 2 participants 2 messages Sep 21, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: fix BO move offsets

From: Christian König <[email protected]>

It's pretty pointless to get the offset first and then initialize it.

Should fix issues with the new GTT manager.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +2 -2
index db89a28..219f056 100644
@@ -272,8 +272,6 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 
 	adev = amdgpu_get_adev(bo->bdev);
 	ring = adev->mman.buffer_funcs_ring;
-	old_start = (u64)old_mem->start << PAGE_SHIFT;
-	new_start = (u64)new_mem->start << PAGE_SHIFT;
 
 	switch (old_mem->mem_type) {
 	case TTM_PL_TT:
@@ -282,6 +280,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 			return r;
 
 	case TTM_PL_VRAM:
+		old_start = (u64)old_mem->start << PAGE_SHIFT;
 		old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;
 		break;
 	default:
@@ -295,6 +294,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 			return r;
 
 	case TTM_PL_VRAM:
+		new_start = (u64)new_mem->start << PAGE_SHIFT;
 		new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;
 		break;
 	default:
Signature · 6 lines
2.5.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1474443568-5786-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 34 lines · Christian König

From: Christian König <[email protected]>

It's pretty pointless to get the offset first and then initialize it.

Should fix issues with the new GTT manager.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
index db89a28..219f056 100644
@@ -272,8 +272,6 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 
 	adev = amdgpu_get_adev(bo->bdev);
 	ring = adev->mman.buffer_funcs_ring;
-	old_start = (u64)old_mem->start << PAGE_SHIFT;
-	new_start = (u64)new_mem->start << PAGE_SHIFT;
 
 	switch (old_mem->mem_type) {
 	case TTM_PL_TT:
@@ -282,6 +280,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 			return r;
 
 	case TTM_PL_VRAM:
+		old_start = (u64)old_mem->start << PAGE_SHIFT;
 		old_start += bo->bdev->man[old_mem->mem_type].gpu_offset;
 		break;
 	default:

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c static int amdgpu_move_blit(struct ttm_buffer_object *bo, · line 300

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -295,6 +294,7 @@ static int amdgpu_move_blit(struct ttm_buffer_object *bo,
 			return r;
 
 	case TTM_PL_VRAM:
+		new_start = (u64)new_mem->start << PAGE_SHIFT;
 		new_start += bo->bdev->man[new_mem->mem_type].gpu_offset;
 		break;
 	default:

P.S. This code could use /* fall through */ comments at the end of switch cases without break.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx