On Fri, May 22, 2026 at 02:32:02PM +0200, Nicolas Frattaroli wrote:
> In anticipation of userspace being able to explicitly select supported
> sink formats, add handling of the YCBCR444 sink format. The AUTO path
> does not choose this format, but with explicit format selection added to
> the driver, it becomes a possibility.
> 
> Check for YCBCR444 support on the sink in sink_bpc_possible, and on the
> source and sink in sink_format_valid.
> 
> Acked-by: Daniel Stone <[email protected]>
> Signed-off-by: Nicolas Frattaroli <[email protected]>
> ---
>  drivers/gpu/drm/i915/display/intel_hdmi.c | 32 
> +++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c 
> b/drivers/gpu/drm/i915/display/intel_hdmi.c
> index 9076c2b176ec..97cb321e6568 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c
> @@ -1966,6 +1966,8 @@ static bool intel_hdmi_sink_bpc_possible(struct 
> drm_connector *_connector,
>  
>               if (sink_format == INTEL_OUTPUT_FORMAT_YCBCR420)
>                       return hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_36;
> +             else if (sink_format == INTEL_OUTPUT_FORMAT_YCBCR444)
> +                     return info->edid_hdmi_ycbcr444_dc_modes & 
> DRM_EDID_HDMI_DC_36;
>               else
>                       return info->edid_hdmi_rgb444_dc_modes & 
> DRM_EDID_HDMI_DC_36;
>       case 10:
> @@ -1974,6 +1976,8 @@ static bool intel_hdmi_sink_bpc_possible(struct 
> drm_connector *_connector,
>  
>               if (sink_format == INTEL_OUTPUT_FORMAT_YCBCR420)
>                       return hdmi->y420_dc_modes & DRM_EDID_YCBCR420_DC_30;
> +             else if (sink_format == INTEL_OUTPUT_FORMAT_YCBCR444)
> +                     return info->edid_hdmi_ycbcr444_dc_modes & 
> DRM_EDID_HDMI_DC_30;
>               else
>                       return info->edid_hdmi_rgb444_dc_modes & 
> DRM_EDID_HDMI_DC_30;
>       case 8:
> @@ -2021,6 +2025,27 @@ intel_hdmi_mode_clock_valid(struct drm_connector 
> *_connector, int clock,
>       return status;
>  }
>  
> +/**
> + * intel_hdmi_can_ycbcr444 - Check whether connector can output YCbCr444
> + * @connector: pointer to &struct intel_connector to check
> + *
> + * Checks whether the hardware that backs @connector is capable of outputting
> + * YCbCr444 video over HDMI. Does not check whether currently connected sink 
> is
> + * capable of receiving it.
> + *
> + * Returns: %true if source supports outputting YCbCr444, %false otherwise.
> + */

We don't need kernel docs for internal stuff.

> +static bool
> +intel_hdmi_can_ycbcr444(struct intel_connector *connector)
> +{
> +     const struct intel_display *display = to_intel_display(connector);
> +
> +     if (HAS_GMCH(display))
> +             return true;

Exactly the wrong way around.

> +
> +     return false;
> +}
> +
>  static enum drm_mode_status
>  intel_hdmi_sink_format_valid(struct intel_connector *connector,
>                            const struct drm_display_mode *mode,
> @@ -2038,6 +2063,13 @@ intel_hdmi_sink_format_valid(struct intel_connector 
> *connector,
>  
>               return MODE_OK;

I would put the 444 stuff here between 420 and RGB. Then we logically go
from YCbCr420 -> YCbCr444 -> RGB when reading the code.

>       case INTEL_OUTPUT_FORMAT_RGB:
> +             return MODE_OK;
> +     case INTEL_OUTPUT_FORMAT_YCBCR444:
> +             if (!intel_hdmi_can_ycbcr444(connector))
> +                     return MODE_BAD;

We're missing the has_hdmi_sink check as well.

> +             if (!(info->color_formats & 
> BIT(DRM_OUTPUT_COLOR_FORMAT_YCBCR444)))
> +                     return MODE_BAD;
> +
>               return MODE_OK;
>       default:
>               MISSING_CASE(sink_format);
> 
> -- 
> 2.54.0

-- 
Ville Syrjälä
Intel

Reply via email to