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

Cristian Ciocaltea cristian.ciocaltea at collabora.com
Thu Apr 10 10:08:35 UTC 2025


On 4/9/25 6:09 PM, Maxime Ripard wrote:
> 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

Sure, will do.

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



More information about the dri-devel mailing list