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:49 -0400
committerJani Nikula <jani.nikula@intel.com>2015-06-12 06:19:31 -0400
commit3cb480bcb3397a1cfdc04115adcdb33393fde4f9 (patch)
treefe86e150cc3cf68bcc281f44d7166fb54566c991 /drivers/gpu/drm/i915/intel_display.c
parent1b5092592824d1c91d6e48d820b6047f6ba323ce (diff)
drm/i915: Use drm_atomic_helper_update_legacy_modeset_state, v2.
Now that the helper is exported there's no need to duplicate this code any more. Changes since v1: - move intel_modeset_update_staged_output_state call to the right place. 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.c61
1 files changed, 4 insertions, 57 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index aab75d3b7d20..c1042ea50136 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -11737,43 +11737,6 @@ static void intel_modeset_update_connector_atomic_state(struct drm_device *dev)
11737 } 11737 }
11738} 11738}
11739 11739
11740/* Fixup legacy state after an atomic state swap.
11741 */
11742static void intel_modeset_fixup_state(struct drm_atomic_state *state)
11743{
11744 struct intel_crtc *crtc;
11745 struct intel_encoder *encoder;
11746 struct intel_connector *connector;
11747
11748 for_each_intel_connector(state->dev, connector) {
11749 connector->base.encoder = connector->base.state->best_encoder;
11750 if (connector->base.encoder)
11751 connector->base.encoder->crtc =
11752 connector->base.state->crtc;
11753 }
11754
11755 /* Update crtc of disabled encoders */
11756 for_each_intel_encoder(state->dev, encoder) {
11757 int num_connectors = 0;
11758
11759 for_each_intel_connector(state->dev, connector)
11760 if (connector->base.encoder == &encoder->base)
11761 num_connectors++;
11762
11763 if (num_connectors == 0)
11764 encoder->base.crtc = NULL;
11765 }
11766
11767 for_each_intel_crtc(state->dev, crtc) {
11768 crtc->base.enabled = crtc->base.state->enable;
11769 crtc->config = to_intel_crtc_state(crtc->base.state);
11770 }
11771
11772 /* Copy the new configuration to the staged state, to keep the few
11773 * pieces of code that haven't been converted yet happy */
11774 intel_modeset_update_staged_output_state(state->dev);
11775}
11776
11777static void 11740static void
11778connected_sink_compute_bpp(struct intel_connector *connector, 11741connected_sink_compute_bpp(struct intel_connector *connector,
11779 struct intel_crtc_state *pipe_config) 11742 struct intel_crtc_state *pipe_config)
@@ -12261,11 +12224,14 @@ intel_modeset_update_state(struct drm_atomic_state *state)
12261 intel_encoder->connectors_active = false; 12224 intel_encoder->connectors_active = false;
12262 } 12225 }
12263 12226
12264 intel_modeset_fixup_state(state); 12227 drm_atomic_helper_update_legacy_modeset_state(state->dev, state);
12228 intel_modeset_update_staged_output_state(state->dev);
12265 12229
12266 /* Double check state. */ 12230 /* Double check state. */
12267 for_each_crtc(dev, crtc) { 12231 for_each_crtc(dev, crtc) {
12268 WARN_ON(crtc->state->enable != intel_crtc_in_use(crtc)); 12232 WARN_ON(crtc->state->enable != intel_crtc_in_use(crtc));
12233
12234 to_intel_crtc(crtc)->config = to_intel_crtc_state(crtc->state);
12269 } 12235 }
12270 12236
12271 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 12237 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
@@ -12972,25 +12938,6 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
12972 drm_plane_helper_disable(crtc->primary); 12938 drm_plane_helper_disable(crtc->primary);
12973 } 12939 }
12974 12940
12975 /* crtc->mode is already used by the ->mode_set callbacks, hence we need
12976 * to set it here already despite that we pass it down the callchain.
12977 *
12978 * Note we'll need to fix this up when we start tracking multiple
12979 * pipes; here we assume a single modeset_pipe and only track the
12980 * single crtc and mode.
12981 */
12982 if (pipe_config->base.enable && needs_modeset(&pipe_config->base)) {
12983 modeset_crtc->mode = pipe_config->base.mode;
12984
12985 /*
12986 * Calculate and store various constants which
12987 * are later needed by vblank and swap-completion
12988 * timestamping. They are derived from true hwmode.
12989 */
12990 drm_calc_timestamping_constants(modeset_crtc,
12991 &pipe_config->base.adjusted_mode);
12992 }
12993
12994 /* Only after disabling all output pipelines that will be changed can we 12941 /* Only after disabling all output pipelines that will be changed can we
12995 * update the the output configuration. */ 12942 * update the the output configuration. */
12996 intel_modeset_update_state(state); 12943 intel_modeset_update_state(state);