All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	jani.nikula@intel.com, "Arun R Murthy" <arun.r.murthy@intel.com>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [PATCH v2 4/6] drm/i915/mst: use the MST mode detected previously
Date: Tue, 13 Feb 2024 13:30:59 +0200	[thread overview]
Message-ID: <4fb849117a31940a3fbc26287c09ee3928e91991.1707823736.git.jani.nikula@intel.com> (raw)
In-Reply-To: <cover.1707823736.git.jani.nikula@intel.com>

Drop the duplicate read of DP_MSTM_CAP DPCD register, and the duplicate
logic for choosing MST mode, and store the chosen mode in struct
intel_dp. Rename intel_dp_configure_mst() to intel_dp_mst_configure()
while at it.

Cc: Arun R Murthy <arun.r.murthy@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 .../drm/i915/display/intel_display_types.h    |  1 +
 drivers/gpu/drm/i915/display/intel_dp.c       | 23 ++++++++-----------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 01eb6e4e6049..4a8440a3a812 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1780,6 +1780,7 @@ struct intel_dp {
 
 	bool is_mst;
 	int active_mst_links;
+	enum drm_dp_mst_mode mst_detect;
 
 	/* connector directly attached - won't be use for modeset in mst world */
 	struct intel_connector *attached_connector;
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 007cb2a04e38..72e91322e310 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4039,11 +4039,10 @@ intel_dp_mst_detect(struct intel_dp *intel_dp)
 	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
 	struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
 	enum drm_dp_mst_mode sink_mst_mode;
-	enum drm_dp_mst_mode mst_detect;
 
 	sink_mst_mode = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd);
 
-	mst_detect = intel_dp_mst_mode_choose(intel_dp, sink_mst_mode);
+	intel_dp->mst_detect = intel_dp_mst_mode_choose(intel_dp, sink_mst_mode);
 
 	drm_dbg_kms(&i915->drm,
 		    "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: %s -> enable: %s\n",
@@ -4051,25 +4050,23 @@ intel_dp_mst_detect(struct intel_dp *intel_dp)
 		    str_yes_no(intel_dp_mst_source_support(intel_dp)),
 		    intel_dp_mst_mode_str(sink_mst_mode),
 		    str_yes_no(i915->display.params.enable_dp_mst),
-		    intel_dp_mst_mode_str(mst_detect));
+		    intel_dp_mst_mode_str(intel_dp->mst_detect));
 
-	return mst_detect != DRM_DP_SST;
+	return intel_dp->mst_detect != DRM_DP_SST;
 }
 
 static void
-intel_dp_configure_mst(struct intel_dp *intel_dp)
+intel_dp_mst_configure(struct intel_dp *intel_dp)
 {
-	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
-	bool sink_can_mst = drm_dp_read_mst_cap(&intel_dp->aux, intel_dp->dpcd) == DRM_DP_MST;
-
 	if (!intel_dp_mst_source_support(intel_dp))
 		return;
 
-	intel_dp->is_mst = sink_can_mst &&
-		i915->display.params.enable_dp_mst;
+	intel_dp->is_mst = intel_dp->mst_detect != DRM_DP_SST;
+
+	drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr, intel_dp->is_mst);
 
-	drm_dp_mst_topology_mgr_set_mst(&intel_dp->mst_mgr,
-					intel_dp->is_mst);
+	/* Avoid stale info on the next detect cycle. */
+	intel_dp->mst_detect = DRM_DP_SST;
 }
 
 static bool
@@ -5739,7 +5736,7 @@ intel_dp_detect(struct drm_connector *connector,
 
 	intel_dp_detect_dsc_caps(intel_dp, intel_connector);
 
-	intel_dp_configure_mst(intel_dp);
+	intel_dp_mst_configure(intel_dp);
 
 	/*
 	 * TODO: Reset link params when switching to MST mode, until MST
-- 
2.39.2


  parent reply	other threads:[~2024-02-13 11:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 11:30 [PATCH v2 0/6] drm/i915/mst: enable MST mode for 128b/132b single-stream sideband Jani Nikula
2024-02-13 11:30 ` [PATCH v2 1/6] drm/mst: read sideband messaging cap Jani Nikula
2024-02-13 12:56   ` Murthy, Arun R
2024-02-13 13:42     ` Jani Nikula
2024-02-14 18:14   ` Ville Syrjälä
2024-02-13 11:30 ` [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect Jani Nikula
2024-02-14 18:18   ` Ville Syrjälä
2024-02-15 11:46     ` Jani Nikula
2024-02-15 15:16       ` Ville Syrjälä
2024-02-13 11:30 ` [PATCH v2 3/6] drm/i915/mst: abstract choosing the MST mode to use Jani Nikula
2024-02-14 18:18   ` Ville Syrjälä
2024-02-13 11:30 ` Jani Nikula [this message]
2024-02-14 18:34   ` [PATCH v2 4/6] drm/i915/mst: use the MST mode detected previously Ville Syrjälä
2024-02-14 18:41     ` Jani Nikula
2024-02-13 11:31 ` [PATCH v2 5/6] drm/i915/mst: add intel_dp_mst_disconnect() Jani Nikula
2024-02-14 18:34   ` Ville Syrjälä
2024-02-13 11:31 ` [PATCH v2 6/6] drm/i915/mst: enable MST mode for 128b/132b single-stream sideband Jani Nikula
2024-02-13 12:28 ` ✓ CI.Patch_applied: success for " Patchwork
2024-02-13 12:28 ` ✗ CI.checkpatch: warning " Patchwork
2024-02-13 12:29 ` ✓ CI.KUnit: success " Patchwork
2024-02-13 12:39 ` ✓ CI.Build: " Patchwork
2024-02-13 12:40 ` ✓ CI.Hooks: " Patchwork
2024-02-13 12:41 ` ✗ CI.checksparse: warning " Patchwork
2024-02-13 13:05 ` ✓ CI.BAT: success " Patchwork
2024-02-13 13:53 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/mst: enable MST mode for 128b/132b single-stream sideband (rev3) Patchwork
2024-02-13 13:53 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-02-13 14:07 ` ✓ Fi.CI.BAT: success " Patchwork
2024-02-13 15:40 ` ✓ 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=4fb849117a31940a3fbc26287c09ee3928e91991.1707823736.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=arun.r.murthy@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /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.