From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/display: hdmi: Only allow BPC values of 8, 10, 12 and 16
Date: Mon, 08 Jun 2026 13:50:45 +0200 [thread overview]
Message-ID: <E83PzEAaStOECMxPCtZE3A@collabora.com> (raw)
In-Reply-To: <ySc94bL0TleBGnFIdX95hg@collabora.com>
On Monday, 8 June 2026 13:46:27 Central European Summer Time Nicolas Frattaroli wrote:
> On Monday, 8 June 2026 13:30:22 Central European Summer Time sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> >
> > Pre-existing issues:
> > - [High] The function `sink_supports_format_bpc` explicitly permits 16 BPC for RGB444 and YCBCR444 formats without verifying if the sink's EDID actually supports 48-bit deep color.
> > --
> >
> > commit 767fa3cc832e8b93f697ad91bcc66e5b3b1ed85d
> > Author: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
> >
> > drm/display: hdmi: Only allow BPC values of 8, 10, 12 and 16
> >
> > 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.
> >
> > > diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > > index 4867edbf2622b..b06499dbfe8b3 100644
> > > --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > > +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > > @@ -419,6 +419,16 @@ sink_supports_format_bpc(const struct drm_connector *connector,
> > > return false;
> > > }
> > >
> > > + switch (bpc) {
> > > + case 8:
> > > + case 10:
> > > + case 12:
> > > + case 16:
> >
> > [Severity: High]
> > This is a pre-existing issue, but does explicitly allowing 16 BPC here
> > expose a missing validation check for 48-bit deep color further down in
> > sink_supports_format_bpc()?
> >
> > When checking DRM_OUTPUT_COLOR_FORMAT_RGB444 and
> > DRM_OUTPUT_COLOR_FORMAT_YCBCR444, the code validates 10 BPC and 12 BPC
> > against the EDID flags, but completely omits checking 16 BPC against
> > DRM_EDID_HDMI_DC_48:
> >
> > drivers/gpu/drm/display/drm_hdmi_state_helper.c:sink_supports_format_bpc() {
> > ...
> > case DRM_OUTPUT_COLOR_FORMAT_RGB444:
> > ...
> > if (bpc == 10 && !(info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_30)) {
> > drm_dbg_kms(dev, "10 BPC but sink doesn't support Deep Color 30.\n");
> > return false;
> > }
> >
> > if (bpc == 12 && !(info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_36)) {
> > drm_dbg_kms(dev, "12 BPC but sink doesn't support Deep Color 36.\n");
> > return false;
> > }
> >
> > drm_dbg_kms(dev, "RGB format supported in that configuration.\n");
> > return true;
> > ...
> > }
> >
> > If the TMDS clock limit permits it, the driver might incorrectly conclude
> > that the sink supports 16 BPC and program the hardware accordingly, which
> > could result in a black screen if the monitor doesn't actually support
> > 48-bit deep color.
> >
> > Should a check for (info->edid_hdmi_rgb444_dc_modes & DRM_EDID_HDMI_DC_48)
> > be added for the RGB444 and YCBCR444 cases?
>
> Finally, we have automated the ultimate Linux kernel review response:
> "while you're at it, can you fix everything else wrong in this code?"
>
> (No, this does not expose any pre-existing issue; the validation is
> more restrictive than it was before. That it's still not restrictive
> enough in all cases does not introduce a new problem.)
Correction: there isn't even any problem here. DC48 is the highest
bpc, so the check is redundant anyway, which is likely also why it
was omitted.
Bad clanker! Bad bad bad!
>
> >
> > > + 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");
> >
> >
>
>
next prev parent reply other threads:[~2026-06-08 11:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 11:19 [PATCH 0/2] Make HDMI state helpers handle odd max bpc requests Nicolas Frattaroli
2026-06-08 11:19 ` [PATCH 1/2] drm/display: hdmi: Only allow BPC values of 8, 10, 12 and 16 Nicolas Frattaroli
2026-06-08 11:30 ` sashiko-bot
2026-06-08 11:46 ` Nicolas Frattaroli
2026-06-08 11:50 ` Nicolas Frattaroli [this message]
2026-06-08 11:19 ` [PATCH 2/2] drm/display: hdmi: Round odd max_bpc down to even numbers Nicolas Frattaroli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E83PzEAaStOECMxPCtZE3A@collabora.com \
--to=nicolas.frattaroli@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.