aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2015-06-15 06:33:53 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-06-22 08:28:05 -0400
commiteddfcbcdc27fbecb33bff098967bbdd7ca75bfa6 (patch)
tree478a2f89193b8f4b9744d117ebc8e84f6373bed4 /drivers/gpu/drm/i915/intel_display.c
parenta539205a1628e76cbaae35c8ba64d503c6aa619b (diff)
drm/i915: Update less state during modeset.
No need to repeatedly call update_watermarks, or update_fbc. Down to a single call to update_watermarks in .crtc_enable Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Tested-by(IVB): Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c66
1 files changed, 16 insertions, 50 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 32fac724a2f8..b77ecaebeea7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1945,10 +1945,10 @@ static void intel_disable_shared_dpll(struct intel_crtc *crtc)
1945 1945
1946 /* PCH only available on ILK+ */ 1946 /* PCH only available on ILK+ */
1947 BUG_ON(INTEL_INFO(dev)->gen < 5); 1947 BUG_ON(INTEL_INFO(dev)->gen < 5);
1948 if (WARN_ON(pll == NULL)) 1948 if (pll == NULL)
1949 return; 1949 return;
1950 1950
1951 if (WARN_ON(pll->config.crtc_mask == 0)) 1951 if (WARN_ON(!(pll->config.crtc_mask & (1 << drm_crtc_index(&crtc->base)))))
1952 return; 1952 return;
1953 1953
1954 DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n", 1954 DRM_DEBUG_KMS("disable %s (active %d, on? %d) for crtc %d\n",
@@ -4653,10 +4653,6 @@ intel_post_enable_primary(struct drm_crtc *crtc)
4653 */ 4653 */
4654 hsw_enable_ips(intel_crtc); 4654 hsw_enable_ips(intel_crtc);
4655 4655
4656 mutex_lock(&dev->struct_mutex);
4657 intel_fbc_update(dev);
4658 mutex_unlock(&dev->struct_mutex);
4659
4660 /* 4656 /*
4661 * Gen2 reports pipe underruns whenever all planes are disabled. 4657 * Gen2 reports pipe underruns whenever all planes are disabled.
4662 * So don't enable underrun reporting before at least some planes 4658 * So don't enable underrun reporting before at least some planes
@@ -4711,11 +4707,6 @@ intel_pre_disable_primary(struct drm_crtc *crtc)
4711 if (HAS_GMCH_DISPLAY(dev)) 4707 if (HAS_GMCH_DISPLAY(dev))
4712 intel_set_memory_cxsr(dev_priv, false); 4708 intel_set_memory_cxsr(dev_priv, false);
4713 4709
4714 mutex_lock(&dev->struct_mutex);
4715 if (dev_priv->fbc.crtc == intel_crtc)
4716 intel_fbc_disable(dev);
4717 mutex_unlock(&dev->struct_mutex);
4718
4719 /* 4710 /*
4720 * FIXME IPS should be fine as long as one plane is 4711 * FIXME IPS should be fine as long as one plane is
4721 * enabled, but in practice it seems to have problems 4712 * enabled, but in practice it seems to have problems
@@ -4755,6 +4746,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc)
4755static void intel_pre_plane_update(struct intel_crtc *crtc) 4746static void intel_pre_plane_update(struct intel_crtc *crtc)
4756{ 4747{
4757 struct drm_device *dev = crtc->base.dev; 4748 struct drm_device *dev = crtc->base.dev;
4749 struct drm_i915_private *dev_priv = dev->dev_private;
4758 struct intel_crtc_atomic_commit *atomic = &crtc->atomic; 4750 struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
4759 struct drm_plane *p; 4751 struct drm_plane *p;
4760 4752
@@ -4784,8 +4776,13 @@ static void intel_pre_plane_update(struct intel_crtc *crtc)
4784 if (atomic->wait_for_flips) 4776 if (atomic->wait_for_flips)
4785 intel_crtc_wait_for_pending_flips(&crtc->base); 4777 intel_crtc_wait_for_pending_flips(&crtc->base);
4786 4778
4787 if (atomic->disable_fbc) 4779 if (atomic->disable_fbc &&
4788 intel_fbc_disable(dev); 4780 dev_priv->fbc.crtc == crtc) {
4781 mutex_lock(&dev->struct_mutex);
4782 if (dev_priv->fbc.crtc == crtc)
4783 intel_fbc_disable(dev);
4784 mutex_unlock(&dev->struct_mutex);
4785 }
4789 4786
4790 if (atomic->pre_disable_primary) 4787 if (atomic->pre_disable_primary)
4791 intel_pre_disable_primary(&crtc->base); 4788 intel_pre_disable_primary(&crtc->base);
@@ -5002,9 +4999,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
5002 int pipe = intel_crtc->pipe; 4999 int pipe = intel_crtc->pipe;
5003 u32 reg, temp; 5000 u32 reg, temp;
5004 5001
5005 if (WARN_ON(!intel_crtc->active))
5006 return;
5007
5008 for_each_encoder_on_crtc(dev, crtc, encoder) 5002 for_each_encoder_on_crtc(dev, crtc, encoder)
5009 encoder->disable(encoder); 5003 encoder->disable(encoder);
5010 5004
@@ -5043,18 +5037,8 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
5043 I915_WRITE(PCH_DPLL_SEL, temp); 5037 I915_WRITE(PCH_DPLL_SEL, temp);
5044 } 5038 }
5045 5039
5046 /* disable PCH DPLL */
5047 intel_disable_shared_dpll(intel_crtc);
5048
5049 ironlake_fdi_pll_disable(intel_crtc); 5040 ironlake_fdi_pll_disable(intel_crtc);
5050 } 5041 }
5051
5052 intel_crtc->active = false;
5053 intel_update_watermarks(crtc);
5054
5055 mutex_lock(&dev->struct_mutex);
5056 intel_fbc_update(dev);
5057 mutex_unlock(&dev->struct_mutex);
5058} 5042}
5059 5043
5060static void haswell_crtc_disable(struct drm_crtc *crtc) 5044static void haswell_crtc_disable(struct drm_crtc *crtc)
@@ -5065,9 +5049,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
5065 struct intel_encoder *encoder; 5049 struct intel_encoder *encoder;
5066 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; 5050 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
5067 5051
5068 if (WARN_ON(!intel_crtc->active))
5069 return;
5070
5071 for_each_encoder_on_crtc(dev, crtc, encoder) { 5052 for_each_encoder_on_crtc(dev, crtc, encoder) {
5072 intel_opregion_notify_encoder(encoder, false); 5053 intel_opregion_notify_encoder(encoder, false);
5073 encoder->disable(encoder); 5054 encoder->disable(encoder);
@@ -5103,16 +5084,6 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
5103 for_each_encoder_on_crtc(dev, crtc, encoder) 5084 for_each_encoder_on_crtc(dev, crtc, encoder)
5104 if (encoder->post_disable) 5085 if (encoder->post_disable)
5105 encoder->post_disable(encoder); 5086 encoder->post_disable(encoder);
5106
5107 intel_crtc->active = false;
5108 intel_update_watermarks(crtc);
5109
5110 mutex_lock(&dev->struct_mutex);
5111 intel_fbc_update(dev);
5112 mutex_unlock(&dev->struct_mutex);
5113
5114 if (intel_crtc_to_shared_dpll(intel_crtc))
5115 intel_disable_shared_dpll(intel_crtc);
5116} 5087}
5117 5088
5118static void i9xx_pfit_enable(struct intel_crtc *crtc) 5089static void i9xx_pfit_enable(struct intel_crtc *crtc)
@@ -6166,9 +6137,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
6166 struct intel_encoder *encoder; 6137 struct intel_encoder *encoder;
6167 int pipe = intel_crtc->pipe; 6138 int pipe = intel_crtc->pipe;
6168 6139
6169 if (WARN_ON(!intel_crtc->active))
6170 return;
6171
6172 /* 6140 /*
6173 * On gen2 planes are double buffered but the pipe isn't, so we must 6141 * On gen2 planes are double buffered but the pipe isn't, so we must
6174 * wait for planes to fully turn off before disabling the pipe. 6142 * wait for planes to fully turn off before disabling the pipe.
@@ -6202,13 +6170,6 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
6202 6170
6203 if (!IS_GEN2(dev)) 6171 if (!IS_GEN2(dev))
6204 intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false); 6172 intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
6205
6206 intel_crtc->active = false;
6207 intel_update_watermarks(crtc);
6208
6209 mutex_lock(&dev->struct_mutex);
6210 intel_fbc_update(dev);
6211 mutex_unlock(&dev->struct_mutex);
6212} 6173}
6213 6174
6214static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) 6175static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
@@ -11931,6 +11892,9 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc,
11931 if (pipe_config->quirks & PIPE_CONFIG_QUIRK_INITIAL_PLANES) 11892 if (pipe_config->quirks & PIPE_CONFIG_QUIRK_INITIAL_PLANES)
11932 intel_crtc_check_initial_planes(crtc, crtc_state); 11893 intel_crtc_check_initial_planes(crtc, crtc_state);
11933 11894
11895 if (mode_changed)
11896 intel_crtc->atomic.update_wm = !crtc_state->active;
11897
11934 if (mode_changed && crtc_state->enable && 11898 if (mode_changed && crtc_state->enable &&
11935 dev_priv->display.crtc_compute_clock && 11899 dev_priv->display.crtc_compute_clock &&
11936 !WARN_ON(pipe_config->shared_dpll != DPLL_ID_PRIVATE)) { 11900 !WARN_ON(pipe_config->shared_dpll != DPLL_ID_PRIVATE)) {
@@ -13218,6 +13182,8 @@ static int __intel_set_mode(struct drm_atomic_state *state)
13218 if (crtc_state->active) { 13182 if (crtc_state->active) {
13219 intel_crtc_disable_planes(crtc, crtc_state->plane_mask); 13183 intel_crtc_disable_planes(crtc, crtc_state->plane_mask);
13220 dev_priv->display.crtc_disable(crtc); 13184 dev_priv->display.crtc_disable(crtc);
13185 intel_crtc->active = false;
13186 intel_disable_shared_dpll(intel_crtc);
13221 } 13187 }
13222 } 13188 }
13223 13189