Skip to contentSkip to conversation

drm/ttm: remove priority hard code when initializing ttm bo

PATCH In review Junwei Zhang 3 participants 4 messages May 11, 2018 1 message not in the archive

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

PATCH 1/2 drm/ttm: remove priority hard code when initializing ttm bo

Then priority could be set before initialization.
By default, it requires to kzalloc ttm bo. In fact, we always do so.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/ttm/ttm_bo.c +0 -1
index 98e06f8..cba5015 100644
@@ -1175,7 +1175,6 @@ int ttm_bo_init_reserved(struct ttm_bo_device *bdev,
 	reservation_object_init(&bo->ttm_resv);
 	atomic_inc(&bo->bdev->glob->bo_count);
 	drm_vma_node_reset(&bo->vma_node);
-	bo->priority = 0;
 
 	/*
 	 * For ttm_bo_type_device buffers, allocate
Signature · 6 lines
1.9.1

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

PATCH 2/2 drm/amdgpu: set ttm bo priority before initialization

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -3
index e62153a..6a9e46a 100644
@@ -419,6 +419,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 
 	bo->tbo.bdev = &adev->mman.bdev;
 	amdgpu_ttm_placement_from_domain(bo, bp->domain);
+	if (bp->type == ttm_bo_type_kernel)
+		bo->tbo.priority = 1;
 
 	r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, bp->type,
 				 &bo->placement, page_align, &ctx, acc_size,
@@ -434,9 +436,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 	else
 		amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0);
 
-	if (bp->type == ttm_bo_type_kernel)
-		bo->tbo.priority = 1;
-
 	if (bp->flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
 	    bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
 		struct dma_fence *fence;
Signature · 6 lines
1.9.1

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

A message that is not in the archive (sent off-list or not yet received): 1526014680-4644-2-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#3 lore raw

RE: [PATCH 2/2] drm/amdgpu: set ttm bo priority before initialization

The series is OK to me, Reviewed-by: Chunming Zhou <[email protected]> It is better to wait Christian to have a look before pushing patch.

Regards,
David Zhou
-----Original Message-----
From: Junwei Zhang [mailto:[email protected]]
Sent: Friday, May 11, 2018 12:58 PM
To: [email protected]; [email protected]
Cc: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; Zhang, Jerry <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: set ttm bo priority before initialization

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
index e62153a..6a9e46a 100644
@@ -419,6 +419,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 
 	bo->tbo.bdev = &adev->mman.bdev;
 	amdgpu_ttm_placement_from_domain(bo, bp->domain);
+	if (bp->type == ttm_bo_type_kernel)
+		bo->tbo.priority = 1;
 
 	r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, bp->type,
 				 &bo->placement, page_align, &ctx, acc_size, @@ -434,9 +436,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,

else
amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0);

- if (bp->type == ttm_bo_type_kernel)
- bo->tbo.priority = 1;
-
if (bp->flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
struct dma_fence *fence;
--
1.9.1

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

maintainer
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: set ttm bo priority before initialization

Looks like a good idea to me as well. Reviewed-by: Christian König <[email protected]> for the series.

Regards,
Christian.

Am 11.05.2018 um 07:27 schrieb Zhou, David(ChunMing):

Quoted 40 lines

The series is OK to me, Reviewed-by: Chunming Zhou <[email protected]> It is better to wait Christian to have a look before pushing patch.

Regards,
David Zhou
-----Original Message-----
From: Junwei Zhang [mailto:[email protected]]
Sent: Friday, May 11, 2018 12:58 PM
To: [email protected]; [email protected]
Cc: Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>; Zhang, Jerry <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: set ttm bo priority before initialization

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
index e62153a..6a9e46a 100644
@@ -419,6 +419,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
 
  	bo->tbo.bdev = &adev->mman.bdev;
  	amdgpu_ttm_placement_from_domain(bo, bp->domain);
+	if (bp->type == ttm_bo_type_kernel)
+		bo->tbo.priority = 1;
 
  	r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, bp->type,
  				 &bo->placement, page_align, &ctx, acc_size, @@ -434,9 +436,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
  	else
  		amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0);
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -4
-	if (bp->type == ttm_bo_type_kernel)
-		bo->tbo.priority = 1;
-
  	if (bp->flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
  	    bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
  		struct dma_fence *fence;
--
Quoted 2 lines

1.9.1

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