Skip to contentSkip to conversation

drm/i915: [GEN7] Use HW scheduler for fixed function shaders

PATCH In review Ben Widawsky 5 participants 7 messages Apr 15, 2012 – May 21, 2012

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

PATCH 1/1 drm/i915: [GEN7] Use HW scheduler for fixed function shaders

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski <[email protected]>
Cc: stable <[email protected]>
Reviewed-by (RFC): Kenneth Graunke <[email protected]>

---
 drivers/gpu/drm/i915/i915_reg.h      |   15 +++++++++++++++
 drivers/gpu/drm/i915/intel_display.c |   14 ++++++++++++++
 2 files changed, 29 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +15 -0
index 972321f..59a85c8 100644
@@ -682,6 +682,21 @@
 
 #define GEN6_BSD_RNCID			0x12198
 
+#define GEN7_FF_THREAD_MODE		0x20a0
+#define   GEN7_FF_SCHED_MASK		0x0077070
+#define   GEN7_FF_TS_SCHED_HS1		(0x5<<16)
+#define   GEN7_FF_TS_SCHED_HS0		(0x3<<16)
+#define   GEN7_FF_TS_SCHED_LOAD_BALANCE	(0x1<<16)
+#define   GEN7_FF_TS_SCHED_HW		(0x0<<16) /* Default */
+#define   GEN7_FF_VS_SCHED_HS1		(0x5<<12)
+#define   GEN7_FF_VS_SCHED_HS0		(0x3<<12)
+#define   GEN7_FF_VS_SCHED_LOAD_BALANCE	(0x1<<12) /* Default */
+#define   GEN7_FF_VS_SCHED_HW		(0x0<<12)
+#define   GEN7_FF_DS_SCHED_HS1		(0x5<<4)
+#define   GEN7_FF_DS_SCHED_HS0		(0x3<<4)
+#define   GEN7_FF_DS_SCHED_LOAD_BALANCE	(0x1<<4)  /* Default */
+#define   GEN7_FF_DS_SCHED_HW		(0x0<<4)
+
 /*
  * Framebuffer compression (915+ only)
  */
drivers/gpu/drm/i915/intel_display.c +14 -0
index 33aaad3..4508935 100644
@@ -8894,6 +8894,18 @@ static void gen6_init_clock_gating(struct drm_device *dev)
 	}
 }
 
+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
+{
+	uint32_t reg = I915_READ(GEN7_FF_THREAD_MODE);
+
+	reg &= ~GEN7_FF_SCHED_MASK;
+	reg |= GEN7_FF_TS_SCHED_HW;
+	reg |= GEN7_FF_VS_SCHED_HW;
+	reg |= GEN7_FF_DS_SCHED_HW;
+
+	I915_WRITE(GEN7_FF_THREAD_MODE, reg);
+}
+
 static void ivybridge_init_clock_gating(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
@@ -8938,6 +8950,8 @@ static void ivybridge_init_clock_gating(struct drm_device *dev)
 			   DISPPLANE_TRICKLE_FEED_DISABLE);
 		intel_flush_display_plane(dev_priv, pipe);
 	}
+
+	gen7_setup_fixed_func_scheduler(dev_priv);
 }
 
 static void valleyview_init_clock_gating(struct drm_device *dev)
Signature · 1 line
1.7.10
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Ben Widawsky

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

Quoted 8 lines

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski <[email protected]>
Cc: stable <[email protected]>
Reviewed-by (RFC): Kenneth Graunke <[email protected]>

Very nice!

I also suspect that maybe the initial performance improvement you've seen with previous testing could be related to the occasional turbo disabling we've been seeing in other cases as well (e.g.,
https://bugs.freedesktop.org/show_bug.cgi?id=44006).

But as for this patch, I have just one comment/suggestion below, but other than that:

+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private

Quoted 2 lines

*dev_priv)

Perhaps this functions should be named ivybridge_setup_fixed_func_scheduler instead?

Even if those bits are not ivy bridge-exclusive, this specific explicit setup applies to ivb only..

Signature · 2 lines
Eugeni Dodonov
<http://eugeni.dodonov.net/>

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

#2 lore raw
Quoted 41 lines · On Sun, 15 Apr 2012 11:55:36 -0300 Eugeni Dodonov <[email protected]> wrote:
Quoted 17 lines · Ben Widawsky

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

Quoted 8 lines

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski <[email protected]>
Cc: stable <[email protected]>
Reviewed-by (RFC): Kenneth Graunke <[email protected]>

Very nice!

I also suspect that maybe the initial performance improvement you've seen with previous testing could be related to the occasional turbo disabling we've been seeing in other cases as well (e.g.,
https://bugs.freedesktop.org/show_bug.cgi?id=44006).

But as for this patch, I have just one comment/suggestion below, but other than that:

+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private

Quoted 9 lines
Quoted 2 lines

*dev_priv)

Perhaps this functions should be named
ivybridge_setup_fixed_func_scheduler instead?

Even if those bits are not ivy bridge-exclusive, this specific explicit setup applies to ivb only..

I wasn't sure if we wanted this for VLV or not. In fact, originally the patch did call this in the VLV setup, but since I decided to CC stable (per Ken's idea) I removed the VLV part.

If Jesse, or someone could confirm we don't want this for VLV, I agree with your commen, and I'd probably just go back and inline the register write. FWIW, it does *seem* like we don't want to set this on HSW.

Anyway, thanks for your review.

#3 lore raw

Jesse, can you also please check whether we need the same thing on vlv? atm the the clock gating functions are almost identical safe for this wrt touching registers in the gt core.
-Daniel

Quoted 67 lines · Ben Widawsky
Quoted 41 lines · On Sun, 15 Apr 2012 11:55:36 -0300 Eugeni Dodonov <[email protected]> wrote:
Quoted 17 lines · Ben Widawsky

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

Quoted 8 lines

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski <[email protected]>
Cc: stable <[email protected]>
Reviewed-by (RFC): Kenneth Graunke <[email protected]>

Very nice!

I also suspect that maybe the initial performance improvement you've seen with previous testing could be related to the occasional turbo disabling we've been seeing in other cases as well (e.g.,
https://bugs.freedesktop.org/show_bug.cgi?id=44006).

But as for this patch, I have just one comment/suggestion below, but other than that:

+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private

Quoted 9 lines
Quoted 2 lines

*dev_priv)

Perhaps this functions should be named
ivybridge_setup_fixed_func_scheduler instead?

Even if those bits are not ivy bridge-exclusive, this specific explicit setup applies to ivb only..

I wasn't sure if we wanted this for VLV or not. In fact, originally the patch did call this in the VLV setup, but since I decided to CC stable (per Ken's idea) I removed the VLV part.

If Jesse, or someone could confirm we don't want this for VLV, I agree with your commen, and I'd probably just go back and inline the register write. FWIW, it does *seem* like we don't want to set this on HSW.

Anyway, thanks for your review.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

Jesse, can you also please check whether we need the same thing on vlv? atm the the clock gating functions are almost identical safe for this wrt touching registers in the gt core.

Prod.

Now that you have a vlv, no more excuses ;-)
-Daniel

Quoted 75 lines

-Daniel

Quoted 62 lines · Ben Widawsky
Quoted 41 lines · On Sun, 15 Apr 2012 11:55:36 -0300 Eugeni Dodonov <[email protected]> wrote:
Quoted 17 lines · Ben Widawsky

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

Quoted 8 lines

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski <[email protected]>
Cc: stable <[email protected]>
Reviewed-by (RFC): Kenneth Graunke <[email protected]>

Very nice!

I also suspect that maybe the initial performance improvement you've seen with previous testing could be related to the occasional turbo disabling we've been seeing in other cases as well (e.g.,
https://bugs.freedesktop.org/show_bug.cgi?id=44006).

But as for this patch, I have just one comment/suggestion below, but other than that:

+static void gen7_setup_fixed_func_scheduler(struct drm_i915_private

Quoted 9 lines
Quoted 2 lines

*dev_priv)

Perhaps this functions should be named
ivybridge_setup_fixed_func_scheduler instead?

Even if those bits are not ivy bridge-exclusive, this specific explicit setup applies to ivb only..

I wasn't sure if we wanted this for VLV or not. In fact, originally the patch did call this in the VLV setup, but since I decided to CC stable (per Ken's idea) I removed the VLV part.

If Jesse, or someone could confirm we don't want this for VLV, I agree with your commen, and I'd probably just go back and inline the register write. FWIW, it does *seem* like we don't want to set this on HSW.

Quoted 5 lines

Anyway, thanks for your review.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48

Signature · 2 lines
Daniel Vetter
[email protected] - +41 (0) 79 364 57 48 - http://blog.ffwll.ch
#5 lore raw
Quoted 8 lines · On Sun, 20 May 2012 21:24:15 +0200 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Daniel Vetter

Jesse, can you also please check whether we need the same thing on vlv? atm the the clock gating functions are almost identical safe for this wrt touching registers in the gt core.

Prod.

Now that you have a vlv, no more excuses ;-)

I've got one more: I'm waiting on a dediprog so I can upgrade the BIOS. The machine is stable unless I try to use gfx at the moment because a BIOS change prevented the GPU from coming out of reset.

I was able to do some work on the VGA console side of things (adding a couple of needed workarounds); hopefully I'll be able to refresh this patchset this week or next and do the sprite stuff too.

Bernard's team may have one for testing by now too though; so they can provide an answer on this thread.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Reviewed-by on v1 1/1
#6 lore raw
In reply to Ben Widawsky
Quoted 16 lines · Ben Widawsky

This originally started as a patch from Bernard as a way of simply setting the VS scheduler. After submitting the RFC patch, we decided to also modify the DS scheduler. To be most explicit, I've made the patch explicitly set all scheduler modes, and included the defines for other modes (in case someone feels frisky later).

The rest of the story gets a bit weird. The first version of the patch showed an almost unbelievable performance improvement. Since rebasing my branch it appears the performance improvement has gone, unfortunately. But setting these bits seem to be the right thing to do given that the docs describe corruption that can occur with the default settings.

In summary, I am seeing no more perf improvements (or regressions) in my limited testing, but we believe this should be set to prevent rendering corruption, therefore cc stable.

Quoted 7 lines

v1: Clear bit 4 also (Ken + Eugeni)
Do a full clear + set of the bits we want (Me).

Cc: Bernard Kilarski<[email protected]>
Cc: stable<[email protected]>
Reviewed-by (RFC): Kenneth Graunke<[email protected]>

Looks good! I like how you've reworked this.

It looks like we don't want to do this on Haswell.

(I haven't tested it, though.)