Skip to contentSkip to conversation

drm/i915: fix rc6 enabling around suspend/resume

PATCH New Jesse Barnes 1 participant 2 messages Dec 23, 2010

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

PATCH 1/2 drm/i915: fix rc6 enabling around suspend/resume

Enabling RC6 implies setting a graphics context. Make sure we do that only after the ring has been enabled, otherwise our ring commands will hang.

---
 drivers/gpu/drm/i915/i915_drv.c     |    3 +++
 drivers/gpu/drm/i915/i915_suspend.c |    3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +3 -0
index dbae9c3..a420b08 100644
@@ -353,6 +353,9 @@ static int i915_drm_thaw(struct drm_device *dev)
 		drm_helper_resume_force_mode(dev);
 	}
 
+	/* Clock gating state */
+	intel_enable_clock_gating(dev);
+
 	intel_opregion_init(dev);
 
 	dev_priv->modeset_on_lid = 0;
drivers/gpu/drm/i915/i915_suspend.c +0 -3
index af53063..147cd96 100644
@@ -868,9 +868,6 @@ int i915_restore_state(struct drm_device *dev)
 		I915_WRITE (IMR,  dev_priv->saveIMR);
 	}
 
-	/* Clock gating state */
-	intel_enable_clock_gating(dev);
-
 	if (IS_IRONLAKE_M(dev)) {
 		ironlake_enable_drps(dev);
 		intel_init_emon(dev);
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 2/2 drm/i915: cleanup rc6 code

Cleanup several aspects of the rc6 code:
- misnamed intel_disable_clock_gating function (was only about rc6)
- remove commented call to intel_disable_clock_gating
- rc6 enabling code belongs in its own function (allows us to move the actual clock gating enable call back into restore_state)
- allocate power & render contexts up front, only free on unload (avoids ugly lazy init at rc6 enable time)
- check for return value when adding the MI_SET_CONTEXT to the ring (wrongly removed in the re-enable patch)

---
 drivers/gpu/drm/i915/i915_drv.c      |    6 +-
 drivers/gpu/drm/i915/i915_drv.h      |    1 +
 drivers/gpu/drm/i915/i915_suspend.c  |    7 +-
 drivers/gpu/drm/i915/intel_display.c |  109 ++++++++++++++++++----------------
 4 files changed, 65 insertions(+), 58 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +3 -3
index a420b08..5ca0663 100644
@@ -351,10 +351,10 @@ static int i915_drm_thaw(struct drm_device *dev)
 
 		/* Resume the modeset for every activated CRTC */
 		drm_helper_resume_force_mode(dev);
-	}
 
-	/* Clock gating state */
-	intel_enable_clock_gating(dev);
+		if (dev_priv->renderctx && dev_priv->pwrctx)
+			ironlake_enable_rc6(dev);
+	}
 
 	intel_opregion_init(dev);
 
drivers/gpu/drm/i915/i915_drv.h +1 -0
index aac1bf3..9351305 100644
@@ -1265,6 +1265,7 @@ extern void intel_disable_fbc(struct drm_device *dev);
 extern void intel_enable_fbc(struct drm_crtc *crtc, unsigned long interval);
 extern bool intel_fbc_enabled(struct drm_device *dev);
 extern bool ironlake_set_drps(struct drm_device *dev, u8 val);
+extern void ironlake_enable_rc6(struct drm_device *dev);
 extern void gen6_set_rps(struct drm_device *dev, u8 val);
 extern void intel_detect_pch (struct drm_device *dev);
 extern int intel_trans_dp_port_sel (struct drm_crtc *crtc);
drivers/gpu/drm/i915/i915_suspend.c +3 -4
index 147cd96..0521ecf 100644
@@ -822,10 +822,6 @@ int i915_save_state(struct drm_device *dev)
 	if (IS_GEN6(dev))
 		gen6_disable_rps(dev);
 
-	/* XXX disabling the clock gating breaks suspend on gm45
-	intel_disable_clock_gating(dev);
-	 */
-
 	/* Cache mode state */
 	dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
 
@@ -868,6 +864,9 @@ int i915_restore_state(struct drm_device *dev)
 		I915_WRITE (IMR,  dev_priv->saveIMR);
 	}
 
+	/* Clock gating state */
+	intel_enable_clock_gating(dev);
+
 	if (IS_IRONLAKE_M(dev)) {
 		ironlake_enable_drps(dev);
 		intel_init_emon(dev);
drivers/gpu/drm/i915/intel_display.c +58 -51

137 lines not on this page · raw message

Signature · 1 line
1.7.2.3