[PATCH RFC v3 2/8] drm: Move DSC capability reading helper out of i915

Jani Nikula jani.nikula at linux.intel.com
Mon Nov 16 04:03:30 PST 2026


On Mon, 12 Oct 2026, Kory Maincent <kory.maincent at bootlin.com> wrote:
> In preparation for adding generic DRM properties to report source and
> sink capabilities, move the DSC capability reading helper out of the
> i915 driver into the generic DRM helpers.

Independent of the goal of the series, I support moving helpers from
i915 to generic drm code.

It might even make sense to try to do that separately, to make forward
progress.

> No functional change intended.
>
> Signed-off-by: Kory Maincent <kory.maincent at bootlin.com>
> ---
> Change in v3:
> - New patch
> ---
>  drivers/gpu/drm/display/drm_dp_helper.c | 30 ++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/display/intel_dp.c | 28 ++++------------------------
>  include/drm/display/drm_dp_helper.h     |  2 ++
>  3 files changed, 36 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
> index 8ef096a0138e4..93cf43d166c6e 100644
> --- a/drivers/gpu/drm/display/drm_dp_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> @@ -5149,3 +5149,33 @@ int drm_dp_read_edp_sink_rates(struct drm_dp_aux *aux, u8 edp_dpcd_rev,
>  	return num_sink_rates;
>  }
>  EXPORT_SYMBOL_GPL(drm_dp_read_edp_sink_rates);
> +
> +/**
> + * drm_dp_read_dsc_dpcd() - read the DSC capabilities from the DPCD
> + * @aux: DisplayPort AUX channel
> + * @dsc_dpcd: Buffer to store the DSC capabilities read from the DPCD
> + *
> + * Attempts to read the sink DSC capabilities from the DPCD of @aux.
> + *
> + * Returns: 0 on success or a negative error code on failure.
> + */
> +int drm_dp_read_dsc_dpcd(struct drm_dp_aux *aux,
> +			 u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])

Nitpick, I think all or nearly all of the DSC functions here use the
drm_dp_dsc_ prefix, and so should this.

BR,
Jani.


> +{
> +	int ret;
> +
> +	ret = drm_dp_dpcd_read_data(aux, DP_DSC_SUPPORT, dsc_dpcd,
> +				    DP_DSC_RECEIVER_CAP_SIZE);
> +	if (ret) {
> +		drm_dbg_kms(aux->drm_dev,
> +			    "Could not read DSC DPCD register 0x%x Error: %pe\n",
> +			    DP_DSC_SUPPORT, ERR_PTR(ret));
> +		return ret;
> +	}
> +
> +	drm_dbg_kms(aux->drm_dev, "DSC DPCD: %*ph\n",
> +		    DP_DSC_RECEIVER_CAP_SIZE,
> +		    dsc_dpcd);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(drm_dp_read_dsc_dpcd);
> diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
> index da73ad11e9cac..830fe6eda17d7 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp.c
> @@ -4430,26 +4430,6 @@ static bool intel_dp_get_sst_split_sdp_status(u8 dprx)
>  	return dprx & DP_SST_SPLIT_SDP_CAP;
>  }
>  
> -static int intel_dp_read_dsc_dpcd(struct drm_dp_aux *aux,
> -				  u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
> -{
> -	int ret;
> -
> -	ret = drm_dp_dpcd_read_data(aux, DP_DSC_SUPPORT, dsc_dpcd,
> -				    DP_DSC_RECEIVER_CAP_SIZE);
> -	if (ret) {
> -		drm_dbg_kms(aux->drm_dev,
> -			    "Could not read DSC DPCD register 0x%x Error: %pe\n",
> -			    DP_DSC_SUPPORT, ERR_PTR(ret));
> -		return ret;
> -	}
> -
> -	drm_dbg_kms(aux->drm_dev, "DSC DPCD: %*ph\n",
> -		    DP_DSC_RECEIVER_CAP_SIZE,
> -		    dsc_dpcd);
> -	return 0;
> -}
> -
>  static void init_dsc_overall_throughput_limits(struct intel_connector *connector, bool is_branch)
>  {
>  	u8 branch_caps[DP_DSC_BRANCH_CAP_SIZE];
> @@ -4498,8 +4478,8 @@ void intel_dp_get_dsc_sink_cap(u8 dpcd_rev,
>  	if (dpcd_rev < DP_DPCD_REV_14)
>  		return;
>  
> -	if (intel_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
> -				   connector->dp.dsc_dpcd) < 0)
> +	if (drm_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
> +				 connector->dp.dsc_dpcd) < 0)
>  		return;
>  
>  	if (drm_dp_dpcd_readb(connector->dp.dsc_decompression_aux, DP_FEC_CAPABILITY,
> @@ -4530,8 +4510,8 @@ static void intel_edp_get_dsc_sink_cap(u8 edp_dpcd_rev, struct intel_connector *
>  	if (edp_dpcd_rev < DP_EDP_14)
>  		return;
>  
> -	if (intel_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
> -				   connector->dp.dsc_dpcd) < 0)
> +	if (drm_dp_read_dsc_dpcd(connector->dp.dsc_decompression_aux,
> +				 connector->dp.dsc_dpcd) < 0)
>  		return;
>  
>  	if (connector->dp.dsc_dpcd[0] & DP_DSC_DECOMPRESSION_IS_SUPPORTED)
> diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
> index d7f4c6f2ba4c7..7bc3b36f38b82 100644
> --- a/include/drm/display/drm_dp_helper.h
> +++ b/include/drm/display/drm_dp_helper.h
> @@ -215,6 +215,8 @@ drm_dp_is_branch(const u8 dpcd[DP_RECEIVER_CAP_SIZE])
>  }
>  
>  /* DP/eDP DSC support */
> +int drm_dp_read_dsc_dpcd(struct drm_dp_aux *aux,
> +			 u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]);
>  u8 drm_dp_dsc_sink_bpp_incr(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]);
>  u32 drm_dp_dsc_slice_count_to_mask(int slice_count);
>  u32 drm_dp_dsc_sink_slice_count_mask(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE],

-- 
Jani Nikula, Intel



More information about the Linux-mediatek mailing list