[Intel-gfx] [PATCH 01/19] drm/i915/dp: Sanitize DPCD revision check in intel_dp_get_dsc_sink_cap()

Imre Deak imre.deak at intel.com
Tue Oct 10 09:20:40 UTC 2023


On Mon, Oct 09, 2023 at 05:48:04PM +0300, Ville Syrjälä wrote:
> On Fri, Oct 06, 2023 at 04:37:09PM +0300, Imre Deak wrote:
> > Check only the eDP or the DP specific DPCD revision depending on the
> > sink type. Pass the corresponding revision to the function, which allows
> > getting the DSC caps of a branch device (in an MST topology, which has
> > its own DPCD and so DPCD revision).
> > 
> > Signed-off-by: Imre Deak <imre.deak at intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_dp.c | 12 +++++++-----
> >  1 file changed, 7 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> > index 0ef7cb8134b66..1bd11f9e308c1 100644
> > --- a/drivers/gpu/drm/i915/display/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> > @@ -3467,7 +3467,7 @@ bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp)
> >  	return dprx & DP_VSC_SDP_EXT_FOR_COLORIMETRY_SUPPORTED;
> >  }
> >  
> > -static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
> > +static void intel_dp_get_dsc_sink_cap(u8 dpcd_rev, struct intel_dp *intel_dp)
> >  {
> >  	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
> >  
> > @@ -3481,8 +3481,8 @@ static void intel_dp_get_dsc_sink_cap(struct intel_dp *intel_dp)
> >  	intel_dp->fec_capable = 0;
> >  
> >  	/* Cache the DSC DPCD if eDP or DP rev >= 1.4 */
> > -	if (intel_dp->dpcd[DP_DPCD_REV] >= 0x14 ||
> > -	    intel_dp->edp_dpcd[0] >= DP_EDP_14) {
> > +	if ((intel_dp_is_edp(intel_dp) && dpcd_rev >= DP_EDP_14) ||
> > +	    (!intel_dp_is_edp(intel_dp) && dpcd_rev >= 0x14)) {
> 
> This is horribly confusing. DPCD_REV and EDP_DPCD_REV are not the same
> thing.

Ok, I can add separate functions for DP and eDP each checking its
relevant DPCD revision.

> >  		if (drm_dp_dpcd_read(&intel_dp->aux, DP_DSC_SUPPORT,
> >  				     intel_dp->dsc_dpcd,
> >  				     sizeof(intel_dp->dsc_dpcd)) < 0)
> > @@ -3674,7 +3674,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
> >  
> >  	/* Read the eDP DSC DPCD registers */
> >  	if (HAS_DSC(dev_priv))
> > -		intel_dp_get_dsc_sink_cap(intel_dp);
> > +		intel_dp_get_dsc_sink_cap(intel_dp->edp_dpcd[0],
> > +					  intel_dp);
> >  
> >  	/*
> >  	 * If needed, program our source OUI so we can make various Intel-specific AUX services
> > @@ -5384,7 +5385,8 @@ intel_dp_detect(struct drm_connector *connector,
> >  
> >  	/* Read DP Sink DSC Cap DPCD regs for DP v1.4 */
> >  	if (HAS_DSC(dev_priv))
> > -		intel_dp_get_dsc_sink_cap(intel_dp);
> > +		intel_dp_get_dsc_sink_cap(intel_dp->dpcd[DP_DPCD_REV],
> > +					  intel_dp);
> >  
> >  	intel_dp_configure_mst(intel_dp);
> >  
> > -- 
> > 2.39.2
> 
> -- 
> Ville Syrjälä
> Intel


More information about the Intel-gfx mailing list