[PATCH v3 1/2] drm/display: hdmi: Only allow BPC values of 8, 10, 12 and 16

From: Nicolas Frattaroli

Date: Fri Jun 19 2026 - 10:38:30 EST


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 <nicolas.frattaroli@xxxxxxxxxxxxx>
---
drivers/gpu/drm/display/drm_hdmi_state_helper.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index ce17eeefc2da..6d02cf85f7c9 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -405,6 +405,17 @@ sink_supports_format_bpc(const struct drm_connector *connector,
struct drm_device *dev = connector->dev;
u8 vic = drm_match_cea_mode(mode);

+ switch (bpc) {
+ case 8:
+ case 10:
+ case 12:
+ case 16:
+ break;
+ default:
+ drm_dbg_kms(dev, "bpc of %u is not supported by standard\n", bpc);
+ return false;
+ }
+
/*
* CTA-861-F, section 5.4 - Color Coding & Quantization states
* that the bpc must be 8, 10, 12 or 16 except for the default

--
2.54.0