Commit 310d3577 authored by Lyude Paul's avatar Lyude Paul Committed by Ben Skeggs
Browse files

drm/nouveau/kms/nv50-: Call outp_atomic_check_view() before handling PBN



Since nv50_outp_atomic_check_view() can set crtc_state->mode_changed, we
probably should be calling it before handling any PBN changes. Just a
precaution.

Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Fixes: 232c9eec ("drm/nouveau: Use atomic VCPI helpers for MST")
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@redhat.com>
Cc: Jerry Zuo <Jerry.Zuo@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Juston Li <juston.li@intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: <stable@vger.kernel.org> # v5.1+
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 64d17f25
Loading
Loading
Loading
Loading
+24 −20
Original line number Diff line number Diff line
@@ -770,13 +770,20 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
	struct nv50_mstm *mstm = mstc->mstm;
	struct nv50_head_atom *asyh = nv50_head_atom(crtc_state);
	int slots;
	int ret;

	ret = nv50_outp_atomic_check_view(encoder, crtc_state, conn_state,
					  mstc->native);
	if (ret)
		return ret;

	if (!crtc_state->mode_changed && !crtc_state->connectors_changed)
		return 0;

	if (crtc_state->mode_changed || crtc_state->connectors_changed) {
	/*
		 * When restoring duplicated states, we need to make sure that
		 * the bw remains the same and avoid recalculating it, as the
		 * connector's bpc may have changed after the state was
		 * duplicated
	 * When restoring duplicated states, we need to make sure that the bw
	 * remains the same and avoid recalculating it, as the connector's bpc
	 * may have changed after the state was duplicated
	 */
	if (!state->duplicated) {
		const int bpp = connector->display_info.bpc * 3;
@@ -785,17 +792,14 @@ nv50_msto_atomic_check(struct drm_encoder *encoder,
		asyh->dp.pbn = drm_dp_calc_pbn_mode(clock, bpp);
	}

		slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr,
						      mstc->port,
	slots = drm_dp_atomic_find_vcpi_slots(state, &mstm->mgr, mstc->port,
					      asyh->dp.pbn);
	if (slots < 0)
		return slots;

	asyh->dp.tu = slots;
	}

	return nv50_outp_atomic_check_view(encoder, crtc_state, conn_state,
					   mstc->native);
	return 0;
}

static void