All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 9/9] drm/i915/dp_mst: Verify the MST state of modesetted outputs
Date: Wed, 25 Jan 2023 13:48:52 +0200	[thread overview]
Message-ID: <20230125114852.748337-10-imre.deak@intel.com> (raw)
In-Reply-To: <20230125114852.748337-1-imre.deak@intel.com>

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

Signed-off-by: Imre Deak <imre.deak@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   | 33 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp_mst.h   |  1 +
 .../drm/i915/display/intel_modeset_verify.c   |  2 ++
 6 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index b1e895b01c111..8efa3a29faafc 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -7537,8 +7537,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 441fbbfa2d008..a87e3d04e5cb8 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4086,7 +4086,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 6726fd36723d7..821d149151ef3 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
@@ -1252,3 +1252,36 @@ 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 connector in @state.
+ */
+void intel_dp_mst_verify_state(struct intel_atomic_state *state)
+{
+	struct drm_connector *_connector;
+	struct drm_connector_state *conn_state;
+	u32 encoder_mask = 0;
+	int i;
+
+	for_each_new_connector_in_state(&state->base, _connector, conn_state, i) {
+		struct intel_connector *connector = to_intel_connector(_connector);
+		struct intel_encoder *encoder;
+
+		if (!connector->mst_port ||
+		    !intel_connector_needs_modeset(state, &connector->base))
+			continue;
+
+		encoder = &dp_to_dig_port(connector->mst_port)->base;
+		if (encoder_mask & drm_encoder_index(&encoder->base))
+			continue;
+
+		encoder_mask |= drm_encoder_index(&encoder->base);
+
+		drm_dp_mst_verify_payload_state(&state->base,
+						&connector->mst_port->mst_mgr,
+						intel_dp_is_connected(connector->mst_port));
+	}
+}
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.h b/drivers/gpu/drm/i915/display/intel_dp_mst.h
index 0cd05a9a78a25..7f77e471ddfc3 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_mst.h
+++ b/drivers/gpu/drm/i915/display/intel_dp_mst.h
@@ -20,5 +20,6 @@ bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
 bool intel_dp_mst_source_support(struct intel_dp *intel_dp);
 int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
 					     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


  parent reply	other threads:[~2023-01-25 11:49 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 11:48 [Intel-gfx] [PATCH 0/9] drm/i915/dp_mst: Fix MST payload removal during output disabling Imre Deak
2023-01-25 11:48 ` [PATCH 1/9] drm/i915/dp_mst: Add the MST topology state for modesetted CRTCs Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-26  9:13   ` [PATCH v2 " Imre Deak
2023-01-26  9:13     ` [Intel-gfx] " Imre Deak
2023-01-26 18:34     ` Ville Syrjälä
2023-01-26 20:29     ` Lyude Paul
2023-01-26 20:29       ` Lyude Paul
2023-01-25 11:48 ` [PATCH 2/9] drm/display/dp_mst: Handle old/new payload states in drm_dp_remove_payload() Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-25 11:48   ` Imre Deak
2023-01-26 17:37   ` Ville Syrjälä
2023-01-26 17:37     ` [Intel-gfx] " Ville Syrjälä
2023-01-26 17:37     ` Ville Syrjälä
2023-01-26 18:33     ` [Intel-gfx] " Ville Syrjälä
2023-01-26 18:33       ` Ville Syrjälä
2023-01-26 20:21       ` Imre Deak
2023-01-26 20:21         ` Imre Deak
2023-01-25 11:48 ` [PATCH 3/9] drm/display/dp_mst: Add drm_atomic_get_old_mst_topology_state() Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-25 11:48   ` Imre Deak
2023-01-26 18:36   ` Ville Syrjälä
2023-01-26 18:36     ` [Intel-gfx] " Ville Syrjälä
2023-01-26 18:36     ` Ville Syrjälä
2023-01-26 20:28     ` Imre Deak
2023-01-26 20:28       ` [Intel-gfx] " Imre Deak
2023-01-26 20:28       ` Imre Deak
2023-01-25 11:48 ` [PATCH 4/9] drm/i915/dp_mst: Fix payload removal during output disabling Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-26 18:38   ` Ville Syrjälä
2023-01-26 20:48     ` Imre Deak
2023-01-25 11:48 ` [PATCH 5/9] drm/display/dp_mst: Fix the payload VCPI check in drm_dp_mst_dump_topology() Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-27 19:42   ` Ville Syrjälä
2023-01-27 19:42     ` [Intel-gfx] " Ville Syrjälä
2023-01-27 19:55     ` Imre Deak
2023-01-27 19:55       ` [Intel-gfx] " Imre Deak
2023-01-25 11:48 ` [Intel-gfx] [PATCH 6/9] drm/i915: Factor out helpers for modesetting CRTCs and connectors Imre Deak
2023-01-25 11:48 ` [Intel-gfx] [PATCH 7/9] drm/i915/dp_mst: Move getting the MST topology state earlier to connector check Imre Deak
2023-01-25 11:48 ` [PATCH 8/9] drm/display/dp_mst: Add a helper to verify the MST payload state Imre Deak
2023-01-25 11:48   ` [Intel-gfx] " Imre Deak
2023-01-25 11:48 ` Imre Deak [this message]
2023-01-25 23:39 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/dp_mst: Fix MST payload removal during output disabling Patchwork
2023-01-26 10:04 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp_mst: Fix MST payload removal during output disabling (rev2) Patchwork
2023-01-26 10:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-01-26 16:55 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230125114852.748337-10-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.