Skip to contentSkip to conversation

drm/amdgpu: use pre-calculated bo size

PATCH In review Nirmoy Das 3 participants 4 messages Apr 13, 2021 – Apr 14, 2021

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/2 drm/amdgpu: use pre-calculated bo size

Use bo->tbo.base.size instead of calculating it from num_pages.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 1345f7eba011..74ecc0c1863f 100644
@@ -1371,7 +1371,7 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
 	if (bo->mem.mem_type != TTM_PL_VRAM)
 		return 0;
 
-	size = bo->mem.num_pages << PAGE_SHIFT;
+	size = bo->base.size;
 	offset = bo->mem.start << PAGE_SHIFT;
 	if ((offset + size) <= adev->gmc.visible_vram_size)
 		return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index 936b3cfdde55..26deace78539 100644
@@ -2048,7 +2048,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
 			return r;
 	}
 
-	num_bytes = bo->tbo.mem.num_pages << PAGE_SHIFT;
+	num_bytes = bo->tbo.base.size;
 	num_loops = 0;
 
 	amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor);
Signature · 6 lines
2.30.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/2 drm/radeon: use pre-calculated bo size

Use bo->tbo.base.size instead of calculating it from num_pages.

---
 drivers/gpu/drm/radeon/radeon_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_object.c +1 -1
index cee11c55fd15..fd8f6ccc267e 100644
@@ -763,7 +763,7 @@ vm_fault_t radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
 	if (bo->mem.mem_type != TTM_PL_VRAM)
 		return 0;
 
-	size = bo->mem.num_pages << PAGE_SHIFT;
+	size = bo->base.size;
 	offset = bo->mem.start << PAGE_SHIFT;
 	if ((offset + size) <= rdev->mc.visible_vram_size)
 		return 0;
Signature · 6 lines
2.30.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/2
#2 lore raw
In reply to Nirmoy Das

Am 13.04.21 um 22:57 schrieb Nirmoy Das:

Quoted 1 line

Use bo->tbo.base.size instead of calculating it from num_pages.

Those don't clash with the two I've send out yesterday, don't they?

Quoted 2 lines
Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 1345f7eba011..74ecc0c1863f 100644
@@ -1371,7 +1371,7 @@ vm_fault_t amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
  	if (bo->mem.mem_type != TTM_PL_VRAM)
  		return 0;
 
-	size = bo->mem.num_pages << PAGE_SHIFT;
+	size = bo->base.size;
  	offset = bo->mem.start << PAGE_SHIFT;
  	if ((offset + size) <= adev->gmc.visible_vram_size)
  		return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index 936b3cfdde55..26deace78539 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_fill_buffer(struct amdgpu_bo *bo, · line 2054

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
@@ -2048,7 +2048,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
  			return r;
  	}
 
-	num_bytes = bo->tbo.mem.num_pages << PAGE_SHIFT;
+	num_bytes = bo->tbo.base.size;
  	num_loops = 0;
 
  	amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor);

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

#3 lore raw
Quoted 4 lines · Christian König

Am 13.04.21 um 22:57 schrieb Nirmoy Das:

Quoted 1 line

Use bo->tbo.base.size instead of calculating it from num_pages.

Those don't clash with the two I've send out yesterday, don't they?

It does, I didn't check dri-devel's [PATCH 1/7] drm/nouveau: use bo->base.size instead of mem->num_pages) series yesterday.

Regards,

Nirmoy

Quoted 27 lines
Quoted 3 lines
Quoted 21 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -0
index 1345f7eba011..74ecc0c1863f 100644
@@ -1371,7 +1371,7 @@ vm_fault_t 
 amdgpu_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
       if (bo->mem.mem_type != TTM_PL_VRAM)
           return 0;
   -    size = bo->mem.num_pages << PAGE_SHIFT;
+    size = bo->base.size;
       offset = bo->mem.start << PAGE_SHIFT;
       if ((offset + size) <= adev->gmc.visible_vram_size)

          return 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -1
index 936b3cfdde55..26deace78539 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_fill_buffer(struct amdgpu_bo *bo, · line 2053

Quoted 8 lines

+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -0
@@ -2048,7 +2048,7 @@ int amdgpu_fill_buffer(struct amdgpu_bo *bo,
               return r;
       }
   -    num_bytes = bo->tbo.mem.num_pages << PAGE_SHIFT;
+    num_bytes = bo->tbo.base.size;
       num_loops = 0;
         amdgpu_res_first(&bo->tbo.mem, 0, num_bytes, &cursor);

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