Jesse Keating 2f82dda
upstream commit 944001201ca0196bcdb088129e5866a9f379d08c
Jesse Keating 2f82dda
(plus some defines)
Jesse Keating 2f82dda
[2.6.32 backport]
Jesse Keating 2f82dda
Jesse Keating 2f82dda
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
Jesse Keating 2f82dda
index 0d05c6f..b87f65d 100644
Jesse Keating 2f82dda
--- a/drivers/gpu/drm/i915/i915_gem.c
Jesse Keating 2f82dda
+++ b/drivers/gpu/drm/i915/i915_gem.c
Jesse Keating 2f82dda
@@ -4967,6 +4967,16 @@ i915_gem_load(struct drm_device *dev)
Jesse Keating 2f82dda
 	list_add(&dev_priv->mm.shrink_list, &shrink_list);
Jesse Keating 2f82dda
 	spin_unlock(&shrink_list_lock);
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
+	/* On GEN3 we really need to make sure the ARB C3 LP bit is set */
Jesse Keating 2f82dda
+	if (IS_GEN3(dev)) {
Jesse Keating 2f82dda
+		u32 tmp = I915_READ(MI_ARB_STATE);
Jesse Keating 2f82dda
+		if (!(tmp & MI_ARB_C3_LP_WRITE_ENABLE)) {
Jesse Keating 2f82dda
+			/* arb state is a masked write, so set bit + bit in mask */
Jesse Keating 2f82dda
+			tmp = MI_ARB_C3_LP_WRITE_ENABLE | (MI_ARB_C3_LP_WRITE_ENABLE << MI_ARB_MASK_SHIFT);
Jesse Keating 2f82dda
+			I915_WRITE(MI_ARB_STATE, tmp);
Jesse Keating 2f82dda
+		}
Jesse Keating 2f82dda
+	}
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
 	/* Old X drivers will take 0-2 for front, back, depth buffers */
Jesse Keating 2f82dda
 	dev_priv->fence_reg_start = 3;
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
Jesse Keating 2f82dda
index 4cbc521..4543975 100644
Jesse Keating 2f82dda
--- a/drivers/gpu/drm/i915/i915_reg.h
Jesse Keating 2f82dda
+++ b/drivers/gpu/drm/i915/i915_reg.h
Jesse Keating 2f82dda
@@ -357,6 +357,70 @@
Jesse Keating 2f82dda
 #define LM_BURST_LENGTH     0x00000700
Jesse Keating 2f82dda
 #define LM_FIFO_WATERMARK   0x0000001F
Jesse Keating 2f82dda
 #define MI_ARB_STATE	0x020e4 /* 915+ only */
Jesse Keating 2f82dda
+#define   MI_ARB_MASK_SHIFT	  16	/* shift for enable bits */
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Make render/texture TLB fetches lower priorty than associated data
Jesse Keating 2f82dda
+ *   fetches. This is not turned on by default
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_RENDER_TLB_LOW_PRIORITY	(1 << 15)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Isoch request wait on GTT enable (Display A/B/C streams).
Jesse Keating 2f82dda
+ * Make isoch requests stall on the TLB update. May cause
Jesse Keating 2f82dda
+ * display underruns (test mode only)
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_ISOCH_WAIT_GTT			(1 << 14)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Block grant count for isoch requests when block count is
Jesse Keating 2f82dda
+ * set to a finite value.
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_BLOCK_GRANT_MASK		(3 << 12)
Jesse Keating 2f82dda
+#define   MI_ARB_BLOCK_GRANT_8			(0 << 12)	/* for 3 display planes */
Jesse Keating 2f82dda
+#define   MI_ARB_BLOCK_GRANT_4			(1 << 12)	/* for 2 display planes */
Jesse Keating 2f82dda
+#define   MI_ARB_BLOCK_GRANT_2			(2 << 12)	/* for 1 display plane */
Jesse Keating 2f82dda
+#define   MI_ARB_BLOCK_GRANT_0			(3 << 12)	/* don't use */
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Enable render writes to complete in C2/C3/C4 power states.
Jesse Keating 2f82dda
+ * If this isn't enabled, render writes are prevented in low
Jesse Keating 2f82dda
+ * power states. That seems bad to me.
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_C3_LP_WRITE_ENABLE		(1 << 11)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* This acknowledges an async flip immediately instead
Jesse Keating 2f82dda
+ * of waiting for 2TLB fetches.
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_ASYNC_FLIP_ACK_IMMEDIATE	(1 << 10)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Enables non-sequential data reads through arbiter
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_DUAL_DATA_PHASE_DISABLE       	(1 << 9)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Disable FSB snooping of cacheable write cycles from binner/render
Jesse Keating 2f82dda
+ * command stream
Jesse Keating 2f82dda
+ */
Jesse Keating 2f82dda
+#define   MI_ARB_CACHE_SNOOP_DISABLE		(1 << 8)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Arbiter time slice for non-isoch streams */
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_MASK		(7 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_1			(0 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_2			(1 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_4			(2 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_6			(3 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_8			(4 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_10			(5 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_14			(6 << 5)
Jesse Keating 2f82dda
+#define   MI_ARB_TIME_SLICE_16			(7 << 5)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Low priority grace period page size */
Jesse Keating 2f82dda
+#define   MI_ARB_LOW_PRIORITY_GRACE_4KB		(0 << 4)	/* default */
Jesse Keating 2f82dda
+#define   MI_ARB_LOW_PRIORITY_GRACE_8KB		(1 << 4)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Disable display A/B trickle feed */
Jesse Keating 2f82dda
+#define   MI_ARB_DISPLAY_TRICKLE_FEED_DISABLE	(1 << 2)
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+/* Set display plane priority */
Jesse Keating 2f82dda
+#define   MI_ARB_DISPLAY_PRIORITY_A_B		(0 << 0)	/* display A > display B */
Jesse Keating 2f82dda
+#define   MI_ARB_DISPLAY_PRIORITY_B_A		(1 << 0)	/* display B > display A */
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
 #define CACHE_MODE_0	0x02120 /* 915+ only */
Jesse Keating 2f82dda
 #define   CM0_MASK_SHIFT          16
Jesse Keating 2f82dda
 #define   CM0_IZ_OPT_DISABLE      (1<<6)
Jesse Keating 2f82dda
--- a/drivers/gpu/drm/i915/i915_drv.h
Jesse Keating 2f82dda
+++ b/drivers/gpu/drm/i915/i915_drv.h
Jesse Keating 2f82dda
@@ -1045,6 +1045,13 @@ extern int i915_wait_ring(struct drm_dev
Jesse Keating 2f82dda
 #define IS_I9XX(dev)		(INTEL_INFO(dev)->is_i9xx)
Jesse Keating 2f82dda
 #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile)
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
+#define IS_GEN3(dev)	(IS_I915G(dev) ||			\
Jesse Keating 2f82dda
+			 IS_I915GM(dev) ||			\
Jesse Keating 2f82dda
+			 IS_I945G(dev) ||			\
Jesse Keating 2f82dda
+			 IS_I945GM(dev) ||			\
Jesse Keating 2f82dda
+			 IS_G33(dev) || \
Jesse Keating 2f82dda
+			 IS_PINEVIEW(dev))
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
 #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
Jesse Keating 2f82dda
--