Skip to content

Commit

Permalink
drm/atomic-helpers: Make encoder picking more robust
Browse files Browse the repository at this point in the history
We've had a few issues with atomic where subtle bugs in the encoder
picking logic lead to accidental self-stealing of the encoder,
resulting in a NULL connector_state->crtc in update_connector_routing
and subsequent.

Linus applied some duct-tape for an mst regression in

commit 27667f4
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Wed Jul 29 22:18:16 2015 -0700

    i915: temporary fix for DP MST docking station NULL pointer dereference

But that was incomplete (the code will still oops when debuggin is
enabled) and mangled the state even further. So instead WARN and bail
out as the more future-proof option.

Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
  • Loading branch information
danvet committed Aug 4, 2015
1 parent 42639ba commit 6ea76f3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,14 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
}
}

if (WARN_ON(!connector_state->crtc))
return -EINVAL;

connector_state->best_encoder = new_encoder;
if (connector_state->crtc) {
idx = drm_crtc_index(connector_state->crtc);
idx = drm_crtc_index(connector_state->crtc);

crtc_state = state->crtc_states[idx];
crtc_state->mode_changed = true;
}
crtc_state = state->crtc_states[idx];
crtc_state->mode_changed = true;

DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n",
connector->base.id,
Expand Down

0 comments on commit 6ea76f3

Please sign in to comment.