From b9e1dc049dcefebdb23454e09b59c93e668310bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Thu, 13 Mar 2014 15:15:31 +0200 Subject: [PATCH] drm/i915: Repartition the display FIFO manyally on gen3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It looks like the automagic max FIFO mode doesn't work on 915GM at least. Repartition the display FIFO manually when enabling/disabling self-refresh. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_pm.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index df77e20..ccb3e1a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1396,6 +1396,8 @@ typedef struct drm_i915_private { int num_plane; + u32 dsparb; + struct i915_fbc fbc; struct intel_opregion opregion; struct intel_vbt_data vbt; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 54aec02..9c9eeec 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -1563,6 +1563,22 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) unsigned long line_time_us; int entries; + /* save current DSPARB */ + if (dev_priv->dsparb == 0) + dev_priv->dsparb = I915_READ(DSPARB); + + /* + * Automagic max FIFO mode doesn't seem to work, + * on 915GM at least. Repartition the FIFO manually. + */ + if (to_intel_crtc(enabled)->plane == PLANE_A) + I915_WRITE(DSPARB, + (wm_info->fifo_size << DSPARB_CSTART_SHIFT) | + wm_info->fifo_size); + else + I915_WRITE(DSPARB, + wm_info->fifo_size << DSPARB_CSTART_SHIFT); + line_time_us = (htotal * 1000) / clock; /* Use ns/us then divide to preserve precision */ @@ -1579,6 +1595,10 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc) FW_BLC_SELF_FIFO_MASK | (srwm & 0xff)); else if (IS_I915GM(dev)) I915_WRITE(FW_BLC_SELF, srwm & 0x3f); + } else if (dev_priv->dsparb) { + /* restore original DSPARB */ + I915_WRITE(DSPARB, dev_priv->dsparb); + dev_priv->dsparb = 0; } DRM_DEBUG_KMS("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n", -- 1.8.3.2