Skip to contentSkip to conversation

drm/amdgpu:fix exclusive mode game texture blank(v2)

PATCH NAK Monk Liu 4 participants 7 messages Sep 30, 2016 – Oct 8, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix exclusive mode game texture blank(v2)

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +7 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 
 	unsigned i;
 	int r = 0;
+	unsigned extra_nop = 0;
 
 	if (num_ibs == 0)
 		return -EINVAL;
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
 		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}
+
 	r = amdgpu_ring_alloc(ring, alloc_size);
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
@@ -165,6 +170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
 	if (vm) {
+		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go too fast than DE */
+
 		r = amdgpu_vm_flush(ring, job);
 		if (r) {
 			amdgpu_ring_undo(ring);
Signature · 6 lines
1.9.1

_______________________________________________
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): 1475211608-17679-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

Reviewed-by Hawking Zhang
#2 lore raw

+ if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
+ extra_nop = 128;
+ }
+
Please remove the redundant braces here. With that fixed, the patch is

Regards,
Hawking

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, September 30, 2016 13:00
To: [email protected]
Cc: Liu, Monk <[email protected]>
Subject: [PATCH] drm/amdgpu:fix exclusive mode game texture blank(v2)

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +5 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 
 	unsigned i;
 	int r = 0;
+	unsigned extra_nop = 0;
 
 	if (num_ibs == 0)
 		return -EINVAL;
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
 		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}
+
 	r = amdgpu_ring_alloc(ring, alloc_size);
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r); @@ -165,6 +170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,

patch_offset = amdgpu_ring_init_cond_exec(ring);

if (vm) {
+ amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go too fast
+than DE */
+
r = amdgpu_vm_flush(ring, job);
if (r) {
amdgpu_ring_undo(ring);
--
1.9.1

_______________________________________________
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

#3 lore raw
In reply to a message not in the archive

NAK, please stop adding workarounds like this into common code.

If we need to add the extra NOPs between each command submission than just do this in one of the existing IP specific callbacks.

Additional to that this sounds more and more like the removal of the double sync wasn't such a good idea.

Christian.

Am 30.09.2016 um 07:00 schrieb Monk Liu:

Quoted 36 lines

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +5 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
 
  	unsigned i;
  	int r = 0;
+	unsigned extra_nop = 0;
 
  	if (num_ibs == 0)
  		return -EINVAL;
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
  		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}
+
  	r = amdgpu_ring_alloc(ring, alloc_size);
  	if (r) {
  		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · line 177

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +2 -0
@@ -165,6 +170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
  	if (vm) {
+		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go too fast than DE */
+
  		r = amdgpu_vm_flush(ring, job);
  		if (r) {
  			amdgpu_ring_undo(ring);

_______________________________________________
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): 5bbe535e-911c-93c5-d2b4-939c2971dc58-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#5 lore raw

Thinking more about this. I assume that windows doesn't run into this problem because of the larger padding for the GFX ring, doesn't they?

Well what do you think about just increasing the padding to what the windows KMD is using then?

Regards,
Christian.

Am 30.09.2016 um 11:06 schrieb Christian König:

Quoted 52 lines

NAK, please stop adding workarounds like this into common code.

If we need to add the extra NOPs between each command submission than just do this in one of the existing IP specific callbacks.

Additional to that this sounds more and more like the removal of the double sync wasn't such a good idea.

Christian.

Am 30.09.2016 um 07:00 schrieb Monk Liu:

Quoted 43 lines

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +5 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
        unsigned i;
      int r = 0;
+    unsigned extra_nop = 0;
        if (num_ibs == 0)
          return -EINVAL;
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
      alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
          num_ibs * amdgpu_ring_get_emit_ib_size(ring);
  +    if (job && !job->vm_needs_flush && ring->type == 
 AMDGPU_RING_TYPE_GFX) {
+        extra_nop = 128;
+    }
+
      r = amdgpu_ring_alloc(ring, alloc_size);
      if (r) {
          dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
@@ -165,6 +170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
          patch_offset = amdgpu_ring_init_cond_exec(ring);
        if (vm) {
+        amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go 

too fast than DE */
+

          r = amdgpu_vm_flush(ring, job);
Quoted 8 lines
Quoted 2 lines
          if (r) {
              amdgpu_ring_undo(ring);

_______________________________________________
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

author NAK
#6 lore raw
In reply to a message not in the archive

What's your suggestion,

The thing is that when no vm_flush() needed we also have no 128dw nop inserted so the CE goes to fast to the next CS, since CE already dealing with SWITCH_BUFFERs, so CE and DE work in the different buffer and lead to corruption The fix for it is that with or without VM_FLUSH, we always need that 128dw nop inserted in head of each DMAframe , (windows use padding so it always have 128dw nop after each SWITCH_BUFFERS)

BR Monk

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Christian K?nig
Sent: Friday, September 30, 2016 5:07 PM
To: Liu, Monk <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu:fix exclusive mode game texture blank(v2)

NAK, please stop adding workarounds like this into common code.

If we need to add the extra NOPs between each command submission than just do this in one of the existing IP specific callbacks.

Additional to that this sounds more and more like the removal of the double sync wasn't such a good idea.

Christian.

Am 30.09.2016 um 07:00 schrieb Monk Liu:

Quoted 36 lines

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
 
  	unsigned i;
  	int r = 0;
+	unsigned extra_nop = 0;
 
  	if (num_ibs == 0)

return -EINVAL;

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +4 -0
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
  		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type == AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}
+
  	r = amdgpu_ring_alloc(ring, alloc_size);
  	if (r) {
  		dev_err(adev->dev, "scheduling IB failed (%d).\n", r); @@ -165,6 

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +4 -0
+170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,
  		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
  	if (vm) {
+		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go too fast 
+than DE */
+
  		r = amdgpu_vm_flush(ring, job);
  		if (r) {
  			amdgpu_ring_undo(ring);

_______________________________________________
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
In reply to a message not in the archive
Quoted 35 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, September 30, 2016 1:00 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix exclusive mode game texture blank(v2)

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,
 unsigned num_ibs,
 
 	unsigned i;
 	int r = 0;
+	unsigned extra_nop = 0;
 
 	if (num_ibs == 0)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
 		return -EINVAL;

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, · line 163

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +3 -0
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,
 unsigned num_ibs,
 	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
 		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type ==
 AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}

Don't you need to increase the alloc_size? Also, can we add this to the asic specific gfx code?

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
+
 	r = amdgpu_ring_alloc(ring, alloc_size);
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r);
@@ -165,6 +170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,
 unsigned num_ibs,
 		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
 	if (vm) {
+		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go

too fast than DE */

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
+
 		r = amdgpu_vm_flush(ring, job);
 		if (r) {
 			amdgpu_ring_undo(ring);
--

1.9.1

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): MWHPR12MB1694144965BBCD3F69CF19ECF7C10-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#9 lore raw

Already pushed to staging because Pro team are kinda hurry for this fix

The alloc size isn't need changed, cuz it always count vm_flush() in event no vm_flush needed

BR Monk

-----Original Message-----
From: Deucher, Alexander
Sent: Friday, September 30, 2016 9:23 PM
To: Liu, Monk <[email protected]>; [email protected]
Cc: Liu, Monk <[email protected]>
Subject: RE: [PATCH] drm/amdgpu:fix exclusive mode game texture blank(v2)

Quoted 34 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, September 30, 2016 1:00 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix exclusive mode game texture blank(v2)

this fix DOTA and other exclusive & full screen game textrue blank bug, the root cause is that when no ctx switch between two DMAframe, CE go too faster and step to the next DMAframe, thus DE and CE are not working on the same DAMframe.

Change-Id I92714a1d434bb05e94220a2db9b4a6113b0c2efc
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
index 38261a0..4863426 100644
@@ -129,6 +129,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
 
 	unsigned i;
 	int r = 0;
+	unsigned extra_nop = 0;
 
 	if (num_ibs == 0)
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0 -0
 		return -EINVAL;

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, · line 163

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +3 -0
@@ -155,6 +156,10 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, 
 unsigned num_ibs,
 	alloc_size = amdgpu_ring_get_dma_frame_size(ring) +
 		num_ibs * amdgpu_ring_get_emit_ib_size(ring);
 
+	if (job && !job->vm_needs_flush && ring->type ==
 AMDGPU_RING_TYPE_GFX) {
+		extra_nop = 128;
+	}

Don't you need to increase the alloc_size? Also, can we add this to the asic specific gfx code?

Quoted 18 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
+
 	r = amdgpu_ring_alloc(ring, alloc_size);
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
 	if (r) {
 		dev_err(adev->dev, "scheduling IB failed (%d).\n", r); @@ -165,6 
+170,8 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned 

num_ibs,

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -0
 		patch_offset = amdgpu_ring_init_cond_exec(ring);
 
 	if (vm) {
+		amdgpu_ring_insert_nop(ring, extra_nop); /* prevent CE go

too fast than DE */

drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1 -1
+
 		r = amdgpu_vm_flush(ring, job);
 		if (r) {
 			amdgpu_ring_undo(ring);
--

1.9.1

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