aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2016-03-03 04:17:42 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-03-08 05:07:53 -0500
commit9b8d1e53f6da63920ba569405b8d57ddbb42a988 (patch)
tree48ba077423db54931007416e04d0ee874e49d6a8
parentec5aaa586fe0d826b6e65a60756b9bbf4d93e011 (diff)
drm/atomic: Clean up update_connector_routing.
connector_state->crtc can no longer be unset by accident, so that check can be removed. The other code open-codes drm_atomic_get_existing_crtc_state, so use that. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> [danvet: Resolve tiny conflict due to gcc warning fix on previous patch.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index baa0fc652f43..7a034b231792 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -265,7 +265,6 @@ update_connector_routing(struct drm_atomic_state *state,
265 const struct drm_connector_helper_funcs *funcs; 265 const struct drm_connector_helper_funcs *funcs;
266 struct drm_encoder *new_encoder; 266 struct drm_encoder *new_encoder;
267 struct drm_crtc_state *crtc_state; 267 struct drm_crtc_state *crtc_state;
268 int idx;
269 268
270 DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n", 269 DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n",
271 connector->base.id, 270 connector->base.id,
@@ -273,16 +272,12 @@ update_connector_routing(struct drm_atomic_state *state,
273 272
274 if (connector->state->crtc != connector_state->crtc) { 273 if (connector->state->crtc != connector_state->crtc) {
275 if (connector->state->crtc) { 274 if (connector->state->crtc) {
276 idx = drm_crtc_index(connector->state->crtc); 275 crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
277
278 crtc_state = state->crtc_states[idx];
279 crtc_state->connectors_changed = true; 276 crtc_state->connectors_changed = true;
280 } 277 }
281 278
282 if (connector_state->crtc) { 279 if (connector_state->crtc) {
283 idx = drm_crtc_index(connector_state->crtc); 280 crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);
284
285 crtc_state = state->crtc_states[idx];
286 crtc_state->connectors_changed = true; 281 crtc_state->connectors_changed = true;
287 } 282 }
288 } 283 }
@@ -336,14 +331,9 @@ update_connector_routing(struct drm_atomic_state *state,
336 331
337 steal_encoder(state, new_encoder); 332 steal_encoder(state, new_encoder);
338 333
339 if (WARN_ON(!connector_state->crtc))
340 return -EINVAL;
341
342 set_best_encoder(state, connector_state, new_encoder); 334 set_best_encoder(state, connector_state, new_encoder);
343 335
344 idx = drm_crtc_index(connector_state->crtc); 336 crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);
345
346 crtc_state = state->crtc_states[idx];
347 crtc_state->connectors_changed = true; 337 crtc_state->connectors_changed = true;
348 338
349 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n", 339 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",