diff mbox

[1/4] drm/i915: preserve SSC if previously set v2

Message ID 1394833031-4055-1-git-send-email-jbarnes@virtuousgeek.org (mailing list archive)
State New, archived
Headers show

Commit Message

Jesse Barnes March 14, 2014, 9:37 p.m. UTC
Some machines may have a broken VBT or no VBT at all, but we still want
to use SSC there.  So check for it and keep it enabled if we see it
already on.  Based on an earlier fix from Kristian.

v2: honor modparam if set too (Daniel)
    read out at init time and store for panel_use_ssc() use (Jesse)

Reported-by: Kristian Høgsberg <hoegsberg@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_drv.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |   11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 70fbe90..c64f770 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1507,6 +1507,8 @@  typedef struct drm_i915_private {
 	struct intel_opregion opregion;
 	struct intel_vbt_data vbt;
 
+	bool bios_ssc; /* BIOS had SSC enabled at boot? */
+
 	/* overlay */
 	struct intel_overlay *overlay;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2bccc68..4b3e1c0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4986,7 +4986,7 @@  static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
 {
 	if (i915.panel_use_ssc >= 0)
 		return i915.panel_use_ssc != 0;
-	return dev_priv->vbt.lvds_use_ssc
+	return (dev_priv->vbt.lvds_use_ssc || dev_priv->bios_ssc)
 		&& !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
 }
 
@@ -11732,9 +11732,18 @@  void intel_modeset_setup_hw_state(struct drm_device *dev,
 
 void intel_modeset_gem_init(struct drm_device *dev)
 {
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_crtc *c;
 	struct intel_framebuffer *fb;
 
+	/*
+	 * There may be no VBT; and if the BIOS enabled SSC we can
+	 * just keep using it to avoid unnecessary flicker.
+	 */
+	if ((HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)) &&
+	    (I915_READ(PCH_DREF_CONTROL) & DREF_SSC1_ENABLE))
+			dev_priv->bios_ssc = true;
+
 	intel_modeset_init_hw(dev);
 
 	intel_setup_overlay(dev);