[Intel-gfx] [PATCH v2 10/17] drm/i915/dp_mst: Verify the MST state of modesetted outputs

Imre Deak imre.deak at intel.com
Tue Jan 31 15:05:41 UTC 2023


Verify the MST state after disabling/enabling outputs during an atomic
commit.

v2: Iterate through the connectors in each MST topology to prepare
    for a follow-up patch adding HW state verification.

Cc: Lyude Paul <lyude at redhat.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c  |  4 +-
 drivers/gpu/drm/i915/display/intel_dp.c       |  2 +-
 drivers/gpu/drm/i915/display/intel_dp.h       |  1 +
 drivers/gpu/drm/i915/display/intel_dp_mst.c   | 37 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp_mst.h   |  1 +
 .../drm/i915/display/intel_modeset_verify.c   |  2 +
 6 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 36269ae34075e..7976658771ab3 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7539,8 +7539,10 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
 	intel_check_cpu_fifo_underruns(dev_priv);
 	intel_check_pch_fifo_underruns(dev_priv);
 
-	if (state->modeset)
+	if (state->modeset) {
 		intel_verify_planes(state);
+		intel_dp_mst_verify_state(state);
+	}
 
 	intel_sagv_post_plane_update(state);
 
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 501163c5c590d..d6b0ef38f6563 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4085,7 +4085,7 @@ static int intel_dp_prep_link_retrain(struct intel_dp *intel_dp,
 	return ret;
 }
 
-static bool intel_dp_is_connected(struct intel_dp *intel_dp)
+bool intel_dp_is_connected(struct intel_dp *intel_dp)
 {
 	struct intel_connector *connector = intel_dp->attached_connector;
 
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h
index ef39e4f7a329e..1294384840190 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -102,6 +102,7 @@ void intel_read_dp_sdp(struct intel_encoder *encoder,
 		       struct intel_crtc_state *crtc_state,
 		       unsigned int type);
 bool intel_digital_port_connected(struct intel_encoder *encoder);
+bool intel_dp_is_connected(struct intel_dp *intel_dp);
 int intel_dp_dsc_compute_bpp(struct intel_dp *intel_dp, u8 dsc_max_bpc);
 u16 intel_dp_dsc_get_output_bpp(struct drm_i915_private *i915,
 				u32 link_clock, u32 lane_count,
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
index 421a0f8c28229..08222fc6c5ecd 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -1276,3 +1276,40 @@ int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
 
 	return 0;
 }
+
+/**
+ * intel_dp_mst_verify_state - Verify the MST state for all connectors in the atomic state
+ * @state: atomic state
+ *
+ * Verify the MST SW and sink state for all modesetted MST connectors in @state.
+ */
+void intel_dp_mst_verify_state(struct intel_atomic_state *state)
+{
+	struct drm_dp_mst_topology_state *mst_state;
+	struct drm_dp_mst_topology_mgr *mgr;
+	int i;
+
+	for_each_new_mst_mgr_in_state(&state->base, mgr, mst_state, i) {
+		struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr);
+		struct drm_connector *_connector;
+		struct drm_connector_state *_conn_state;
+		bool mst_needs_modeset = false;
+
+		for_each_new_connector_in_state(&state->base, _connector, _conn_state, i) {
+			struct intel_connector *connector = to_intel_connector(_connector);
+
+			if (!connector->mst_port ||
+			    !intel_connector_needs_modeset(state, &connector->base))
+				continue;
+
+			mst_needs_modeset = true;
+
+			break;
+		}
+
+		if (!mst_needs_modeset)
+			continue;
+
+		drm_dp_mst_verify_payload_state(&state->base, mgr, intel_dp_is_connected(intel_dp));
+	}
+}
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.h b/drivers/gpu/drm/i915/display/intel_dp_mst.h
index cd0ae661dc20b..74633390c280c 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.h
@@ -26,5 +26,6 @@ int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
 int intel_dp_mst_add_topology_state_for_connector(struct intel_atomic_state *state,
 						  struct intel_connector *connector,
 						  struct intel_crtc *crtc);
+void intel_dp_mst_verify_state(struct intel_atomic_state *state);
 
 #endif /* __INTEL_DP_MST_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_modeset_verify.c b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
index 842d70f0dfd2a..45f0d9789ef8e 100644
--- a/drivers/gpu/drm/i915/display/intel_modeset_verify.c
+++ b/drivers/gpu/drm/i915/display/intel_modeset_verify.c
@@ -13,6 +13,7 @@
 #include "intel_crtc_state_dump.h"
 #include "intel_display.h"
 #include "intel_display_types.h"
+#include "intel_dp_mst.h"
 #include "intel_fdi.h"
 #include "intel_modeset_verify.h"
 #include "intel_snps_phy.h"
@@ -244,4 +245,5 @@ void intel_modeset_verify_disabled(struct drm_i915_private *dev_priv,
 	verify_encoder_state(dev_priv, state);
 	verify_connector_state(state, NULL);
 	intel_shared_dpll_verify_disabled(dev_priv);
+	intel_dp_mst_verify_state(state);
 }
-- 
2.37.1



More information about the Intel-gfx mailing list