On Thu, Oct 04, 2018 at 08:29:53PM -0400, Lyude Paul wrote: > Since we need to be able to allow DPMS on->off prop changes after an MST > port has disappeared from the system, we need to be able to make sure we > can compute a config for the resulting atomic commit. Currently this is > impossible when the port has disappeared, since the VCPI slot searching > we try to do in intel_dp_mst_compute_config() will fail with -EINVAL. > > Since the only commits we want to allow on no-longer-present MST ports > are ones that shut off display hardware, we already know that no VCPI > allocations are needed. So, hardcode the VCPI slot count to 0 when > intel_dp_mst_compute_config() is called on an MST port that's gone. > > Signed-off-by: Lyude Paul <lyude@xxxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > --- > drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > index fcb9b87b9339..a366f32b048a 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -42,7 +42,7 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, > to_intel_connector(conn_state->connector); > struct drm_atomic_state *state = pipe_config->base.state; > int bpp; > - int lane_count, slots; > + int lane_count, slots = 0; > const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; > int mst_pbn; > bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, > @@ -76,11 +76,16 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, > mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); > pipe_config->pbn = mst_pbn; > > - slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, > - connector->port, mst_pbn); > - if (slots < 0) { > - DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); > - return false; > + if (!connector->mst_port_gone) { Wondered why you don't need this for nouveau/amdgpu, but a bit of grepping later says they don't even bother to check that in their atomic_check functions. So if a multi-stream cable runs out of vcpi slots, they just toss up their hands, atomic be damned :-( With the s/mst_port_gone/READ_ONCE(!conn->registered)/ bikeshed: Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx> I wondered a bit whether ths fuction shouldn't just return 0 if the connector is gone, but we'd need to audit/fix other drivers first. -Daniel > + slots = drm_dp_atomic_find_vcpi_slots(state, > + &intel_dp->mst_mgr, > + connector->port, > + mst_pbn); > + if (slots < 0) { > + DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", > + slots); > + return false; > + } > } > > intel_link_compute_m_n(bpp, lane_count, > -- > 2.17.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch