Skip to contentSkip to conversation

drm/i915: Set the Stencil Cache eviction policy to non-LRA mode.

PATCH Superseded Kenneth Graunke 1 participant 1 message Apr 27, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Set the Stencil Cache eviction policy to non-LRA mode.

Clearing bit 5 of CACHE_MODE_0 is necessary to prevent GPU hangs in OpenGL programs such as Google MapsGL, Google Earth, and gzdoom when using separate stencil buffers. Without it, the GPU tries to use the LRA eviction policy, which isn't supported. This was supposed to be off by default, but seems to be on for many machines.

This cannot be done in gen6_init_clock_gating with most of the other workaround bits; the render ring needs to exist. Otherwise, the register write gets dropped on the floor (one printk will show it changed, but a second printk immediately following shows the value reverts to the old one).

Cc: [email protected]
Cc: Rob Castle <[email protected]>
Cc: Eric Appleman <[email protected]>
Cc: [email protected]
Cc: Keith Packard <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47535

---
 drivers/gpu/drm/i915/i915_reg.h         |    1 +
 drivers/gpu/drm/i915/intel_ringbuffer.c |    8 ++++++++
 2 files changed, 9 insertions(+)

Note that this patch applies against Daniel's drm-intel-fixes tree.

In drm-intel-next-queued, it may conflict with commit 009be664ecc77d58d3c27fb22347b969745a329a.

drivers/gpu/drm/i915/i915_reg.h +1 -0
index b4bb1ef..9d24d65 100644
@@ -568,6 +568,7 @@
 #define   CM0_MASK_SHIFT          16
 #define   CM0_IZ_OPT_DISABLE      (1<<6)
 #define   CM0_ZR_OPT_DISABLE      (1<<5)
+#define	  CM0_STC_EVICT_DISABLE_LRA_SNB	(1<<5)
 #define   CM0_DEPTH_EVICT_DISABLE (1<<4)
 #define   CM0_COLOR_EVICT_DISABLE (1<<3)
 #define   CM0_DEPTH_WRITE_DISABLE (1<<1)
drivers/gpu/drm/i915/intel_ringbuffer.c +8 -0
index f75806e..80fce51 100644
@@ -401,6 +401,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)
 	if (INTEL_INFO(dev)->gen >= 6) {
 		I915_WRITE(INSTPM,
 			   INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING);
+
+		/* From the Sandybridge PRM, volume 1 part 3, page 24:
+		 * "If this bit is set, STCunit will have LRA as replacement
+		 *  policy. [...] This bit must be reset.  LRA replacement
+		 *  policy is not supported."
+		 */
+		I915_WRITE(CACHE_MODE_0,
+			   CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT);
 	}
 
 	return ret;
Signature · 1 line
1.7.10