aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c112
1 files changed, 58 insertions, 54 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3106c0dc8389..e522c702b04e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1516,9 +1516,10 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,
1516 1516
1517 reg = PIPECONF(pipe); 1517 reg = PIPECONF(pipe);
1518 val = I915_READ(reg); 1518 val = I915_READ(reg);
1519 val |= PIPECONF_ENABLE; 1519 if (val & PIPECONF_ENABLE)
1520 I915_WRITE(reg, val); 1520 return;
1521 POSTING_READ(reg); 1521
1522 I915_WRITE(reg, val | PIPECONF_ENABLE);
1522 intel_wait_for_vblank(dev_priv->dev, pipe); 1523 intel_wait_for_vblank(dev_priv->dev, pipe);
1523} 1524}
1524 1525
@@ -1552,9 +1553,10 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,
1552 1553
1553 reg = PIPECONF(pipe); 1554 reg = PIPECONF(pipe);
1554 val = I915_READ(reg); 1555 val = I915_READ(reg);
1555 val &= ~PIPECONF_ENABLE; 1556 if ((val & PIPECONF_ENABLE) == 0)
1556 I915_WRITE(reg, val); 1557 return;
1557 POSTING_READ(reg); 1558
1559 I915_WRITE(reg, val & ~PIPECONF_ENABLE);
1558 intel_wait_for_pipe_off(dev_priv->dev, pipe); 1560 intel_wait_for_pipe_off(dev_priv->dev, pipe);
1559} 1561}
1560 1562
@@ -1577,9 +1579,10 @@ static void intel_enable_plane(struct drm_i915_private *dev_priv,
1577 1579
1578 reg = DSPCNTR(plane); 1580 reg = DSPCNTR(plane);
1579 val = I915_READ(reg); 1581 val = I915_READ(reg);
1580 val |= DISPLAY_PLANE_ENABLE; 1582 if (val & DISPLAY_PLANE_ENABLE)
1581 I915_WRITE(reg, val); 1583 return;
1582 POSTING_READ(reg); 1584
1585 I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
1583 intel_wait_for_vblank(dev_priv->dev, pipe); 1586 intel_wait_for_vblank(dev_priv->dev, pipe);
1584} 1587}
1585 1588
@@ -1610,9 +1613,10 @@ static void intel_disable_plane(struct drm_i915_private *dev_priv,
1610 1613
1611 reg = DSPCNTR(plane); 1614 reg = DSPCNTR(plane);
1612 val = I915_READ(reg); 1615 val = I915_READ(reg);
1613 val &= ~DISPLAY_PLANE_ENABLE; 1616 if ((val & DISPLAY_PLANE_ENABLE) == 0)
1614 I915_WRITE(reg, val); 1617 return;
1615 POSTING_READ(reg); 1618
1619 I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE);
1616 intel_flush_display_plane(dev_priv, plane); 1620 intel_flush_display_plane(dev_priv, plane);
1617 intel_wait_for_vblank(dev_priv->dev, pipe); 1621 intel_wait_for_vblank(dev_priv->dev, pipe);
1618} 1622}
@@ -1769,7 +1773,6 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1769 return; 1773 return;
1770 1774
1771 I915_WRITE(DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN); 1775 I915_WRITE(DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN);
1772 POSTING_READ(DPFC_CONTROL);
1773 intel_wait_for_vblank(dev, intel_crtc->pipe); 1776 intel_wait_for_vblank(dev, intel_crtc->pipe);
1774 } 1777 }
1775 1778
@@ -1861,7 +1864,6 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
1861 return; 1864 return;
1862 1865
1863 I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN); 1866 I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN);
1864 POSTING_READ(ILK_DPFC_CONTROL);
1865 intel_wait_for_vblank(dev, intel_crtc->pipe); 1867 intel_wait_for_vblank(dev, intel_crtc->pipe);
1866 } 1868 }
1867 1869
@@ -3769,8 +3771,11 @@ static bool g4x_compute_wm0(struct drm_device *dev,
3769 int entries, tlb_miss; 3771 int entries, tlb_miss;
3770 3772
3771 crtc = intel_get_crtc_for_plane(dev, plane); 3773 crtc = intel_get_crtc_for_plane(dev, plane);
3772 if (crtc->fb == NULL || !crtc->enabled) 3774 if (crtc->fb == NULL || !crtc->enabled) {
3775 *cursor_wm = cursor->guard_size;
3776 *plane_wm = display->guard_size;
3773 return false; 3777 return false;
3778 }
3774 3779
3775 htotal = crtc->mode.htotal; 3780 htotal = crtc->mode.htotal;
3776 hdisplay = crtc->mode.hdisplay; 3781 hdisplay = crtc->mode.hdisplay;
@@ -3883,10 +3888,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
3883 display, cursor); 3888 display, cursor);
3884} 3889}
3885 3890
3886static inline bool single_plane_enabled(unsigned int mask) 3891#define single_plane_enabled(mask) is_power_of_2(mask)
3887{
3888 return mask && (mask & -mask) == 0;
3889}
3890 3892
3891static void g4x_update_wm(struct drm_device *dev) 3893static void g4x_update_wm(struct drm_device *dev)
3892{ 3894{
@@ -5777,7 +5779,6 @@ static void intel_increase_pllclock(struct drm_crtc *crtc)
5777 5779
5778 dpll &= ~DISPLAY_RATE_SELECT_FPA1; 5780 dpll &= ~DISPLAY_RATE_SELECT_FPA1;
5779 I915_WRITE(dpll_reg, dpll); 5781 I915_WRITE(dpll_reg, dpll);
5780 POSTING_READ(dpll_reg);
5781 intel_wait_for_vblank(dev, pipe); 5782 intel_wait_for_vblank(dev, pipe);
5782 5783
5783 dpll = I915_READ(dpll_reg); 5784 dpll = I915_READ(dpll_reg);
@@ -5821,7 +5822,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)
5821 5822
5822 dpll |= DISPLAY_RATE_SELECT_FPA1; 5823 dpll |= DISPLAY_RATE_SELECT_FPA1;
5823 I915_WRITE(dpll_reg, dpll); 5824 I915_WRITE(dpll_reg, dpll);
5824 dpll = I915_READ(dpll_reg);
5825 intel_wait_for_vblank(dev, pipe); 5825 intel_wait_for_vblank(dev, pipe);
5826 dpll = I915_READ(dpll_reg); 5826 dpll = I915_READ(dpll_reg);
5827 if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) 5827 if (!(dpll & DISPLAY_RATE_SELECT_FPA1))
@@ -6218,36 +6218,6 @@ cleanup_work:
6218 return ret; 6218 return ret;
6219} 6219}
6220 6220
6221static void intel_crtc_reset(struct drm_crtc *crtc)
6222{
6223 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6224
6225 /* Reset flags back to the 'unknown' status so that they
6226 * will be correctly set on the initial modeset.
6227 */
6228 intel_crtc->dpms_mode = -1;
6229}
6230
6231static struct drm_crtc_helper_funcs intel_helper_funcs = {
6232 .dpms = intel_crtc_dpms,
6233 .mode_fixup = intel_crtc_mode_fixup,
6234 .mode_set = intel_crtc_mode_set,
6235 .mode_set_base = intel_pipe_set_base,
6236 .mode_set_base_atomic = intel_pipe_set_base_atomic,
6237 .load_lut = intel_crtc_load_lut,
6238 .disable = intel_crtc_disable,
6239};
6240
6241static const struct drm_crtc_funcs intel_crtc_funcs = {
6242 .reset = intel_crtc_reset,
6243 .cursor_set = intel_crtc_cursor_set,
6244 .cursor_move = intel_crtc_cursor_move,
6245 .gamma_set = intel_crtc_gamma_set,
6246 .set_config = drm_crtc_helper_set_config,
6247 .destroy = intel_crtc_destroy,
6248 .page_flip = intel_crtc_page_flip,
6249};
6250
6251static void intel_sanitize_modesetting(struct drm_device *dev, 6221static void intel_sanitize_modesetting(struct drm_device *dev,
6252 int pipe, int plane) 6222 int pipe, int plane)
6253{ 6223{
@@ -6284,6 +6254,42 @@ static void intel_sanitize_modesetting(struct drm_device *dev,
6284 intel_disable_pipe(dev_priv, pipe); 6254 intel_disable_pipe(dev_priv, pipe);
6285} 6255}
6286 6256
6257static void intel_crtc_reset(struct drm_crtc *crtc)
6258{
6259 struct drm_device *dev = crtc->dev;
6260 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
6261
6262 /* Reset flags back to the 'unknown' status so that they
6263 * will be correctly set on the initial modeset.
6264 */
6265 intel_crtc->dpms_mode = -1;
6266
6267 /* We need to fix up any BIOS configuration that conflicts with
6268 * our expectations.
6269 */
6270 intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
6271}
6272
6273static struct drm_crtc_helper_funcs intel_helper_funcs = {
6274 .dpms = intel_crtc_dpms,
6275 .mode_fixup = intel_crtc_mode_fixup,
6276 .mode_set = intel_crtc_mode_set,
6277 .mode_set_base = intel_pipe_set_base,
6278 .mode_set_base_atomic = intel_pipe_set_base_atomic,
6279 .load_lut = intel_crtc_load_lut,
6280 .disable = intel_crtc_disable,
6281};
6282
6283static const struct drm_crtc_funcs intel_crtc_funcs = {
6284 .reset = intel_crtc_reset,
6285 .cursor_set = intel_crtc_cursor_set,
6286 .cursor_move = intel_crtc_cursor_move,
6287 .gamma_set = intel_crtc_gamma_set,
6288 .set_config = drm_crtc_helper_set_config,
6289 .destroy = intel_crtc_destroy,
6290 .page_flip = intel_crtc_page_flip,
6291};
6292
6287static void intel_crtc_init(struct drm_device *dev, int pipe) 6293static void intel_crtc_init(struct drm_device *dev, int pipe)
6288{ 6294{
6289 drm_i915_private_t *dev_priv = dev->dev_private; 6295 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -6333,8 +6339,6 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
6333 6339
6334 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer, 6340 setup_timer(&intel_crtc->idle_timer, intel_crtc_idle_timer,
6335 (unsigned long)intel_crtc); 6341 (unsigned long)intel_crtc);
6336
6337 intel_sanitize_modesetting(dev, intel_crtc->pipe, intel_crtc->plane);
6338} 6342}
6339 6343
6340int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, 6344int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
@@ -6933,7 +6937,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
6933 DRM_ERROR("timeout waiting for pcode mailbox to finish\n"); 6937 DRM_ERROR("timeout waiting for pcode mailbox to finish\n");
6934 if (pcu_mbox & (1<<31)) { /* OC supported */ 6938 if (pcu_mbox & (1<<31)) { /* OC supported */
6935 max_freq = pcu_mbox & 0xff; 6939 max_freq = pcu_mbox & 0xff;
6936 DRM_DEBUG_DRIVER("overclocking supported, adjusting frequency max to %dMHz\n", pcu_mbox * 100); 6940 DRM_DEBUG_DRIVER("overclocking supported, adjusting frequency max to %dMHz\n", pcu_mbox * 50);
6937 } 6941 }
6938 6942
6939 /* In units of 100MHz */ 6943 /* In units of 100MHz */