Skip to contentSkip to conversation

drm/amdgpu: use the actual placement for pin accounting

PATCH In review Christian König 8 participants 30 messages Oct 26, 2017 – Oct 27, 2017 18 messages not in the archive

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

PATCH 1/8 drm/amdgpu: use the actual placement for pin accounting

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

This allows us to specify multiple possible placements again.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
index e527c16..76551cd 100644
@@ -697,6 +697,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		}
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
 	}
+
+	domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
 		adev->vram_pin_size += amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-1-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#2 lore raw

PATCH 2/8 drm/amdgpu: always bind pinned BOs

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

We always need to bind pinned BOs, not just when the caller requested the address.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 -7
index 76551cd..0b76d83 100644
@@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		goto error;
 	}
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (unlikely(r)) {
+		dev_err(adev->dev, "%p bind failed\n", bo);
+		goto error;
+	}
+
 	bo->pin_count = 1;
-	if (gpu_addr != NULL) {
-		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
-		if (unlikely(r)) {
-			dev_err(adev->dev, "%p bind failed\n", bo);
-			goto error;
-		}
+	if (gpu_addr != NULL)
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
-	}
 
 	domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-2-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#4 lore raw

RE: [PATCH 2/8] drm/amdgpu: always bind pinned BOs

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 2/8] drm/amdgpu: always bind pinned BOs

Quoted 6 lines

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

We always need to bind pinned BOs, not just when the caller requested the address.

Should this go to stable as well?

Alex

Quoted 33 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 -7
index 76551cd..0b76d83 100644
@@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
 *bo, u32 domain,
 		goto error;
 	}
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (unlikely(r)) {
+		dev_err(adev->dev, "%p bind failed\n", bo);
+		goto error;
+	}
+
 	bo->pin_count = 1;
-	if (gpu_addr != NULL) {
-		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
-		if (unlikely(r)) {
-			dev_err(adev->dev, "%p bind failed\n", bo);
-			goto error;
-		}
+	if (gpu_addr != NULL)
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
-	}
 
 	domain = amdgpu_mem_type_to_domain(bo-
Quoted 1 line

tbo.mem.mem_type);

Quoted 8 lines

if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
--
2.7.4

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

_______________________________________________
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): BN6PR12MB165231D62C6A835680DCF860F7450-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#6 lore raw

Re: [PATCH 2/8] drm/amdgpu: always bind pinned BOs

Am 26.10.2017 um 19:55 schrieb Deucher, Alexander:

Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 2/8] drm/amdgpu: always bind pinned BOs

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

Quoted 7 lines
Quoted 4 lines

We always need to bind pinned BOs, not just when the caller requested the address.

Should this go to stable as well?

Good question. As far as I can see it didn't made a difference so far cause all users of pinned GART BOs provided an address as well.

Just the framebuffer code doesn't do this and so I stumbled over it when allowing scanout from GART.

Christian.

Quoted 40 lines

Alex

Quoted 37 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 -7
index 76551cd..0b76d83 100644
@@ -688,15 +688,15 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
 *bo, u32 domain,
  		goto error;
  	}
 
+	r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
+	if (unlikely(r)) {
+		dev_err(adev->dev, "%p bind failed\n", bo);
+		goto error;
+	}
+
  	bo->pin_count = 1;
-	if (gpu_addr != NULL) {
-		r = amdgpu_ttm_bind(&bo->tbo, &bo->tbo.mem);
-		if (unlikely(r)) {
-			dev_err(adev->dev, "%p bind failed\n", bo);
-			goto error;
-		}
+	if (gpu_addr != NULL)
  		*gpu_addr = amdgpu_bo_gpu_offset(bo);
-	}
 
  	domain = amdgpu_mem_type_to_domain(bo-
Quoted 1 line

tbo.mem.mem_type);

if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
--
2.7.4

Quoted 8 lines
Quoted 4 lines

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

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

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

#7 lore raw

PATCH 3/8 drm/amdgpu: fix pin domain compatibility check

In reply to a message not in the archive

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

We need to test if any domain fits, not all of them.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 0b76d83..65289de 100644
@@ -647,7 +647,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 	if (bo->pin_count) {
 		uint32_t mem_type = bo->tbo.mem.mem_type;
 
-		if (domain != amdgpu_mem_type_to_domain(mem_type))
+		if (!(domain & amdgpu_mem_type_to_domain(mem_type)))
 			return -EINVAL;
 
 		bo->pin_count++;
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-3-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#9 lore raw

RE: [PATCH 3/8] drm/amdgpu: fix pin domain compatibility check

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 3/8] drm/amdgpu: fix pin domain compatibility check

Quoted 5 lines

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

We need to test if any domain fits, not all of them.

Quoted 19 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -1
index 0b76d83..65289de 100644
@@ -647,7 +647,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
 *bo, u32 domain,
 	if (bo->pin_count) {
 		uint32_t mem_type = bo->tbo.mem.mem_type;
 
-		if (domain != amdgpu_mem_type_to_domain(mem_type))
+		if (!(domain &
 amdgpu_mem_type_to_domain(mem_type)))
 			return -EINVAL;
Quoted 8 lines

bo->pin_count++;
--
2.7.4

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

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

#10 lore raw

PATCH 4/8 drm/amdgpu: don't wait interruptible while binding GART space

In reply to a message not in the archive

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

Display can't seem to handle this correctly.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
index e5cab4b..3045701 100644
@@ -913,7 +913,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem)
 	placements.flags = (bo->mem.placement & ~TTM_PL_MASK_MEM) |
 		TTM_PL_FLAG_TT;
 
-	r = ttm_bo_mem_space(bo, &placement, &tmp, true, false);
+	r = ttm_bo_mem_space(bo, &placement, &tmp, false, false);
 	if (unlikely(r))
 		return r;
 
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-4-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Acked-by Alex Deucher
#12 lore raw

RE: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 5 lines

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

Display can't seem to handle this correctly.

Quoted 23 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index e5cab4b..3045701 100644
@@ -913,7 +913,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo,
 struct ttm_mem_reg *bo_mem)
 	placements.flags = (bo->mem.placement & ~TTM_PL_MASK_MEM)

|

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
 		TTM_PL_FLAG_TT;
 
-	r = ttm_bo_mem_space(bo, &placement, &tmp, true, false);
+	r = ttm_bo_mem_space(bo, &placement, &tmp, false, false);
 	if (unlikely(r))
 		return r;
 
--

2.7.4

Quoted 4 lines

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

_______________________________________________
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): BN6PR12MB16521DDD4DFA885F641C0702F7450-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#14 lore raw

Re: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Am 26.10.2017 um 19:56 schrieb Deucher, Alexander:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 6 lines
Quoted 5 lines

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

Display can't seem to handle this correctly.

BTW: Harry & Andrey:

It is probably a good idea to actually wait interruptible here.

How problematic would it be for you guys to allow that?

The only negative effect I could find of hand is some error printing in the DC code.

Christian.

Quoted 24 lines
Quoted 24 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index e5cab4b..3045701 100644
@@ -913,7 +913,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo,
 struct ttm_mem_reg *bo_mem)
  	placements.flags = (bo->mem.placement & ~TTM_PL_MASK_MEM)

|
TTM_PL_FLAG_TT;

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -2
-	r = ttm_bo_mem_space(bo, &placement, &tmp, true, false);
+	r = ttm_bo_mem_space(bo, &placement, &tmp, false, false);
  	if (unlikely(r))
  		return r;
 
--

2.7.4

Quoted 8 lines
Quoted 4 lines

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

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

_______________________________________________
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): 62a8b570-df06-6447-29e1-0d61c4064213-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#16 lore raw

Re: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 16 lines · Christian König

Am 26.10.2017 um 19:56 schrieb Deucher, Alexander:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 6 lines
Quoted 5 lines

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

Display can't seem to handle this correctly.

Quoted 7 lines

BTW: Harry & Andrey:

It is probably a good idea to actually wait interruptible here.

How problematic would it be for you guys to allow that?

The only negative effect I could find of hand is some error printing in the DC code.

It shouldn't be an issue, as i trace this call i see it's gonna impact dm_plane_helper_prepare_fb through calling amdgpu_bo_pin, so instead of treating any r != 0 as error we just should gracefully return for EINTR there w\o printing error.

Thanks,
Andrey

Quoted 37 lines

Christian.

Quoted 32 lines
Quoted 28 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index e5cab4b..3045701 100644
@@ -913,7 +913,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo,
 struct ttm_mem_reg *bo_mem)
      placements.flags = (bo->mem.placement & ~TTM_PL_MASK_MEM)

|

          TTM_PL_FLAG_TT;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1 -1
-    r = ttm_bo_mem_space(bo, &placement, &tmp, true, false);
+    r = ttm_bo_mem_space(bo, &placement, &tmp, false, false);
      if (unlikely(r))
          return r;
Signature · 7 lines
-- 
2.7.4

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

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

_______________________________________________
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): d2eec3af-6f38-202c-c264-0c388264616d-5C7GfCeVMHo@public.gmane.org

#18 lore raw

Re: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 21 lines · Andrey Grodzovsky
Quoted 18 lines · Christian König

Am 26.10.2017 um 19:56 schrieb Deucher, Alexander:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 4/8] drm/amdgpu: don't wait interruptible while binding GART space

Quoted 6 lines
Quoted 5 lines

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

Display can't seem to handle this correctly.

BTW: Harry & Andrey:

Quoted 9 lines
Quoted 5 lines

It is probably a good idea to actually wait interruptible here.

How problematic would it be for you guys to allow that?

The only negative effect I could find of hand is some error printing in the DC code.

It shouldn't be an issue, as i trace this call i see it's gonna impact dm_plane_helper_prepare_fb through calling amdgpu_bo_pin, so instead of treating any r != 0 as error we just should gracefully return for EINTR there w\o printing error.

I tend to agree. It should already work. Just sent a patch, though, to not print an error on EINTR.

Harry

Quoted 41 lines

Thanks,
Andrey

Quoted 37 lines

Christian.

Quoted 32 lines
Quoted 21 lines

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

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +0 -0
index e5cab4b..3045701 100644
@@ -913,7 +913,7 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo,
 struct ttm_mem_reg *bo_mem)
       placements.flags = (bo->mem.placement & ~TTM_PL_MASK_MEM)

|
          TTM_PL_FLAG_TT;

-    r = ttm_bo_mem_space(bo, &placement, &tmp, true, false); +    r = ttm_bo_mem_space(bo, &placement, &tmp, false, false); if (unlikely(r))
          return r;

Quoted 7 lines

--
2.7.4

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

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

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

#19 lore raw

PATCH 5/8 drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

In reply to a message not in the archive

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

Just unbind and rebind to force updates of the GART space.

This prevents forcing the BO to be idle.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -6
index 3045701..b40d2f3 100644
@@ -917,14 +917,26 @@ int amdgpu_ttm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *bo_mem)
 	if (unlikely(r))
 		return r;
 
-	r = ttm_bo_move_ttm(bo, true, false, &tmp);
-	if (unlikely(r))
+	if (ttm->state == tt_bound) {
+		r = ttm->func->unbind(ttm);
+		if (unlikely(r))
+			return r;
+
+		ttm->state = tt_unbound;
+	}
+
+	r = ttm_tt_bind(ttm, &tmp);
+	if (unlikely(r)) {
 		ttm_bo_mem_put(bo, &tmp);
-	else
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-			bo->bdev->man[bo->mem.mem_type].gpu_offset;
+		return r;
+	}
 
-	return r;
+	ttm_bo_mem_put(bo, bo_mem);
+	bo->mem = tmp;
+	bo->offset = (bo->mem.start << PAGE_SHIFT) +
+		bo->bdev->man[bo->mem.mem_type].gpu_offset;
+
+	return 0;
 }
 
 int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-5-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#21 lore raw

RE: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Quoted 5 lines

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

Just unbind and rebind to force updates of the GART space.

This prevents forcing the BO to be idle.

Is there a chance something could change like the caching on a rebind that we need to account for?

Alex

Quoted 49 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24 ++++++++++++++++++-
-----
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -6
index 3045701..b40d2f3 100644
@@ -917,14 +917,26 @@ int amdgpu_ttm_bind(struct ttm_buffer_object
 *bo, struct ttm_mem_reg *bo_mem)
 	if (unlikely(r))
 		return r;
 
-	r = ttm_bo_move_ttm(bo, true, false, &tmp);
-	if (unlikely(r))
+	if (ttm->state == tt_bound) {
+		r = ttm->func->unbind(ttm);
+		if (unlikely(r))
+			return r;
+
+		ttm->state = tt_unbound;
+	}
+
+	r = ttm_tt_bind(ttm, &tmp);
+	if (unlikely(r)) {
 		ttm_bo_mem_put(bo, &tmp);
-	else
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-			bo->bdev->man[bo->mem.mem_type].gpu_offset;
+		return r;
+	}
 
-	return r;
+	ttm_bo_mem_put(bo, bo_mem);
+	bo->mem = tmp;
+	bo->offset = (bo->mem.start << PAGE_SHIFT) +
+		bo->bdev->man[bo->mem.mem_type].gpu_offset;
+
+	return 0;
 }
 

int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
--
2.7.4

Quoted 4 lines

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

_______________________________________________
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): BN6PR12MB1652E2D2EE8BDBA571EC95EAF7450-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#23 lore raw

Re: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Am 26.10.2017 um 20:11 schrieb Deucher, Alexander:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Quoted 6 lines
Quoted 5 lines

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

Just unbind and rebind to force updates of the GART space.

This prevents forcing the BO to be idle.

Is there a chance something could change like the caching on a rebind that we need to account for?

Not that I could think of.

The new placement should have identical attributes to the old one, just with GART space allocated.

Christian.

Quoted 51 lines

Alex

Quoted 48 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24 ++++++++++++++++++-
-----
  1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -6
index 3045701..b40d2f3 100644
@@ -917,14 +917,26 @@ int amdgpu_ttm_bind(struct ttm_buffer_object
 *bo, struct ttm_mem_reg *bo_mem)
  	if (unlikely(r))
  		return r;
 
-	r = ttm_bo_move_ttm(bo, true, false, &tmp);
-	if (unlikely(r))
+	if (ttm->state == tt_bound) {
+		r = ttm->func->unbind(ttm);
+		if (unlikely(r))
+			return r;
+
+		ttm->state = tt_unbound;
+	}
+
+	r = ttm_tt_bind(ttm, &tmp);
+	if (unlikely(r)) {
  		ttm_bo_mem_put(bo, &tmp);
-	else
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-			bo->bdev->man[bo->mem.mem_type].gpu_offset;
+		return r;
+	}
 
-	return r;
+	ttm_bo_mem_put(bo, bo_mem);
+	bo->mem = tmp;
+	bo->offset = (bo->mem.start << PAGE_SHIFT) +
+		bo->bdev->man[bo->mem.mem_type].gpu_offset;
+
+	return 0;
  }
 

int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
--
2.7.4

Quoted 8 lines
Quoted 4 lines

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

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

_______________________________________________
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): 0b9322f4-dc4b-08de-fd90-f188c885ecd7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Acked-by Alex Deucher
#25 lore raw

RE: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Quoted 21 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, October 26, 2017 2:39 PM
To: Deucher, Alexander; 'Christian König'; [email protected]
Subject: Re: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

Am 26.10.2017 um 20:11 schrieb Deucher, Alexander:

Quoted 2 lines
Quoted 2 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On

Behalf

Quoted 10 lines
Quoted 10 lines

Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 5/8] drm/amdgpu: don't use ttm_bo_move_ttm in amdgpu_ttm_bind

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

Just unbind and rebind to force updates of the GART space.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

This prevents forcing the BO to be idle.

Is there a chance something could change like the caching on a rebind that

we need to account for?

Not that I could think of.

The new placement should have identical attributes to the old one, just with GART space allocated.

In that case,

Quoted 4 lines

Christian.

Quoted 1 line
Quoted 60 lines
Quoted 5 lines

Alex

Quoted 3 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24

++++++++++++++++++-

Quoted 53 lines
Quoted 45 lines

-----

  1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +18 -6
index 3045701..b40d2f3 100644
@@ -917,14 +917,26 @@ int amdgpu_ttm_bind(struct ttm_buffer_object
 *bo, struct ttm_mem_reg *bo_mem)
  	if (unlikely(r))
  		return r;
 
-	r = ttm_bo_move_ttm(bo, true, false, &tmp);
-	if (unlikely(r))
+	if (ttm->state == tt_bound) {
+		r = ttm->func->unbind(ttm);
+		if (unlikely(r))
+			return r;
+
+		ttm->state = tt_unbound;
+	}
+
+	r = ttm_tt_bind(ttm, &tmp);
+	if (unlikely(r)) {
  		ttm_bo_mem_put(bo, &tmp);
-	else
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-			bo->bdev->man[bo->mem.mem_type].gpu_offset;
+		return r;
+	}
 
-	return r;
+	ttm_bo_mem_put(bo, bo_mem);
+	bo->mem = tmp;
+	bo->offset = (bo->mem.start << PAGE_SHIFT) +
+		bo->bdev->man[bo->mem.mem_type].gpu_offset;
+
+	return 0;
  }
 

int amdgpu_ttm_recover_gart(struct amdgpu_device *adev)
--
2.7.4

Quoted 4 lines

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

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

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

#26 lore raw

PATCH 6/8 drm/amd/display: enable GPU VM support

In reply to a message not in the archive

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

Just set the bit so that DC does the hardware programming.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
index 2188f20..ed4351a 100644
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
 	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+	init_data.flags.gpu_vm_support = true;
+
 	if (amdgpu_dc_log)
 		init_data.log_mask = DC_DEFAULT_LOG_MASK;
 	else
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-6-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Acked-by Alex Deucher
#28 lore raw

RE: [PATCH 6/8] drm/amd/display: enable GPU VM support

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 6/8] drm/amd/display: enable GPU VM support

Quoted 5 lines

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

Just set the bit so that DC does the hardware programming.

Quoted 22 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
index 2188f20..ed4351a 100644
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device
 *adev)
 
 	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+	init_data.flags.gpu_vm_support = true;
+
 	if (amdgpu_dc_log)
 		init_data.log_mask = DC_DEFAULT_LOG_MASK;

else
--
2.7.4

Quoted 4 lines

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

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

Reviewed-by
#29 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

In reply to a message not in the archive
Quoted 14 lines · Christian König

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

Just set the bit so that DC does the hardware programming.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 424

Quoted 8 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
  	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+	init_data.flags.gpu_vm_support = true;
+
  	if (amdgpu_dc_log)
  		init_data.log_mask = DC_DEFAULT_LOG_MASK;
  	else

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

#30 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

In reply to a message not in the archive
Quoted 14 lines · Christian König

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

Just set the bit so that DC does the hardware programming.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 421

Quoted 5 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
 	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+	init_data.flags.gpu_vm_support = true;
+

Hi Christian,

what ASIC has this been tested on?

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Harry

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 424

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
 	if (amdgpu_dc_log)
 		init_data.log_mask = DC_DEFAULT_LOG_MASK;
 	else

_______________________________________________
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): 058e99f7-c585-5ba7-e22f-2c0a2d7c241b-5C7GfCeVMHo@public.gmane.org

#32 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 16 lines · Christian König
Quoted 15 lines

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

Just set the bit so that DC does the hardware programming.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
Quoted 7 lines

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 421

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
  	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
 
+	init_data.flags.gpu_vm_support = true;
+

Hi Christian,

what ASIC has this been tested on?

Carizzo.

Quoted 1 line

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

Quoted 1 line

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Without this flag tilling fails and only displays a quite unusual pattern.

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Is there any downside on doing so?

Christian.

Quoted 11 lines

Harry

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 424

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
  	if (amdgpu_dc_log)
  		init_data.log_mask = DC_DEFAULT_LOG_MASK;
  	else

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

_______________________________________________
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): 3a5f912f-5161-76a7-af36-6d92abebc7c1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#34 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

Quoted 22 lines · Christian König

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 21 lines · Christian König
Quoted 14 lines

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

Just set the bit so that DC does the hardware programming.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++

  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device · line 420

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device 
 *adev)
       init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
+    init_data.flags.gpu_vm_support = true;
+

Hi Christian,

Quoted 7 lines
Quoted 1 line

what ASIC has this been tested on?

Carizzo.

Quoted 1 line

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

I saw the warnings on my CZ+P10 setup but I didn't note which device was complaining.

And I'd like to think I journeyed into it on my meandering path of testing new commits on the hodgepodge of gear I have :-).

Tom

Quoted 23 lines
Quoted 1 line

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Without this flag tilling fails and only displays a quite unusual pattern.

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Is there any downside on doing so?

Christian.

Quoted 11 lines

Harry

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
       if (amdgpu_dc_log)
           init_data.log_mask = DC_DEFAULT_LOG_MASK;

      else

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

Quoted 4 lines

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

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

#35 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

In reply to a message not in the archive
Quoted 38 lines · Christian König

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 22 lines · Christian König
Quoted 15 lines

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

Just set the bit so that DC does the hardware programming.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++

  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device · line 420

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device
 *adev)
         init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
   +    init_data.flags.gpu_vm_support = true;
+

Hi Christian,

Quoted 1 line

what ASIC has this been tested on?

Carizzo.

Quoted 3 lines

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

Quoted 3 lines

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Quoted 6 lines

Without this flag tilling fails and only displays a quite unusual pattern.

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Is there any downside on doing so?

Is there a particular use-case for scanout from system memory with a dGPU? Otherwise I suspect it's better not to bother, because the failure mode might be pretty bad if the PCIe link can't keep up with scanout.

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

A message that is not in the archive (sent off-list or not yet received): f4a55c92-6209-af56-56a9-527b4e449a03-otUistvHUpPR7s880joybQ@public.gmane.org

#37 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

Am 27.10.2017 um 16:58 schrieb Michel Dänzer:

Quoted 38 lines · Christian König
Quoted 37 lines

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 22 lines · Christian König
Quoted 15 lines

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

Just set the bit so that DC does the hardware programming.

---
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
   1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device · line 420

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device
 *adev)
         init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
   +    init_data.flags.gpu_vm_support = true;
+

Hi Christian,

Quoted 1 line

what ASIC has this been tested on?

Carizzo.

Quoted 3 lines

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

Quoted 3 lines

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Without this flag tilling fails and only displays a quite unusual pattern.

Quoted 7 lines
Quoted 4 lines

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Is there any downside on doing so?

Is there a particular use-case for scanout from system memory with a dGPU? Otherwise I suspect it's better not to bother, because the failure mode might be pretty bad if the PCIe link can't keep up with scanout.

That's true and I actually didn't want to suggest that we scanout from system memory on dGPUs.

But setting up the tilling information in the DCE/DCN VM block anyway looks harmless to me.

And scanning out from scattered VRAM at some point still seems to make sense to me.

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

#38 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

In reply to a message not in the archive
Quoted 29 lines · Christian König

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 20 lines · Christian König
Quoted 14 lines

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

Just set the bit so that DC does the hardware programming.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++

  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 419

Quoted 3 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
         init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
   +    init_data.flags.gpu_vm_support = true;
+

Hi Christian,

Quoted 1 line

what ASIC has this been tested on?

Carizzo.

Quoted 1 line

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

Quoted 8 lines
Quoted 1 line

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Without this flag tilling fails and only displays a quite unusual pattern.

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Is there any downside on doing so?

The way this flag is currently used is for the base driver (amdgpu on Linux, kmd on Windows) to let us know whether VM is being used or not. The options are

1) amdgpu lets us know whether the framebuffer is in virtual memory or not
2) we assume amdgpu always uses virtual memory on ASICs that support it, set this flag to true (as in this patch) and make sure DC only programs it on ASICs that support it

I'd somewhat prefer option 2 as it's simpler from an amdgpu perspective and also keeps DC consistent.

Harry

Quoted 15 lines

Christian.

Quoted 11 lines

Harry

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
       if (amdgpu_dc_log)
           init_data.log_mask = DC_DEFAULT_LOG_MASK;

      else

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

_______________________________________________
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): 49b98f35-1801-ec19-0720-b0aa8b616025-5C7GfCeVMHo@public.gmane.org

#40 lore raw

Re: [PATCH 6/8] drm/amd/display: enable GPU VM support

Am 27.10.2017 um 17:40 schrieb Harry Wentland:

Quoted 33 lines · Christian König
Quoted 32 lines

Am 27.10.2017 um 16:37 schrieb Harry Wentland:

Quoted 20 lines · Christian König
Quoted 14 lines

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

Just set the bit so that DC does the hardware programming.

---
   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
   1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
index 2188f20..ed4351a 100644

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 419

Quoted 3 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -0
@@ -417,6 +417,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
         init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;
   +    init_data.flags.gpu_vm_support = true;
+

Hi Christian,

Quoted 1 line

what ASIC has this been tested on?

Carizzo.

Quoted 1 line

I'm not sure that this won't break dGPU. dGPU doesn't have vm_support but I think DC will still try to write the same registers as for CZ on dGPU if we enable this. We at least need to make sure it doesn't blow up.

Yeah, as Tom already stumbled over as well it causes a warning on Tonga. Currently giving it a spin on Polaris.

Quoted 1 line

As for Raven we use this flag on Windows but only tested the case where VM is actually programmed. If VM isn't programmed it might still work but we'd need to give that a spin.

Without this flag tilling fails and only displays a quite unusual pattern.

I would actually prefer if we can completely remove this flag and instead always enable the VM programming on supported hardware.

Quoted 8 lines
Quoted 2 lines

Is there any downside on doing so?

The way this flag is currently used is for the base driver (amdgpu on Linux, kmd on Windows) to let us know whether VM is being used or not. The options are

1) amdgpu lets us know whether the framebuffer is in virtual memory or not
2) we assume amdgpu always uses virtual memory on ASICs that support it, set this flag to true (as in this patch) and make sure DC only programs it on ASICs that support it

I'd somewhat prefer option 2 as it's simpler from an amdgpu perspective and also keeps DC consistent.

I agree that option 2 sounds better. In this case please provide DC patches to fix the warning and clean things up.

BTW: I've also get a bunch of warning from the DRM core about things DC does. You're probably aware of those problem, but I just wanted to note once more that the backtraces in the log are kind of annoying.

Regards,
Christian.

Quoted 16 lines

Harry

Quoted 13 lines

Christian.

Quoted 10 lines

Harry

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int amdgpu_dm_init(struct amdgpu_device *adev) · line 423

Quoted 4 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
       if (amdgpu_dc_log)
           init_data.log_mask = DC_DEFAULT_LOG_MASK;
       else
 

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

Quoted 4 lines

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

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

#41 lore raw

PATCH 7/8 drm/amdgpu: fix indentation in amdgpu_display.h

In reply to a message not in the archive

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

That was somehow completely of.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.h +2 -3
index 3cc0ef0..11ae4ab 100644
@@ -25,9 +25,8 @@
 
 struct drm_framebuffer *
 amdgpu_user_framebuffer_create(struct drm_device *dev,
-						       struct drm_file *file_priv,
-							   const struct drm_mode_fb_cmd2 *mode_cmd);
-
+			       struct drm_file *file_priv,
+			       const struct drm_mode_fb_cmd2 *mode_cmd);
 void amdgpu_output_poll_changed(struct drm_device *dev);
 
 #endif
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-7-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#43 lore raw

RE: [PATCH 7/8] drm/amdgpu: fix indentation in amdgpu_display.h

Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 7/8] drm/amdgpu: fix indentation in amdgpu_display.h

Quoted 5 lines

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

That was somehow completely of.

Quoted 25 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.h +2 -3
index 3cc0ef0..11ae4ab 100644
@@ -25,9 +25,8 @@
 
 struct drm_framebuffer *
 amdgpu_user_framebuffer_create(struct drm_device *dev,
-						       struct drm_file *file_priv,
-							   const struct
 drm_mode_fb_cmd2 *mode_cmd);
-
+			       struct drm_file *file_priv,
+			       const struct drm_mode_fb_cmd2 *mode_cmd);
 void amdgpu_output_poll_changed(struct drm_device *dev);
 

#endif
--
2.7.4

Quoted 4 lines

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

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

#44 lore raw

PATCH 8/8 drm/amdgpu: allow framebuffer in GART memory as well

In reply to a message not in the archive

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

On CZ and newer APUs we can pin the fb into GART as well as VRAM.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 13 ++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h       |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 10 ++++++----
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 ++++++++++---
 4 files changed, 29 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +12 -1
index 6744e0c..71823f7 100644
@@ -29,6 +29,7 @@
 #include "amdgpu_i2c.h"
 #include "atom.h"
 #include "amdgpu_connectors.h"
+#include "amdgpu_display.h"
 #include <asm/div64.h>
 
 #include <linux/pm_runtime.h>
@@ -188,7 +189,7 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
 		goto cleanup;
 	}
 
-	r = amdgpu_bo_pin(new_abo, AMDGPU_GEM_DOMAIN_VRAM, &base);
+	r = amdgpu_bo_pin(new_abo, amdgpu_framebuffer_domains(adev), &base);
 	if (unlikely(r != 0)) {
 		DRM_ERROR("failed to pin new abo buffer before flip\n");
 		goto unreserve;
@@ -501,6 +502,16 @@ static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
 	.create_handle = amdgpu_user_framebuffer_create_handle,
 };
 
+uint32_t amdgpu_framebuffer_domains(struct amdgpu_device *adev)
+{
+	uint32_t domain = AMDGPU_GEM_DOMAIN_VRAM;
+
+	if (adev->asic_type >= CHIP_CARRIZO && adev->flags & AMD_IS_APU)
+		domain |= AMDGPU_GEM_DOMAIN_GTT;
+
+	return domain;
+}
+
 int
 amdgpu_framebuffer_init(struct drm_device *dev,
 			struct amdgpu_framebuffer *rfb,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.h +1 -0
index 11ae4ab..f241949 100644
@@ -23,6 +23,7 @@
 #ifndef __AMDGPU_DISPLAY_H__
 #define __AMDGPU_DISPLAY_H__
 
+uint32_t amdgpu_framebuffer_domains(struct amdgpu_device *adev);
 struct drm_framebuffer *
 amdgpu_user_framebuffer_create(struct drm_device *dev,
 			       struct drm_file *file_priv,
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +6 -4
index 90fa8e8..9be3228 100644
@@ -38,6 +38,8 @@
 
 #include <linux/vga_switcheroo.h>
 
+#include "amdgpu_display.h"
+
 /* object hierarchy -
    this contains a helper + a amdgpu fb
    the helper contains a pointer to amdgpu framebuffer baseclass.
@@ -124,7 +126,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 	struct drm_gem_object *gobj = NULL;
 	struct amdgpu_bo *abo = NULL;
 	bool fb_tiled = false; /* useful for testing */
-	u32 tiling_flags = 0;
+	u32 tiling_flags = 0, domain;
 	int ret;
 	int aligned_size, size;
 	int height = mode_cmd->height;
@@ -135,12 +137,12 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 	/* need to align pitch with crtc limits */
 	mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd->width, cpp,
 						  fb_tiled);
+	domain = amdgpu_framebuffer_domains(adev);
 
 	height = ALIGN(mode_cmd->height, 8);
 	size = mode_cmd->pitches[0] * height;
 	aligned_size = ALIGN(size, PAGE_SIZE);
-	ret = amdgpu_gem_object_create(adev, aligned_size, 0,
-				       AMDGPU_GEM_DOMAIN_VRAM,
+	ret = amdgpu_gem_object_create(adev, aligned_size, 0, domain,
 				       AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
 				       AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |
 				       AMDGPU_GEM_CREATE_VRAM_CLEARED,
@@ -166,7 +168,7 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
 	}
 
 
-	ret = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM, NULL);
+	ret = amdgpu_bo_pin(abo, domain, NULL);
 	if (ret) {
 		amdgpu_bo_unreserve(abo);
 		goto out_unref;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 -3
index ed4351a..f42804a 100644
@@ -2934,10 +2934,12 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
 {
 	struct amdgpu_framebuffer *afb;
 	struct drm_gem_object *obj;
+	struct amdgpu_device *adev;
 	struct amdgpu_bo *rbo;
-	int r;
 	struct dm_plane_state *dm_plane_state_new, *dm_plane_state_old;
 	unsigned int awidth;
+	uint32_t domain;
+	int r;
 
 	dm_plane_state_old = to_dm_plane_state(plane->state);
 	dm_plane_state_new = to_dm_plane_state(new_state);
@@ -2951,17 +2953,22 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
 
 	obj = afb->obj;
 	rbo = gem_to_amdgpu_bo(obj);
+	adev = amdgpu_ttm_adev(rbo->tbo.bdev);
 	r = amdgpu_bo_reserve(rbo, false);
 	if (unlikely(r != 0))
 		return r;
 
-	r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &afb->address);
 
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		domain = amdgpu_framebuffer_domains(adev);
+	else
+		domain = AMDGPU_GEM_DOMAIN_VRAM;
 
+	r = amdgpu_bo_pin(rbo, domain, &afb->address);
 	amdgpu_bo_unreserve(rbo);
 
 	if (unlikely(r != 0)) {
-		DRM_ERROR("Failed to pin framebuffer\n");
+		DRM_ERROR("Failed to pin framebuffer (%d)\n", r);
 		return r;
 	}
 
Signature · 6 lines
2.7.4

_______________________________________________
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): 1509033983-2977-8-git-send-email-deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Alex Deucher
#46 lore raw

RE: [PATCH 8/8] drm/amdgpu: allow framebuffer in GART memory as well

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 8/8] drm/amdgpu: allow framebuffer in GART memory as well

Quoted 5 lines

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

On CZ and newer APUs we can pin the fb into GART as well as VRAM.

Quoted 168 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c       | 13 ++++++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.h       |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 10 ++++++----
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13
++++++++++---
 4 files changed, 29 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -1
index 6744e0c..71823f7 100644
@@ -29,6 +29,7 @@
 #include "amdgpu_i2c.h"
 #include "atom.h"
 #include "amdgpu_connectors.h"
+#include "amdgpu_display.h"
 #include <asm/div64.h>
 
 #include <linux/pm_runtime.h>
@@ -188,7 +189,7 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc
 *crtc,
 		goto cleanup;
 	}
 
-	r = amdgpu_bo_pin(new_abo, AMDGPU_GEM_DOMAIN_VRAM,
 &base);
+	r = amdgpu_bo_pin(new_abo,
 amdgpu_framebuffer_domains(adev), &base);
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +10 -0
 	if (unlikely(r != 0)) {
 		DRM_ERROR("failed to pin new abo buffer before flip\n");
 		goto unreserve;
@@ -501,6 +502,16 @@ static const struct drm_framebuffer_funcs
 amdgpu_fb_funcs = {
 	.create_handle = amdgpu_user_framebuffer_create_handle,
 };
 
+uint32_t amdgpu_framebuffer_domains(struct amdgpu_device *adev)
+{
+	uint32_t domain = AMDGPU_GEM_DOMAIN_VRAM;
+
+	if (adev->asic_type >= CHIP_CARRIZO && adev->flags &
 AMD_IS_APU)
+		domain |= AMDGPU_GEM_DOMAIN_GTT;
+
+	return domain;
+}
+
 int

amdgpu_framebuffer_init(struct drm_device *dev,

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -0
 			struct amdgpu_framebuffer *rfb,
drivers/gpu/drm/amd/amdgpu/amdgpu_display.h +1 -0
index 11ae4ab..f241949 100644
@@ -23,6 +23,7 @@
 #ifndef __AMDGPU_DISPLAY_H__
 #define __AMDGPU_DISPLAY_H__
 
+uint32_t amdgpu_framebuffer_domains(struct amdgpu_device *adev);
 struct drm_framebuffer *
 amdgpu_user_framebuffer_create(struct drm_device *dev,
 			       struct drm_file *file_priv,
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -1
index 90fa8e8..9be3228 100644
@@ -38,6 +38,8 @@
 
 #include <linux/vga_switcheroo.h>
 
+#include "amdgpu_display.h"
+
 /* object hierarchy -
    this contains a helper + a amdgpu fb
    the helper contains a pointer to amdgpu framebuffer baseclass.
@@ -124,7 +126,7 @@ static int amdgpufb_create_pinned_object(struct
 amdgpu_fbdev *rfbdev,
 	struct drm_gem_object *gobj = NULL;
 	struct amdgpu_bo *abo = NULL;
 	bool fb_tiled = false; /* useful for testing */
-	u32 tiling_flags = 0;
+	u32 tiling_flags = 0, domain;
 	int ret;
 	int aligned_size, size;
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
 	int height = mode_cmd->height;
@@ -135,12 +137,12 @@ static int amdgpufb_create_pinned_object(struct
 amdgpu_fbdev *rfbdev,
 	/* need to align pitch with crtc limits */
 	mode_cmd->pitches[0] = amdgpu_align_pitch(adev, mode_cmd-
 >width, cpp,
 						  fb_tiled);
+	domain = amdgpu_framebuffer_domains(adev);
 
 	height = ALIGN(mode_cmd->height, 8);
 	size = mode_cmd->pitches[0] * height;
 	aligned_size = ALIGN(size, PAGE_SIZE);
-	ret = amdgpu_gem_object_create(adev, aligned_size, 0,
-				       AMDGPU_GEM_DOMAIN_VRAM,
+	ret = amdgpu_gem_object_create(adev, aligned_size, 0, domain,
 

AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |

AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS |

AMDGPU_GEM_CREATE_VRAM_CLEARED,

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +1 -1
@@ -166,7 +168,7 @@ static int amdgpufb_create_pinned_object(struct
 amdgpu_fbdev *rfbdev,
 	}
 
 
-	ret = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM,
 NULL);
+	ret = amdgpu_bo_pin(abo, domain, NULL);
 	if (ret) {
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
 		amdgpu_bo_unreserve(abo);
 		goto out_unref;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -1
index ed4351a..f42804a 100644
@@ -2934,10 +2934,12 @@ static int dm_plane_helper_prepare_fb(struct
 drm_plane *plane,
 {
 	struct amdgpu_framebuffer *afb;
 	struct drm_gem_object *obj;
+	struct amdgpu_device *adev;
 	struct amdgpu_bo *rbo;
-	int r;
 	struct dm_plane_state *dm_plane_state_new,
 *dm_plane_state_old;
 	unsigned int awidth;
+	uint32_t domain;
+	int r;
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -2
 	dm_plane_state_old = to_dm_plane_state(plane->state);
 	dm_plane_state_new = to_dm_plane_state(new_state);
@@ -2951,17 +2953,22 @@ static int dm_plane_helper_prepare_fb(struct
 drm_plane *plane,
 
 	obj = afb->obj;
 	rbo = gem_to_amdgpu_bo(obj);
+	adev = amdgpu_ttm_adev(rbo->tbo.bdev);
 	r = amdgpu_bo_reserve(rbo, false);
 	if (unlikely(r != 0))
 		return r;
 
-	r = amdgpu_bo_pin(rbo, AMDGPU_GEM_DOMAIN_VRAM, &afb-
 >address);
 
+	if (plane->type != DRM_PLANE_TYPE_CURSOR)
+		domain = amdgpu_framebuffer_domains(adev);
+	else
+		domain = AMDGPU_GEM_DOMAIN_VRAM;
 
+	r = amdgpu_bo_pin(rbo, domain, &afb->address);
 	amdgpu_bo_unreserve(rbo);
 
 	if (unlikely(r != 0)) {
-		DRM_ERROR("Failed to pin framebuffer\n");
+		DRM_ERROR("Failed to pin framebuffer (%d)\n", r);
 		return r;

}

Quoted 7 lines

--
2.7.4

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

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

Reviewed-by Alex Deucher
#47 lore raw
In reply to a message not in the archive
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian König
Sent: Thursday, October 26, 2017 12:06 PM
To: [email protected]
Subject: [PATCH 1/8] drm/amdgpu: use the actual placement for pin accounting

Quoted 5 lines

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

This allows us to specify multiple possible placements again.

Quoted 23 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -0
index e527c16..76551cd 100644
@@ -697,6 +697,8 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
 *bo, u32 domain,
 		}
 		*gpu_addr = amdgpu_bo_gpu_offset(bo);
 	}
+
+	domain = amdgpu_mem_type_to_domain(bo-
 >tbo.mem.mem_type);
 	if (domain == AMDGPU_GEM_DOMAIN_VRAM) {
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -1
 		adev->vram_pin_size += amdgpu_bo_size(bo);
 		if (bo->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)
--

2.7.4

Quoted 4 lines

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

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