Commit 9b8d1e53 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Daniel Vetter

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: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Resolve tiny conflict due to gcc warning fix on previous
patch.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent ec5aaa58
...@@ -265,7 +265,6 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -265,7 +265,6 @@ update_connector_routing(struct drm_atomic_state *state,
const struct drm_connector_helper_funcs *funcs; const struct drm_connector_helper_funcs *funcs;
struct drm_encoder *new_encoder; struct drm_encoder *new_encoder;
struct drm_crtc_state *crtc_state; struct drm_crtc_state *crtc_state;
int idx;
DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n", DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n",
connector->base.id, connector->base.id,
...@@ -273,16 +272,12 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -273,16 +272,12 @@ update_connector_routing(struct drm_atomic_state *state,
if (connector->state->crtc != connector_state->crtc) { if (connector->state->crtc != connector_state->crtc) {
if (connector->state->crtc) { if (connector->state->crtc) {
idx = drm_crtc_index(connector->state->crtc); crtc_state = drm_atomic_get_existing_crtc_state(state, connector->state->crtc);
crtc_state = state->crtc_states[idx];
crtc_state->connectors_changed = true; crtc_state->connectors_changed = true;
} }
if (connector_state->crtc) { if (connector_state->crtc) {
idx = drm_crtc_index(connector_state->crtc); crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);
crtc_state = state->crtc_states[idx];
crtc_state->connectors_changed = true; crtc_state->connectors_changed = true;
} }
} }
...@@ -336,14 +331,9 @@ update_connector_routing(struct drm_atomic_state *state, ...@@ -336,14 +331,9 @@ update_connector_routing(struct drm_atomic_state *state,
steal_encoder(state, new_encoder); steal_encoder(state, new_encoder);
if (WARN_ON(!connector_state->crtc))
return -EINVAL;
set_best_encoder(state, connector_state, new_encoder); set_best_encoder(state, connector_state, new_encoder);
idx = drm_crtc_index(connector_state->crtc); crtc_state = drm_atomic_get_existing_crtc_state(state, connector_state->crtc);
crtc_state = state->crtc_states[idx];
crtc_state->connectors_changed = true; crtc_state->connectors_changed = true;
DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n", DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d:%s]\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment