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;
+       }
+
        if (!info->is_hdmi &&
            (format != DRM_OUTPUT_COLOR_FORMAT_RGB444 || bpc != 8)) {
                drm_dbg_kms(dev, "DVI Monitors require an RGB output at 8 
bpc\n");

-- 
2.54.0

Reply via email to