Skip to contentSkip to conversation

drm/amd/display: Handle removed connector in early_unregister

PATCH Superseded Fangzhi Zuo 1 participant 1 message Feb 3, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Handle removed connector in early_unregister

From: Wayne Lin <[email protected]>

This patch lived in our internal branch since August but somehow missed the merge to upstream.

Original Patch:
(dc: Handle removed connector in early_unregister)

---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |  7 ++++
 .../display/amdgpu_dm/amdgpu_dm_mst_types.c   | 41 +++++++++++++++++--
 .../gpu/drm/amd/display/dc/core/dc_stream.c   | 12 ++++++
 drivers/gpu/drm/amd/display/dc/dc_stream.h    |  1 +
 4 files changed, 58 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +7 -0
index f5941e59e5ad..529b3ddaa10b 100644
@@ -3034,6 +3034,7 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
 	struct drm_connector *connector = &aconnector->base;
 	struct drm_device *dev = connector->dev;
 	enum dc_connection_type new_connection_type = dc_connection_none;
+	enum dc_connection_type old_connection_type = aconnector->dc_link->type;
 	struct amdgpu_device *adev = drm_to_adev(dev);
 	struct dm_connector_state *dm_con_state = to_dm_connector_state(connector->state);
 	struct dm_crtc_state *dm_crtc_state = NULL;
@@ -3074,7 +3075,13 @@ static void handle_hpd_irq_helper(struct amdgpu_dm_connector *aconnector)
 			drm_kms_helper_hotplug_event(dev);
 
 	} else if (dc_link_detect(aconnector->dc_link, DETECT_REASON_HPD)) {
+		/**
+		 * MST cases are handled within .early_unregister where we
+		 * can handle disconnected conectors reported by long HPD
+		 * and CSN.
+		 */
 		if (new_connection_type == dc_connection_none &&
+			old_connection_type != dc_connection_mst_branch &&
 		    aconnector->dc_link->type == dc_connection_none &&
 		    dm_crtc_state)
 			dm_set_dpms_off(aconnector->dc_link, dm_crtc_state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +38 -3

49 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_stream.c +12 -0
index 57cf4cb82370..a77c90c14e85 100644
@@ -739,3 +739,15 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream)
 			stream->link->link_index);
 }
 
+struct dc_stream_state *dc_stream_get_stream_by_sink(struct dc_sink *sink)
+{
+	uint8_t i;
+	struct dc_context *ctx = sink->ctx;
+
+	for (i = 0; i < ctx->dc->current_state->stream_count; i++) {
+		if (ctx->dc->current_state->streams[i]->sink == sink)
+			return ctx->dc->current_state->streams[i];
+	}
+
+	return NULL;
+}
\ No newline at end of file
drivers/gpu/drm/amd/display/dc/dc_stream.h +1 -0
index f631b61abedd..89f67c711161 100644
@@ -321,6 +321,7 @@ void dc_stream_log(const struct dc *dc, const struct dc_stream_state *stream);
 uint8_t dc_get_current_stream_count(struct dc *dc);
 struct dc_stream_state *dc_get_stream_at_index(struct dc *dc, uint8_t i);
 struct dc_stream_state *dc_stream_find_from_link(const struct dc_link *link);
+struct dc_stream_state *dc_stream_get_stream_by_sink(struct dc_sink *sink);
 
 /*
  * Return the current frame counter.
Signature · 1 line
2.25.1