diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 73 |
1 files changed, 64 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 1386086ec245..507370513f3d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1612,6 +1612,18 @@ static void chv_enable_pll(struct intel_crtc *crtc) | |||
1612 | mutex_unlock(&dev_priv->dpio_lock); | 1612 | mutex_unlock(&dev_priv->dpio_lock); |
1613 | } | 1613 | } |
1614 | 1614 | ||
1615 | static int intel_num_dvo_pipes(struct drm_device *dev) | ||
1616 | { | ||
1617 | struct intel_crtc *crtc; | ||
1618 | int count = 0; | ||
1619 | |||
1620 | for_each_intel_crtc(dev, crtc) | ||
1621 | count += crtc->active && | ||
1622 | intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO); | ||
1623 | |||
1624 | return count; | ||
1625 | } | ||
1626 | |||
1615 | static void i9xx_enable_pll(struct intel_crtc *crtc) | 1627 | static void i9xx_enable_pll(struct intel_crtc *crtc) |
1616 | { | 1628 | { |
1617 | struct drm_device *dev = crtc->base.dev; | 1629 | struct drm_device *dev = crtc->base.dev; |
@@ -1628,7 +1640,18 @@ static void i9xx_enable_pll(struct intel_crtc *crtc) | |||
1628 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 1640 | if (IS_MOBILE(dev) && !IS_I830(dev)) |
1629 | assert_panel_unlocked(dev_priv, crtc->pipe); | 1641 | assert_panel_unlocked(dev_priv, crtc->pipe); |
1630 | 1642 | ||
1631 | I915_WRITE(reg, dpll); | 1643 | /* Enable DVO 2x clock on both PLLs if necessary */ |
1644 | if (IS_I830(dev) && intel_num_dvo_pipes(dev) > 0) { | ||
1645 | /* | ||
1646 | * It appears to be important that we don't enable this | ||
1647 | * for the current pipe before otherwise configuring the | ||
1648 | * PLL. No idea how this should be handled if multiple | ||
1649 | * DVO outputs are enabled simultaneosly. | ||
1650 | */ | ||
1651 | dpll |= DPLL_DVO_2X_MODE; | ||
1652 | I915_WRITE(DPLL(!crtc->pipe), | ||
1653 | I915_READ(DPLL(!crtc->pipe)) | DPLL_DVO_2X_MODE); | ||
1654 | } | ||
1632 | 1655 | ||
1633 | /* Wait for the clocks to stabilize. */ | 1656 | /* Wait for the clocks to stabilize. */ |
1634 | POSTING_READ(reg); | 1657 | POSTING_READ(reg); |
@@ -1667,8 +1690,22 @@ static void i9xx_enable_pll(struct intel_crtc *crtc) | |||
1667 | * | 1690 | * |
1668 | * Note! This is for pre-ILK only. | 1691 | * Note! This is for pre-ILK only. |
1669 | */ | 1692 | */ |
1670 | static void i9xx_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe) | 1693 | static void i9xx_disable_pll(struct intel_crtc *crtc) |
1671 | { | 1694 | { |
1695 | struct drm_device *dev = crtc->base.dev; | ||
1696 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1697 | enum pipe pipe = crtc->pipe; | ||
1698 | |||
1699 | /* Disable DVO 2x clock on both PLLs if necessary */ | ||
1700 | if (IS_I830(dev) && | ||
1701 | intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO) && | ||
1702 | intel_num_dvo_pipes(dev) == 1) { | ||
1703 | I915_WRITE(DPLL(PIPE_B), | ||
1704 | I915_READ(DPLL(PIPE_B)) & ~DPLL_DVO_2X_MODE); | ||
1705 | I915_WRITE(DPLL(PIPE_A), | ||
1706 | I915_READ(DPLL(PIPE_A)) & ~DPLL_DVO_2X_MODE); | ||
1707 | } | ||
1708 | |||
1672 | /* Don't disable pipe or pipe PLLs if needed */ | 1709 | /* Don't disable pipe or pipe PLLs if needed */ |
1673 | if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) || | 1710 | if ((pipe == PIPE_A && dev_priv->quirks & QUIRK_PIPEA_FORCE) || |
1674 | (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE)) | 1711 | (pipe == PIPE_B && dev_priv->quirks & QUIRK_PIPEB_FORCE)) |
@@ -4185,6 +4222,11 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) | |||
4185 | 4222 | ||
4186 | intel_set_pipe_timings(intel_crtc); | 4223 | intel_set_pipe_timings(intel_crtc); |
4187 | 4224 | ||
4225 | if (intel_crtc->config.cpu_transcoder != TRANSCODER_EDP) { | ||
4226 | I915_WRITE(PIPE_MULT(intel_crtc->config.cpu_transcoder), | ||
4227 | intel_crtc->config.pixel_multiplier - 1); | ||
4228 | } | ||
4229 | |||
4188 | if (intel_crtc->config.has_pch_encoder) { | 4230 | if (intel_crtc->config.has_pch_encoder) { |
4189 | intel_cpu_transcoder_set_m_n(intel_crtc, | 4231 | intel_cpu_transcoder_set_m_n(intel_crtc, |
4190 | &intel_crtc->config.fdi_m_n, NULL); | 4232 | &intel_crtc->config.fdi_m_n, NULL); |
@@ -4941,7 +4983,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) | |||
4941 | else if (IS_VALLEYVIEW(dev)) | 4983 | else if (IS_VALLEYVIEW(dev)) |
4942 | vlv_disable_pll(dev_priv, pipe); | 4984 | vlv_disable_pll(dev_priv, pipe); |
4943 | else | 4985 | else |
4944 | i9xx_disable_pll(dev_priv, pipe); | 4986 | i9xx_disable_pll(intel_crtc); |
4945 | } | 4987 | } |
4946 | 4988 | ||
4947 | if (!IS_GEN2(dev)) | 4989 | if (!IS_GEN2(dev)) |
@@ -5945,7 +5987,7 @@ static void i8xx_update_pll(struct intel_crtc *crtc, | |||
5945 | dpll |= PLL_P2_DIVIDE_BY_4; | 5987 | dpll |= PLL_P2_DIVIDE_BY_4; |
5946 | } | 5988 | } |
5947 | 5989 | ||
5948 | if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO)) | 5990 | if (!IS_I830(dev) && intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_DVO)) |
5949 | dpll |= DPLL_DVO_2X_MODE; | 5991 | dpll |= DPLL_DVO_2X_MODE; |
5950 | 5992 | ||
5951 | if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && | 5993 | if (intel_pipe_has_type(&crtc->base, INTEL_OUTPUT_LVDS) && |
@@ -6451,6 +6493,14 @@ static bool i9xx_get_pipe_config(struct intel_crtc *crtc, | |||
6451 | } | 6493 | } |
6452 | pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe)); | 6494 | pipe_config->dpll_hw_state.dpll = I915_READ(DPLL(crtc->pipe)); |
6453 | if (!IS_VALLEYVIEW(dev)) { | 6495 | if (!IS_VALLEYVIEW(dev)) { |
6496 | /* | ||
6497 | * DPLL_DVO_2X_MODE must be enabled for both DPLLs | ||
6498 | * on 830. Filter it out here so that we don't | ||
6499 | * report errors due to that. | ||
6500 | */ | ||
6501 | if (IS_I830(dev)) | ||
6502 | pipe_config->dpll_hw_state.dpll &= ~DPLL_DVO_2X_MODE; | ||
6503 | |||
6454 | pipe_config->dpll_hw_state.fp0 = I915_READ(FP0(crtc->pipe)); | 6504 | pipe_config->dpll_hw_state.fp0 = I915_READ(FP0(crtc->pipe)); |
6455 | pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(crtc->pipe)); | 6505 | pipe_config->dpll_hw_state.fp1 = I915_READ(FP1(crtc->pipe)); |
6456 | } else { | 6506 | } else { |
@@ -7845,7 +7895,12 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, | |||
7845 | pipe_config->ips_enabled = hsw_crtc_supports_ips(crtc) && | 7895 | pipe_config->ips_enabled = hsw_crtc_supports_ips(crtc) && |
7846 | (I915_READ(IPS_CTL) & IPS_ENABLE); | 7896 | (I915_READ(IPS_CTL) & IPS_ENABLE); |
7847 | 7897 | ||
7848 | pipe_config->pixel_multiplier = 1; | 7898 | if (pipe_config->cpu_transcoder != TRANSCODER_EDP) { |
7899 | pipe_config->pixel_multiplier = | ||
7900 | I915_READ(PIPE_MULT(pipe_config->cpu_transcoder)) + 1; | ||
7901 | } else { | ||
7902 | pipe_config->pixel_multiplier = 1; | ||
7903 | } | ||
7849 | 7904 | ||
7850 | return true; | 7905 | return true; |
7851 | } | 7906 | } |
@@ -9881,9 +9936,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, | |||
9881 | unsigned long flags; | 9936 | unsigned long flags; |
9882 | int ret; | 9937 | int ret; |
9883 | 9938 | ||
9884 | //trigger software GT busyness calculation | ||
9885 | gen8_flip_interrupt(dev); | ||
9886 | |||
9887 | /* | 9939 | /* |
9888 | * drm_mode_page_flip_ioctl() should already catch this, but double | 9940 | * drm_mode_page_flip_ioctl() should already catch this, but double |
9889 | * check to be safe. In the future we may enable pageflipping from | 9941 | * check to be safe. In the future we may enable pageflipping from |
@@ -10039,8 +10091,11 @@ free_work: | |||
10039 | out_hang: | 10091 | out_hang: |
10040 | intel_crtc_wait_for_pending_flips(crtc); | 10092 | intel_crtc_wait_for_pending_flips(crtc); |
10041 | ret = intel_pipe_set_base(crtc, crtc->x, crtc->y, fb); | 10093 | ret = intel_pipe_set_base(crtc, crtc->x, crtc->y, fb); |
10042 | if (ret == 0 && event) | 10094 | if (ret == 0 && event) { |
10095 | spin_lock_irqsave(&dev->event_lock, flags); | ||
10043 | drm_send_vblank_event(dev, pipe, event); | 10096 | drm_send_vblank_event(dev, pipe, event); |
10097 | spin_unlock_irqrestore(&dev->event_lock, flags); | ||
10098 | } | ||
10044 | } | 10099 | } |
10045 | return ret; | 10100 | return ret; |
10046 | } | 10101 | } |