[Intel-gfx] [PATCH] drm/i915: Re-enable mt forcewake check for IVB

Takashi Iwai tiwai at suse.de
Thu Nov 15 18:03:02 CET 2012


Some IVB machines seem to need non-MT forcewake.  Using MT forcewake
on such machines result in broken or blank screens.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
The commit 36ec8f877481449bdfa072e6adf2060869e2b970 triggered a
regression on my test IVY laptops.  Instead of reverting the commit,
I cooked a bit to make fitting only for IS_IVYBRIDGE().

 drivers/gpu/drm/i915/intel_pm.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 0cbc0e6..944911e 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -4239,9 +4239,36 @@ void intel_gt_init(struct drm_device *dev)
 	if (IS_VALLEYVIEW(dev)) {
 		dev_priv->gt.force_wake_get = vlv_force_wake_get;
 		dev_priv->gt.force_wake_put = vlv_force_wake_put;
-	} else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
+	} else if (IS_HASWELL(dev)) {
 		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_mt_get;
 		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_mt_put;
+	} else if (IS_IVYBRIDGE(dev)) {
+		/* IVB configs may use multi-threaded forcewake */
+		u32 ecobus;
+
+		/* A small trick here - if the bios hasn't configured
+		 * MT forcewake, and if the device is in RC6, then
+		 * force_wake_mt_get will not wake the device and the
+		 * ECOBUS read will return zero. Which will be
+		 * (correctly) interpreted by the test below as MT
+		 * forcewake being disabled.
+		 */
+		mutex_lock(&dev->struct_mutex);
+		__gen6_gt_force_wake_mt_get(dev_priv);
+		ecobus = I915_READ_NOTRACE(ECOBUS);
+		__gen6_gt_force_wake_mt_put(dev_priv);
+		mutex_unlock(&dev->struct_mutex);
+
+		if (ecobus & FORCEWAKE_MT_ENABLE) {
+			DRM_DEBUG_KMS("Using MT version of forcewake\n");
+			dev_priv->gt.force_wake_get =
+				__gen6_gt_force_wake_mt_get;
+			dev_priv->gt.force_wake_put =
+				__gen6_gt_force_wake_mt_put;
+		} else {
+			dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
+			dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
+		}
 	} else if (IS_GEN6(dev)) {
 		dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get;
 		dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put;
-- 
1.8.0




More information about the Intel-gfx mailing list