[PATCH 09/20] drm/i915/dp: Remove the modeset retry event's dependece on atomic state

Imre Deak imre.deak at intel.com
Tue May 14 19:14:07 UTC 2024


When notifying userspace to retry a modeset, the notified connectors are
not really specific to those contained in the atomic state. For MST,
where this makes a difference, all enabled connectors in the same MST
topology should be notified which is guaranteed by the commit adding all
these connectors to the atomic state. Instead of relying on this we can
notify all the relevant connectors based on their (root) encoder. Using
intel_dp_has_connector() simplifies the SST case as well.

This prepares for a later patch sending a notification during link
training, to which the atomic state is not passed down.

Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c       | 29 ++++++++++---------
 drivers/gpu/drm/i915/display/intel_dp.h       |  5 +---
 .../gpu/drm/i915/display/intel_dp_tunnel.c    |  2 +-
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index da56a2b7fa0f8..6969d35b6bb0a 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2800,29 +2800,30 @@ void intel_dp_queue_modeset_retry_work(struct intel_connector *connector)
 		drm_connector_put(&connector->base);
 }
 
-void
-intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,
-				      struct intel_encoder *encoder,
-				      const struct intel_crtc_state *crtc_state)
+static bool intel_dp_has_connector(struct intel_dp *intel_dp,
+				   const struct drm_connector_state *conn_state);
+
+void intel_dp_queue_modeset_retry_for_link(struct intel_encoder *encoder)
 {
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+	struct drm_connector_list_iter conn_iter;
 	struct intel_connector *connector;
-	struct intel_digital_connector_state *conn_state;
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-	int i;
 
-	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)) {
-		intel_dp_queue_modeset_retry_work(intel_dp->attached_connector);
+	drm_connector_list_iter_begin(&i915->drm, &conn_iter);
+	for_each_intel_connector_iter(connector, &conn_iter) {
+		struct drm_connector_state *conn_state =
+			connector->base.state;
 
-		return;
-	}
+		if (!intel_dp_has_connector(intel_dp, conn_state))
+			continue;
 
-	for_each_new_intel_connector_in_state(state, connector, conn_state, i) {
-		if (!conn_state->base.crtc)
+		if (!conn_state->crtc)
 			continue;
 
-		if (connector->mst_port == intel_dp)
-			intel_dp_queue_modeset_retry_work(connector);
+		intel_dp_queue_modeset_retry_work(connector);
 	}
+	drm_connector_list_iter_end(&conn_iter);
 }
 
 int
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index 6a1f2a2856998..05016e13fb944 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -45,10 +45,7 @@ bool intel_dp_limited_color_range(const struct intel_crtc_state *crtc_state,
 int intel_dp_min_bpp(enum intel_output_format output_format);
 void intel_dp_init_modeset_retry_work(struct intel_connector *connector);
 void intel_dp_queue_modeset_retry_work(struct intel_connector *connector);
-void
-intel_dp_queue_modeset_retry_for_link(struct intel_atomic_state *state,
-				      struct intel_encoder *encoder,
-				      const struct intel_crtc_state *crtc_state);
+void intel_dp_queue_modeset_retry_for_link(struct intel_encoder *encoder);
 bool intel_dp_init_connector(struct intel_digital_port *dig_port,
 			     struct intel_connector *intel_connector);
 void intel_dp_connector_sync_state(struct intel_connector *connector,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
index 6503abdc2b988..34a00b2a40e36 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
@@ -722,7 +722,7 @@ static void queue_retry_work(struct intel_atomic_state *state,
 		    encoder->base.base.id,
 		    encoder->base.name);
 
-	intel_dp_queue_modeset_retry_for_link(state, encoder, crtc_state);
+	intel_dp_queue_modeset_retry_for_link(encoder);
 }
 
 static void atomic_increase_bw(struct intel_atomic_state *state)
-- 
2.43.3



More information about the Intel-gfx mailing list