[PATCH 5/5] drm/i915/vlv: support save/restore of display state around power well toggle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we disable the power well at runtime, we need to save enough display
state so we can restore it when the power well comes back again.  Add
support for that on VLV by reusing some of the _freeze and _thaw code.

Note we need to drop the power well lock in this path around the restore,
since we'll end up in mode set functions that take more refs on the
power well.

Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_uncore.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index b126f5a..070ff00 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -406,7 +406,26 @@ static void __vlv_set_power_well(struct drm_i915_private *dev_priv,
 static void vlv_set_display_power(struct drm_i915_private *dev_priv,
 				  bool enable)
 {
-	__vlv_set_power_well(dev_priv, DISP2D_PWRGT, enable);
+	struct drm_device *dev = dev_priv->dev;
+	struct i915_power_well *power_well = &dev_priv->power_well;
+
+	if (enable) {
+		/* Lost all the display state, restore it */
+		if (vlv_display_power_enabled(dev_priv))
+			return; /* already on, skip the fireworks */
+		__vlv_set_power_well(dev_priv, DISP2D_PWRGT, true);
+		spin_unlock_irq(&power_well->lock);
+		i915_restore_state(dev);
+		intel_modeset_init_hw(dev);
+		intel_modeset_setup_hw_state(dev, true);
+		spin_lock_irq(&power_well->lock);
+	} else {
+		if (!vlv_display_power_enabled(dev_priv))
+			return; /* already off, skip the fireworks */
+		/* Make sure we save the state we need */
+		i915_save_state(dev);
+		__vlv_set_power_well(dev_priv, DISP2D_PWRGT, enable);
+	}
 }
 
 static void vlv_set_render_power(struct drm_i915_private *dev_priv, bool enable)
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux