aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2015-06-01 06:49:52 -0400
committerJani Nikula <jani.nikula@intel.com>2015-06-12 06:19:32 -0400
commit53d9f4e99de001374eb06195609cc0451f31a318 (patch)
treeb4a2311f52d2915249b6aae9cdb958400afffadb /drivers/gpu/drm/i915/intel_display.c
parentcdba954e426761cdfe08ce4c9909cd97ce254b9c (diff)
drm/i915: Use crtc_state->active instead of crtc_state->enable
crtc_state->enable means a crtc is configured, but it may be turned off for dpms. Until the commit "use intel_crtc_control everywhere" crtc_state->active was not updated on crtc off, but now crtc_state->active should be used for tracking whether a crtc is scanning out or not. A few commits from now dpms will be handled by calling intel_set_mode with a different value for crtc_state->active, which causes a crtc to turn on or off. At this point crtc->active should mirror crtc_state->active, so some paranoia from the crtc_disable functions can be removed. intel_set_mode_setup_plls still checks for ->enable, because all resources that are needed have to be calculated, else dpms changes may not succeed. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index eb40f9fc9b44..4648fa5ab55a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4629,7 +4629,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
4629 bool reenable_ips = false; 4629 bool reenable_ips = false;
4630 4630
4631 /* The clocks have to be on to load the palette. */ 4631 /* The clocks have to be on to load the palette. */
4632 if (!crtc->state->enable || !intel_crtc->active) 4632 if (!crtc->state->active)
4633 return; 4633 return;
4634 4634
4635 if (HAS_GMCH_DISPLAY(dev_priv->dev)) { 4635 if (HAS_GMCH_DISPLAY(dev_priv->dev)) {
@@ -4845,9 +4845,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
4845 struct intel_encoder *encoder; 4845 struct intel_encoder *encoder;
4846 int pipe = intel_crtc->pipe; 4846 int pipe = intel_crtc->pipe;
4847 4847
4848 WARN_ON(!crtc->state->enable); 4848 if (WARN_ON(intel_crtc->active))
4849
4850 if (intel_crtc->active)
4851 return; 4849 return;
4852 4850
4853 if (intel_crtc->config->has_pch_encoder) 4851 if (intel_crtc->config->has_pch_encoder)
@@ -4951,9 +4949,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
4951 struct intel_encoder *encoder; 4949 struct intel_encoder *encoder;
4952 int pipe = intel_crtc->pipe; 4950 int pipe = intel_crtc->pipe;
4953 4951
4954 WARN_ON(!crtc->state->enable); 4952 if (WARN_ON(intel_crtc->active))
4955
4956 if (intel_crtc->active)
4957 return; 4953 return;
4958 4954
4959 if (intel_crtc_to_shared_dpll(intel_crtc)) 4955 if (intel_crtc_to_shared_dpll(intel_crtc))
@@ -5055,7 +5051,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
5055 int pipe = intel_crtc->pipe; 5051 int pipe = intel_crtc->pipe;
5056 u32 reg, temp; 5052 u32 reg, temp;
5057 5053
5058 if (!intel_crtc->active) 5054 if (WARN_ON(!intel_crtc->active))
5059 return; 5055 return;
5060 5056
5061 for_each_encoder_on_crtc(dev, crtc, encoder) 5057 for_each_encoder_on_crtc(dev, crtc, encoder)
@@ -5118,7 +5114,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
5118 struct intel_encoder *encoder; 5114 struct intel_encoder *encoder;
5119 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder; 5115 enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
5120 5116
5121 if (!intel_crtc->active) 5117 if (WARN_ON(!intel_crtc->active))
5122 return; 5118 return;
5123 5119
5124 for_each_encoder_on_crtc(dev, crtc, encoder) { 5120 for_each_encoder_on_crtc(dev, crtc, encoder) {
@@ -5978,7 +5974,7 @@ static int valleyview_modeset_global_pipes(struct drm_atomic_state *state)
5978 5974
5979 /* add all active pipes to the state */ 5975 /* add all active pipes to the state */
5980 for_each_crtc(state->dev, crtc) { 5976 for_each_crtc(state->dev, crtc) {
5981 if (!crtc->state->enable) 5977 if (!crtc->state->active)
5982 continue; 5978 continue;
5983 5979
5984 crtc_state = drm_atomic_get_crtc_state(state, crtc); 5980 crtc_state = drm_atomic_get_crtc_state(state, crtc);
@@ -5988,7 +5984,7 @@ static int valleyview_modeset_global_pipes(struct drm_atomic_state *state)
5988 5984
5989 /* disable/enable all currently active pipes while we change cdclk */ 5985 /* disable/enable all currently active pipes while we change cdclk */
5990 for_each_crtc_in_state(state, crtc, crtc_state, i) 5986 for_each_crtc_in_state(state, crtc, crtc_state, i)
5991 if (crtc_state->enable) 5987 if (crtc_state->active)
5992 crtc_state->mode_changed = true; 5988 crtc_state->mode_changed = true;
5993 5989
5994 return 0; 5990 return 0;
@@ -6076,9 +6072,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
6076 int pipe = intel_crtc->pipe; 6072 int pipe = intel_crtc->pipe;
6077 bool is_dsi; 6073 bool is_dsi;
6078 6074
6079 WARN_ON(!crtc->state->enable); 6075 if (WARN_ON(intel_crtc->active))
6080
6081 if (intel_crtc->active)
6082 return; 6076 return;
6083 6077
6084 is_dsi = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI); 6078 is_dsi = intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI);
@@ -6154,9 +6148,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
6154 struct intel_encoder *encoder; 6148 struct intel_encoder *encoder;
6155 int pipe = intel_crtc->pipe; 6149 int pipe = intel_crtc->pipe;
6156 6150
6157 WARN_ON(!crtc->state->enable); 6151 if (WARN_ON(intel_crtc->active))
6158
6159 if (intel_crtc->active)
6160 return; 6152 return;
6161 6153
6162 i9xx_set_pll_dividers(intel_crtc); 6154 i9xx_set_pll_dividers(intel_crtc);
@@ -6216,7 +6208,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
6216 struct intel_encoder *encoder; 6208 struct intel_encoder *encoder;
6217 int pipe = intel_crtc->pipe; 6209 int pipe = intel_crtc->pipe;
6218 6210
6219 if (!intel_crtc->active) 6211 if (WARN_ON(!intel_crtc->active))
6220 return; 6212 return;
6221 6213
6222 /* 6214 /*
@@ -12264,7 +12256,7 @@ intel_modeset_update_state(struct drm_atomic_state *state)
12264 if (!crtc_state || !needs_modeset(crtc->state)) 12256 if (!crtc_state || !needs_modeset(crtc->state))
12265 continue; 12257 continue;
12266 12258
12267 if (crtc->state->enable) { 12259 if (crtc->state->active) {
12268 struct drm_property *dpms_property = 12260 struct drm_property *dpms_property =
12269 dev->mode_config.dpms_property; 12261 dev->mode_config.dpms_property;
12270 12262
@@ -12679,6 +12671,10 @@ check_crtc_state(struct drm_device *dev)
12679 "crtc active state doesn't match with hw state " 12671 "crtc active state doesn't match with hw state "
12680 "(expected %i, found %i)\n", crtc->active, active); 12672 "(expected %i, found %i)\n", crtc->active, active);
12681 12673
12674 I915_STATE_WARN(crtc->active != crtc->base.state->active,
12675 "transitional active state does not match atomic hw state "
12676 "(expected %i, found %i)\n", crtc->base.state->active, crtc->active);
12677
12682 if (active && 12678 if (active &&
12683 !intel_pipe_config_compare(dev, crtc->config, &pipe_config)) { 12679 !intel_pipe_config_compare(dev, crtc->config, &pipe_config)) {
12684 I915_STATE_WARN(1, "pipe state doesn't match!\n"); 12680 I915_STATE_WARN(1, "pipe state doesn't match!\n");
@@ -12820,6 +12816,10 @@ intel_modeset_compute_config(struct drm_crtc *crtc,
12820 if (IS_ERR(pipe_config)) 12816 if (IS_ERR(pipe_config))
12821 return pipe_config; 12817 return pipe_config;
12822 12818
12819 if (!pipe_config->base.enable &&
12820 WARN_ON(pipe_config->base.active))
12821 pipe_config->base.active = false;
12822
12823 if (!pipe_config->base.enable) 12823 if (!pipe_config->base.enable)
12824 return pipe_config; 12824 return pipe_config;
12825 12825
@@ -12932,7 +12932,7 @@ static int __intel_set_mode(struct drm_atomic_state *state)
12932 return ret; 12932 return ret;
12933 12933
12934 for_each_crtc_in_state(state, crtc, crtc_state, i) { 12934 for_each_crtc_in_state(state, crtc, crtc_state, i) {
12935 if (!needs_modeset(crtc_state)) 12935 if (!needs_modeset(crtc_state) || !crtc->state->active)
12936 continue; 12936 continue;
12937 12937
12938 intel_crtc_disable_planes(crtc); 12938 intel_crtc_disable_planes(crtc);
@@ -12954,7 +12954,7 @@ static int __intel_set_mode(struct drm_atomic_state *state)
12954 12954
12955 /* Now enable the clocks, plane, pipe, and connectors that we set up. */ 12955 /* Now enable the clocks, plane, pipe, and connectors that we set up. */
12956 for_each_crtc_in_state(state, crtc, crtc_state, i) { 12956 for_each_crtc_in_state(state, crtc, crtc_state, i) {
12957 if (!needs_modeset(crtc->state) || !crtc->state->enable) 12957 if (!needs_modeset(crtc->state) || !crtc->state->active)
12958 continue; 12958 continue;
12959 12959
12960 update_scanline_offset(to_intel_crtc(crtc)); 12960 update_scanline_offset(to_intel_crtc(crtc));
@@ -15215,7 +15215,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
15215 * have active connectors/encoders. */ 15215 * have active connectors/encoders. */
15216 intel_crtc_update_dpms(&crtc->base); 15216 intel_crtc_update_dpms(&crtc->base);
15217 15217
15218 if (crtc->active != crtc->base.state->enable) { 15218 if (crtc->active != crtc->base.state->active) {
15219 struct intel_encoder *encoder; 15219 struct intel_encoder *encoder;
15220 15220
15221 /* This can happen either due to bugs in the get_hw_state 15221 /* This can happen either due to bugs in the get_hw_state