[PATCH v3 07/15] drm/connector: hdmi: Use YUV420 output format as an RGB fallback

Maxime Ripard mripard at kernel.org
Wed Apr 9 15:09:15 UTC 2025


On Wed, Mar 26, 2025 at 12:19:56PM +0200, Cristian Ciocaltea wrote:
> Try to make use of YUV420 when computing the best output format and
> RGB cannot be supported for any of the available color depths.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea at collabora.com>
> ---
>  drivers/gpu/drm/display/drm_hdmi_state_helper.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index 6de0abb15ecb36fd4eb98725e2a3835e5e0db134..3859600c6af4a79f30858adfc9f9a710dfe561a5 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -650,7 +650,17 @@ hdmi_compute_config(const struct drm_connector *connector,
>  
>  	ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
>  				      HDMI_COLORSPACE_RGB);
> +	if (!ret)
> +		return 0;
>  
> +	if (!connector->ycbcr_420_allowed) {
> +		drm_dbg_kms(connector->dev,
> +			    "YUV420 output format not allowed for connector.\n");
> +		return -EINVAL;
> +	}
> +
> +	ret = hdmi_compute_format_bpc(connector, conn_state, mode, max_bpc,
> +				      HDMI_COLORSPACE_YUV420);
>  	return ret;

I think I'd prefer to log a debug message there and return 0 if it
succeeds, something like

ret = hdmi_compute_format_bpc(..)
if (ret) {
   drm_dbg("YUV420 doesn't work").
   return ret;
}

return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20250409/4fdc2194/attachment.sig>


More information about the dri-devel mailing list