Re: [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-15 Thread Ville Syrjälä
On Thu, Feb 15, 2024 at 01:46:48PM +0200, Jani Nikula wrote:
> On Wed, 14 Feb 2024, Ville Syrjälä  wrote:
> > On Tue, Feb 13, 2024 at 01:30:57PM +0200, Jani Nikula wrote:
> >> Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
> >> detect debug logging there. Debug log the sink's MST capability,
> >> including single-stream sideband messaging support, and the decision
> >> whether to enable MST mode or not. Do this regardless of whether we're
> >> actually enabling MST or not.
> >> 
> >> Cc: Arun R Murthy 
> >> Cc: Ville Syrjälä 
> >> Signed-off-by: Jani Nikula 
> >> ---
> >>  drivers/gpu/drm/i915/display/intel_dp.c | 45 +
> >>  1 file changed, 31 insertions(+), 14 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
> >> b/drivers/gpu/drm/i915/display/intel_dp.c
> >> index a1c304f451bd..944f566525dd 100644
> >> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> >> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> >> @@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
> >>   intel_dp->downstream_ports) == 0;
> >>  }
> >>  
> >> +static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
> >> +{
> >> +  if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
> >> +  return "single-stream sideband messaging";
> >> +  else
> >> +  return str_yes_no(mst_mode == DRM_DP_MST);
> >
> > I wonder if this should also just say "sst"/"mst"/"sst sideband" etc.
> > Shrug.
> >
> > Reviewed-by: Ville Syrjälä 
> 
> I realize there's an issue here.
> 
> intel_dp_detect_dpcd() bails out early for !drm_dp_is_branch(), before
> the intel_dp_can_mst() call. (Renamed intel_dp_mst_detect() here.)
> 
> We'll still happily call intel_dp_configure_mst() later also for
> !branch.
> 
> We'll need to call intel_dp_mst_detect() earlier and/or somehow combine
> these together. I don't think branch devices need to support MST, but I
> think MST devices need to support branching. And single-stream sideband
> support does not mean branching.
> 
> The intention of this patch was to improve MST debug logging, but the
> end result is that it reduces it! Auch.
> 
> I wonder if we should branch (eh) the detect earlier for eDP, SST and
> MST/branch paths. Just to make it easier for our poor brains to follow.

Hmm. The sink count check is another case as well. If the device
has a local sink, or somehting connected to its DFP(s) it should
declare sink count >= 1.

-- 
Ville Syrjälä
Intel


Re: [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-15 Thread Jani Nikula
On Wed, 14 Feb 2024, Ville Syrjälä  wrote:
> On Tue, Feb 13, 2024 at 01:30:57PM +0200, Jani Nikula wrote:
>> Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
>> detect debug logging there. Debug log the sink's MST capability,
>> including single-stream sideband messaging support, and the decision
>> whether to enable MST mode or not. Do this regardless of whether we're
>> actually enabling MST or not.
>> 
>> Cc: Arun R Murthy 
>> Cc: Ville Syrjälä 
>> Signed-off-by: Jani Nikula 
>> ---
>>  drivers/gpu/drm/i915/display/intel_dp.c | 45 +
>>  1 file changed, 31 insertions(+), 14 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
>> b/drivers/gpu/drm/i915/display/intel_dp.c
>> index a1c304f451bd..944f566525dd 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dp.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
>> @@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>> intel_dp->downstream_ports) == 0;
>>  }
>>  
>> +static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
>> +{
>> +if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
>> +return "single-stream sideband messaging";
>> +else
>> +return str_yes_no(mst_mode == DRM_DP_MST);
>
> I wonder if this should also just say "sst"/"mst"/"sst sideband" etc.
> Shrug.
>
> Reviewed-by: Ville Syrjälä 

I realize there's an issue here.

intel_dp_detect_dpcd() bails out early for !drm_dp_is_branch(), before
the intel_dp_can_mst() call. (Renamed intel_dp_mst_detect() here.)

We'll still happily call intel_dp_configure_mst() later also for
!branch.

We'll need to call intel_dp_mst_detect() earlier and/or somehow combine
these together. I don't think branch devices need to support MST, but I
think MST devices need to support branching. And single-stream sideband
support does not mean branching.

The intention of this patch was to improve MST debug logging, but the
end result is that it reduces it! Auch.

I wonder if we should branch (eh) the detect earlier for eDP, SST and
MST/branch paths. Just to make it easier for our poor brains to follow.


BR,
Jani.


>
>> +}
>> +
>>  static bool
>> -intel_dp_can_mst(struct intel_dp *intel_dp)
>> +intel_dp_mst_detect(struct intel_dp *intel_dp)
>>  {
>>  struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>> +struct intel_encoder *encoder = _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(_dp->aux, intel_dp->dpcd);
>> +
>> +if (i915->display.params.enable_dp_mst &&
>> +intel_dp_mst_source_support(intel_dp) &&
>> +sink_mst_mode == DRM_DP_MST)
>> +mst_detect = DRM_DP_MST;
>> +else
>> +mst_detect = DRM_DP_SST;
>>  
>> -return i915->display.params.enable_dp_mst &&
>> -intel_dp_mst_source_support(intel_dp) &&
>> -drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) == 
>> DRM_DP_MST;
>> +drm_dbg_kms(>drm,
>> +"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
>> %s -> enable: %s\n",
>> +encoder->base.base.id, encoder->base.name,
>> +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));
>> +
>> +return mst_detect != DRM_DP_SST;
>>  }
>>  
>>  static void
>>  intel_dp_configure_mst(struct intel_dp *intel_dp)
>>  {
>>  struct drm_i915_private *i915 = dp_to_i915(intel_dp);
>> -struct intel_encoder *encoder =
>> -_to_dig_port(intel_dp)->base;
>>  bool sink_can_mst = drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) 
>> == DRM_DP_MST;
>>  
>> -drm_dbg_kms(>drm,
>> -"[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
>> %s\n",
>> -encoder->base.base.id, encoder->base.name,
>> -str_yes_no(intel_dp_mst_source_support(intel_dp)),
>> -str_yes_no(sink_can_mst),
>> -str_yes_no(i915->display.params.enable_dp_mst));
>> -
>>  if (!intel_dp_mst_source_support(intel_dp))
>>  return;
>>  
>> @@ -5390,7 +5407,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
>>  connector_status_connected : connector_status_disconnected;
>>  }
>>  
>> -if (intel_dp_can_mst(intel_dp))
>> +if (intel_dp_mst_detect(intel_dp))
>>  return connector_status_connected;
>>  
>>  /* If no HPD, poke DDC gently */
>> -- 
>> 2.39.2

-- 
Jani Nikula, Intel


Re: [PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-14 Thread Ville Syrjälä
On Tue, Feb 13, 2024 at 01:30:57PM +0200, Jani Nikula wrote:
> Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
> detect debug logging there. Debug log the sink's MST capability,
> including single-stream sideband messaging support, and the decision
> whether to enable MST mode or not. Do this regardless of whether we're
> actually enabling MST or not.
> 
> Cc: Arun R Murthy 
> Cc: Ville Syrjälä 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/display/intel_dp.c | 45 +
>  1 file changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
> b/drivers/gpu/drm/i915/display/intel_dp.c
> index a1c304f451bd..944f566525dd 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
>  intel_dp->downstream_ports) == 0;
>  }
>  
> +static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
> +{
> + if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
> + return "single-stream sideband messaging";
> + else
> + return str_yes_no(mst_mode == DRM_DP_MST);

I wonder if this should also just say "sst"/"mst"/"sst sideband" etc.
Shrug.

Reviewed-by: Ville Syrjälä 

> +}
> +
>  static bool
> -intel_dp_can_mst(struct intel_dp *intel_dp)
> +intel_dp_mst_detect(struct intel_dp *intel_dp)
>  {
>   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> + struct intel_encoder *encoder = _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(_dp->aux, intel_dp->dpcd);
> +
> + if (i915->display.params.enable_dp_mst &&
> + intel_dp_mst_source_support(intel_dp) &&
> + sink_mst_mode == DRM_DP_MST)
> + mst_detect = DRM_DP_MST;
> + else
> + mst_detect = DRM_DP_SST;
>  
> - return i915->display.params.enable_dp_mst &&
> - intel_dp_mst_source_support(intel_dp) &&
> - drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) == 
> DRM_DP_MST;
> + drm_dbg_kms(>drm,
> + "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
> %s -> enable: %s\n",
> + encoder->base.base.id, encoder->base.name,
> + 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));
> +
> + return mst_detect != DRM_DP_SST;
>  }
>  
>  static void
>  intel_dp_configure_mst(struct intel_dp *intel_dp)
>  {
>   struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> - struct intel_encoder *encoder =
> - _to_dig_port(intel_dp)->base;
>   bool sink_can_mst = drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) 
> == DRM_DP_MST;
>  
> - drm_dbg_kms(>drm,
> - "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
> %s\n",
> - encoder->base.base.id, encoder->base.name,
> - str_yes_no(intel_dp_mst_source_support(intel_dp)),
> - str_yes_no(sink_can_mst),
> - str_yes_no(i915->display.params.enable_dp_mst));
> -
>   if (!intel_dp_mst_source_support(intel_dp))
>   return;
>  
> @@ -5390,7 +5407,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
>   connector_status_connected : connector_status_disconnected;
>   }
>  
> - if (intel_dp_can_mst(intel_dp))
> + if (intel_dp_mst_detect(intel_dp))
>   return connector_status_connected;
>  
>   /* If no HPD, poke DDC gently */
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel


[PATCH v2 2/6] drm/i915/mst: improve debug logging of DP MST mode detect

2024-02-13 Thread Jani Nikula
Rename intel_dp_can_mst() to intel_dp_mst_detect(), and move all DP MST
detect debug logging there. Debug log the sink's MST capability,
including single-stream sideband messaging support, and the decision
whether to enable MST mode or not. Do this regardless of whether we're
actually enabling MST or not.

Cc: Arun R Murthy 
Cc: Ville Syrjälä 
Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/display/intel_dp.c | 45 +
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index a1c304f451bd..944f566525dd 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -4007,31 +4007,48 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
   intel_dp->downstream_ports) == 0;
 }
 
+static const char *intel_dp_mst_mode_str(enum drm_dp_mst_mode mst_mode)
+{
+   if (mst_mode == DRM_DP_SST_SIDEBAND_MSG)
+   return "single-stream sideband messaging";
+   else
+   return str_yes_no(mst_mode == DRM_DP_MST);
+}
+
 static bool
-intel_dp_can_mst(struct intel_dp *intel_dp)
+intel_dp_mst_detect(struct intel_dp *intel_dp)
 {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
+   struct intel_encoder *encoder = _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(_dp->aux, intel_dp->dpcd);
+
+   if (i915->display.params.enable_dp_mst &&
+   intel_dp_mst_source_support(intel_dp) &&
+   sink_mst_mode == DRM_DP_MST)
+   mst_detect = DRM_DP_MST;
+   else
+   mst_detect = DRM_DP_SST;
 
-   return i915->display.params.enable_dp_mst &&
-   intel_dp_mst_source_support(intel_dp) &&
-   drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) == 
DRM_DP_MST;
+   drm_dbg_kms(>drm,
+   "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
%s -> enable: %s\n",
+   encoder->base.base.id, encoder->base.name,
+   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));
+
+   return mst_detect != DRM_DP_SST;
 }
 
 static void
 intel_dp_configure_mst(struct intel_dp *intel_dp)
 {
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
-   struct intel_encoder *encoder =
-   _to_dig_port(intel_dp)->base;
bool sink_can_mst = drm_dp_read_mst_cap(_dp->aux, intel_dp->dpcd) 
== DRM_DP_MST;
 
-   drm_dbg_kms(>drm,
-   "[ENCODER:%d:%s] MST support: port: %s, sink: %s, modparam: 
%s\n",
-   encoder->base.base.id, encoder->base.name,
-   str_yes_no(intel_dp_mst_source_support(intel_dp)),
-   str_yes_no(sink_can_mst),
-   str_yes_no(i915->display.params.enable_dp_mst));
-
if (!intel_dp_mst_source_support(intel_dp))
return;
 
@@ -5390,7 +5407,7 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
connector_status_connected : connector_status_disconnected;
}
 
-   if (intel_dp_can_mst(intel_dp))
+   if (intel_dp_mst_detect(intel_dp))
return connector_status_connected;
 
/* If no HPD, poke DDC gently */
-- 
2.39.2