Skip to contentSkip to conversation

drm/i915: Remove the MI_FLUSH_ENABLE setting.

PATCH In review Eric Anholt 6 participants 19 messages Jan 19, 2012 – Jan 25, 2012

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

PATCH 1/2 drm/i915: Remove the MI_FLUSH_ENABLE setting.

We have always been using the wrong bit -- it's bit 12. However, the bit also doesn't do anything -- hardware has always accepted the MI_FLUSH command even when it was specced not to.

Given that there is only one MI_FLUSH emitted in all of the driver stack on gen6+ (in i965_video.c of the 2d driver, and it should be using other code to do its flush instead), just remove the MI_FLUSH enable instead of trying to fix it.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
index 2df35e3..d21346b 100644
@@ -389,8 +389,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 
 	if (INTEL_INFO(dev)->gen > 3) {
 		int mode = VS_TIMER_DISPATCH << 16 | VS_TIMER_DISPATCH;
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;
 		I915_WRITE(MI_MODE, mode);
 		if (IS_GEN7(dev))
 			I915_WRITE(GFX_MODE_GEN7,
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/2 drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

---
 drivers/gpu/drm/i915/i915_reg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +1 -1
index c3afb78..bbad788 100644
@@ -391,7 +391,7 @@
 
 #define MI_MODE		0x0209c
 # define VS_TIMER_DISPATCH				(1 << 6)
-# define MI_FLUSH_ENABLE				(1 << 11)
+# define MI_FLUSH_ENABLE				(1 << 12)
 
 #define GFX_MODE	0x02520
 #define GFX_MODE_GEN7	0x0229c
Signature · 1 line
1.7.7.3
#2 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Eric, Ben, is that ok?
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#3 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

That 2008 PPT mentioned also said "the bit" and "bit 12", and only in one cut-and-paste of a command line did I see it say two bits should be set. I would trust the actual code more than a ppt.

But basically, whatever we do to make this broken code go away, I'm fine with.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Quoted 16 lines · Eric Anholt
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Quoted 6 lines

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

Daniel has a failing test on IVB. I haven't tried hard enough to make it fail on SNB, so I cannot speak to that.

Quoted 7 lines

That 2008 PPT mentioned also said "the bit" and "bit 12", and only in one cut-and-paste of a command line did I see it say two bits should be set. I would trust the actual code more than a ppt.

But basically, whatever we do to make this broken code go away, I'm fine with.

I'm in the same boat. I think trying to figure out which source to trust is a losing game for all, and our best bet is to find out what the Windows driver does, and presumably that cut-and-paste is not from the Windows driver.

Ben

#5 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Quoted 24 lines · Ben Widawsky
Quoted 16 lines · Eric Anholt
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Quoted 6 lines

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

Quoted 2 lines

Daniel has a failing test on IVB. I haven't tried hard enough to make it fail on SNB, so I cannot speak to that.

Could be some other crash and I've just had an unlucky day and it died much earlier than usual. Anyway, with things tested I'm happy with these 2 patches and queued them for -next.

Quoted 11 lines
Quoted 6 lines

That 2008 PPT mentioned also said "the bit" and "bit 12", and only in one cut-and-paste of a command line did I see it say two bits should be set. I would trust the actual code more than a ppt.

But basically, whatever we do to make this broken code go away, I'm fine with.

I'm in the same boat. I think trying to figure out which source to trust is a losing game for all, and our best bet is to find out what the Windows driver does, and presumably that cut-and-paste is not from the Windows driver.

I've added a small comment to patch 2 to urge people to get a clue before trying to use this bit ;-)

Thanks, Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#6 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

In reply to Eric Anholt
Quoted 16 lines · Eric Anholt
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Quoted 6 lines

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

The SNB Xv path, that is the code called by Gen6DisplayVideoTexture, never used MI_FLUSH.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

Quoted 24 lines · Chris Wilson
Quoted 16 lines · Eric Anholt
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Quoted 6 lines

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

Quoted 2 lines

The SNB Xv path, that is the code called by Gen6DisplayVideoTexture, never used MI_FLUSH.

Ok, I've quickly tested this with intel_reg_write and installing older userspace. Doesn't seem to blow up.
-Daniel

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#8 lore raw

Re: [PATCH 2/2] drm/i915: Correct the bit number for the MI_FLUSH_ENABLE.

In reply to Chris Wilson
Quoted 24 lines · Chris Wilson
Quoted 16 lines · Eric Anholt
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Eric Anholt

Older specs claimed this was bit 11, but newer specs and the actual simulator code say it was bit 12. Regardless, we don't use MI_FLUSH, or try to enable it any more.

Quoted 7 lines

I'd like to amend this with the following (on this patch instead of the other, so that ppl actually can find it with git blame):

"Furthermore actually setting bit12 results in gpu hangs both on snb and ivb. Ben Widawsky discovered a ppt that claims that both bit12 and bit11 must be set, but that doesn't help either. And last but not least, MI_FLUSH seems to work regardless of the setting of these bits."

Quoted 6 lines

I haven't seen bit12 hanging snb/ivb -- I only knew of it hanging ilk (since it doesn't exist there). On my snb, running xvideo so that MI_FLUSHes are generated by the userland (I think -- I haven't caught them in cat i915_batchbuffers | intel_dump_decode -), with intel_reg_read 0x209c saying 0x1240, things are going fine. Also with 0x209c saying 0x240 (the result of this patch).

Quoted 2 lines

The SNB Xv path, that is the code called by Gen6DisplayVideoTexture, never used MI_FLUSH.

Oops. Not sure why I remembered confirming that that code still MI_FLUSHed on newer chipsets.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/2
#9 lore raw
In reply to Eric Anholt
Quoted 10 lines · Eric Anholt

We have always been using the wrong bit -- it's bit 12. However, the bit also doesn't do anything -- hardware has always accepted the MI_FLUSH command even when it was specced not to.

Given that there is only one MI_FLUSH emitted in all of the driver stack on gen6+ (in i965_video.c of the 2d driver, and it should be using other code to do its flush instead), just remove the MI_FLUSH enable instead of trying to fix it.

The other thing is that I've just tested the bit11 | bit12 patch from Ben on my ivb, and it resulted in a nice system death, like setting bit12 on snb. So whoever wrote that piece of bspec didn't talk with whomever implemented it ...

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48
#10 lore raw
In reply to Eric Anholt

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

Signature · 1 line
[email protected]

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
Quoted 7 lines · Keith Packard

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

The simulator complains unless both bits are set iirc. I can double check, but it's been a while since I've run without my patch.

Ben

#13 lore raw
In reply to Ben Widawsky
Quoted 11 lines · Ben Widawsky
Quoted 7 lines · Keith Packard

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

The simulator complains unless both bits are set iirc. I can double check, but it's been a while since I've run without my patch.

Can you please cite the message you're getting? I've read a lot of the simulator at this point, particularly pieces relating to flushing, and I can't find what you're talking about.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw
Quoted 10 lines · Eric Anholt
Quoted 9 lines · Ben Widawsky
Quoted 7 lines · Keith Packard

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

Quoted 7 lines
Quoted 2 lines

The simulator complains unless both bits are set iirc. I can double check, but it's been a while since I've run without my patch.

Can you please cite the message you're getting? I've read a lot of the simulator at this point, particularly pieces relating to flushing, and I can't find what you're talking about.

It is not email friendly paste.

Gen7GT/Render/src/CsMiCommonCatcher.cpp +293

It links to a power point which shows the workaround is to set both bits. The powerpoint is kind enough to crash libreoffice for me.

Ben

#15 lore raw
Quoted 19 lines · Ben Widawsky
Quoted 10 lines · Eric Anholt
Quoted 9 lines · Ben Widawsky
Quoted 7 lines · Keith Packard

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

Quoted 7 lines
Quoted 2 lines

The simulator complains unless both bits are set iirc. I can double check, but it's been a while since I've run without my patch.

Can you please cite the message you're getting? I've read a lot of the simulator at this point, particularly pieces relating to flushing, and I can't find what you're talking about.

Quoted 6 lines

It is not email friendly paste.

Gen7GT/Render/src/CsMiCommonCatcher.cpp +293

It links to a power point which shows the workaround is to set both bits. The powerpoint is kind enough to crash libreoffice for me.

That block is checking exactly one bit, bit 12, in my tree.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw
Quoted 20 lines · Eric Anholt
Quoted 19 lines · Ben Widawsky
Quoted 17 lines · Eric Anholt
Quoted 11 lines · Ben Widawsky
Quoted 7 lines · Keith Packard

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 393

Quoted 2 lines · Eric Anholt
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;

This seems better than setting random bits that don't do anything but annoy the simulator.

The simulator complains unless both bits are set iirc. I can double check, but it's been a while since I've run without my patch.

Can you please cite the message you're getting? I've read a lot of the simulator at this point, particularly pieces relating to flushing, and I can't find what you're talking about.

Quoted 8 lines
Quoted 6 lines

It is not email friendly paste.

Gen7GT/Render/src/CsMiCommonCatcher.cpp +293

It links to a power point which shows the workaround is to set both bits. The powerpoint is kind enough to crash libreoffice for me.

That block is checking exactly one bit, bit 12, in my tree.

Hmm, it appears I had some PEBPAC (phone and chair). I sent two earlier emails, and the semi-useful one never seemed to make it. Well this gives me a chance to elaborate anyway.

You have to read the powerpoint. In there it says to set both bits. It looks like I was incorrect about the simulator itself caring, that indeed only checks for bit 12. I think it's all moot anyway, as it appears bit 12 (with or without bit 11) doesn't play nice with IVB.

To sum up there are three options
Bit 11, wrong in docs, wrong in simulator, wrong in ppt; doesn't hang Bit 12, right in docs, right in simulator, wrong in ppt; hangs (I think) Bit 11|12, sorta wrong/right in docs an simulator, right in ppt; hangs

And I honestly don't care which we go with if the simulator logs don't tell me everytime that bit 12 wasn't set.

~Ben

Reviewed-by on v1 1/2
#17 lore raw
In reply to Eric Anholt
Quoted 19 lines · Eric Anholt

We have always been using the wrong bit -- it's bit 12. However, the bit also doesn't do anything -- hardware has always accepted the MI_FLUSH command even when it was specced not to.

Given that there is only one MI_FLUSH emitted in all of the driver stack on gen6+ (in i965_video.c of the 2d driver, and it should be using other code to do its flush instead), just remove the MI_FLUSH enable instead of trying to fix it.

---
  drivers/gpu/drm/i915/intel_ringbuffer.c |    2 --
  1 files changed, 0 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index 2df35e3..d21346b 100644

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 394

Quoted 8 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
@@ -389,8 +389,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 
  	if (INTEL_INFO(dev)->gen>  3) {
  		int mode = VS_TIMER_DISPATCH<<  16 | VS_TIMER_DISPATCH;
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE<<  16 | MI_FLUSH_ENABLE;
  		I915_WRITE(MI_MODE, mode);
  		if (IS_GEN7(dev))
  			I915_WRITE(GFX_MODE_GEN7,

Everything using MI_FLUSH on SNB+ ought to be converted to PIPE_CONTROL.
It sounds like everything except i965_video is there already. There's
still the issue of old userspace, but...given that we were setting the wrong bit and _not_ setting the actual MI_FLUSH enable bit...it seems like this patch shouldn't break things.

I'm all in favor of removing this code, as it's definitely a lie.

For both patches:

#18 lore raw
In reply to Eric Anholt
Quoted 19 lines · Eric Anholt

We have always been using the wrong bit -- it's bit 12. However, the bit also doesn't do anything -- hardware has always accepted the MI_FLUSH command even when it was specced not to.

Given that there is only one MI_FLUSH emitted in all of the driver stack on gen6+ (in i965_video.c of the 2d driver, and it should be using other code to do its flush instead), just remove the MI_FLUSH enable instead of trying to fix it.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -0
index 2df35e3..d21346b 100644

drivers/gpu/drm/i915/intel_ringbuffer.c static int init_render_ring(struct intel_ring_buffer *ring) · line 394

Quoted 8 lines
drivers/gpu/drm/i915/intel_ringbuffer.c +0 -2
@@ -389,8 +389,6 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 
 	if (INTEL_INFO(dev)->gen > 3) {
 		int mode = VS_TIMER_DISPATCH << 16 | VS_TIMER_DISPATCH;
-		if (IS_GEN6(dev) || IS_GEN7(dev))
-			mode |= MI_FLUSH_ENABLE << 16 | MI_FLUSH_ENABLE;
 		I915_WRITE(MI_MODE, mode);
 		if (IS_GEN7(dev))
 			I915_WRITE(GFX_MODE_GEN7,

I'd like to see a tested-by on this with old userspace before pulling this in. IFF someone does that, r-b me.

Patch 2/2 I still have some gripe with as detailed in that thread.

~Ben