Commit 3c1a4673 authored by George Shen's avatar George Shen Committed by Alex Deucher
Browse files

drm/amd/display: fix link_set_dpms_off multi-display MST corner case



[Why & How]
When MST config is unplugged/replugged too quickly, it can potentially
result in a scenario where previous DC state has not been reset before
the HPD link detection sequence begins. In this case, driver will
disable the streams/link prior to re-enabling the link for link
training.

There is a bug in the current logic that does not account for the fact
that current_state can be released and cleared prior to swapping to a
new state (resulting in the pipe_ctx stream pointers to be cleared) in
between disabling streams.

To resolve this, cache the original streams prior to committing any
stream updates.

Reviewed-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Signed-off-by: default avatarGeorge Shen <george.shen@amd.com>
Signed-off-by: default avatarRay Wu <ray.wu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 15617826)
parent 874697e1
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ void link_blank_dp_stream(struct dc_link *link, bool hw_init)
void link_set_all_streams_dpms_off_for_link(struct dc_link *link)
{
	struct pipe_ctx *pipes[MAX_PIPES];
	struct dc_stream_state *streams[MAX_PIPES];
	struct dc_state *state = link->dc->current_state;
	uint8_t count;
	int i;
@@ -160,10 +161,18 @@ void link_set_all_streams_dpms_off_for_link(struct dc_link *link)

	link_get_master_pipes_with_dpms_on(link, state, &count, pipes);

	/* The subsequent call to dc_commit_updates_for_stream for a full update
	 * will release the current state and swap to a new state. Releasing the
	 * current state results in the stream pointers in the pipe_ctx structs
	 * to be zero'd. Hence, cache all streams prior to dc_commit_updates_for_stream.
	 */
	for (i = 0; i < count; i++)
		streams[i] = pipes[i]->stream;

	for (i = 0; i < count; i++) {
		stream_update.stream = pipes[i]->stream;
		stream_update.stream = streams[i];
		dc_commit_updates_for_stream(link->ctx->dc, NULL, 0,
				pipes[i]->stream, &stream_update,
				streams[i], &stream_update,
				state);
	}