Skip to content

drm/connector: hdmi: Prefer YUV422 over dropping RGB to 8 bpc - #7682

Draft
popcornmix wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
popcornmix:hdmi-yuv422-deep-colour
Draft

popcornmix wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
popcornmix:hdmi-yuv422-deep-colour

Conversation

@popcornmix

Copy link
Copy Markdown
Collaborator

When userspace requests more than 8 bpc (e.g. Kodi sets max_bpc=12) and the mode only fits the TMDS limit with RGB at 8 bpc, the HDMI state helper picks 8-bit RGB. YUV422 at 12 bpc needs the same TMDS rate as RGB at 8 bpc, but it was never tried because RGB was tried at every bpc before YUV422.

This changes the order to:

  1. RGB from max_bpc down to 10 bpc
  2. YUV422 from max_bpc down to 8 bpc
  3. RGB at 8 bpc
  4. YUV420 (unchanged)

With max_bpc=8 the behaviour is unchanged. RGB at 10 bpc is still preferred over YUV422 at 12 bpc, matching drm_test_check_max_tmds_rate_bpc_fallback_ignore_yuv422.

Tested on Pi 5 with Kodi playing a 4K 59.94 Hz 10-bit HDR clip on a TV that supports YCbCr 4:2:2:

  • before: 3840x2160@59.94, RGB 8 bpc, 593.4 MHz
  • after: 3840x2160@59.94, YUV 4:2:2 12 bpc, 593.4 MHz; the AVI infoframe signals YCbCr 4:2:2

The HDMI state helper KUnit tests give the same 8 failures before and after this change. They fail on rpi-6.18.y because max_bpc now starts at 8, so those tests never request more than 8 bpc.

When more than 8 bpc is requested and RGB only fits the TMDS limit at
8 bpc (e.g. 4k60 at 594MHz), YUV422 at 12 bpc fits at the same TMDS
rate. Previously RGB was tried at every bpc before YUV422, so 8 bpc RGB
was always chosen and the extra depth was lost.

Try RGB down to 10 bpc, then YUV422, and only then RGB at 8 bpc. This
keeps the existing preference for RGB at 10 bpc over YUV422 at 12 bpc.

Signed-off-by: Dom Cobley <popcornmix@gmail.com>

@6by9 6by9 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should do what we want with as small a change to upstream code as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants