On Mon, Jun 08, 2026 at 01:19:07PM +0200, Nicolas Frattaroli wrote:
> As per the comment in sink_supports_format_bpc(), CTA-861-F defines that
> only bits-per-channel values of 8, 10, 12 and 16 are allowed for HDMI.
> Allowing more than this has surprising consequences for the atomic check
> phase. The HDMI state helpers may accidentally conclude that a sink
> supports 11bpc if a caller asks for it.
> 
> Fix this by exiting early if the bpc value doesn't match one of those
> given in the standard.
> 
> Fixes: 26ff1c38fc29 ("drm/connector: hdmi: Compute bpc and format 
> automatically")
> Signed-off-by: Nicolas Frattaroli <[email protected]>
> ---
>  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 a331ebdd65af..8303475ec021 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -420,6 +420,16 @@ sink_supports_format_bpc(const struct drm_connector 
> *connector,
>               return false;
>       }
>  
> +     switch (bpc) {
> +     case 8:
> +     case 10:
> +     case 12:
> +     case 16:
> +             break;
> +     default:
> +             return false;
> +     }
> +

That might be slightly personal, but I think if (bpc < 8 || bpc > 16 ||
bpc % 2) is more readable

With that fixed
Reviewed-by: Maxime Ripard <[email protected]>

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to