Skip to content

Additional YUV420 10bit fmts #6959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025

Conversation

6by9
Copy link
Contributor

@6by9 6by9 commented Jul 15, 2025

Backport of Robert Mader's patch that is on drm-misc-next adding the format definitions, and then add that support to vc4.

@cillian64

libdrm updates at https://gitlab.freedesktop.org/6by9/libdrm/-/tree/add_formats?ref_type=heads (I'll create a PR for that once I've added support for the other test patterns).

rmader and others added 2 commits July 15, 2025 12:31
This adds FOURCCs for 3-plane 10/12/16bit YCbCr formats used by software
decoders like ffmpeg, dav1d and libvpx. The intended use-case is buffer
sharing between decoders and GPUs by allocating buffers with e.g. udmabuf
or dma-heaps, avoiding unnecessary copies and format conversions in
various scenarios.

Unlike formats typically used by hardware decoders the 10/12bit formats
use a LSB alignment. In order to allow fast implementations in GL
and Vulkan the padding must contain only zeros, so the float
representation can be calculated by multiplying with 2^6=64 or 2^4=16
respectively.

MRs or branches for Mesa, Vulkan, Gstreamer, Weston and Mutter can be found at:
 - https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34303
 - https://github.com/rmader/Vulkan-Docs/commits/ycbcr-16bit-lsb-formats/
 - https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8540
 - https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1753
 - https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4348

The naming scheme follows the 'P' and 'Q' formats. The 'S' stands for
'software' and was selected in order to make remembering easy.

The 'Sx16' formats could as well be 'Qx16'. We stick with 'S' as 16bit software
decoders are likely much more common than hardware ones for the foreseeable
future. Note that these formats already have Vulkan equivalents:
 - VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM
 - VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM
 - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Link: https://lore.kernel.org/r/20250509133535.60330-1-robert.mader@collabora.com
Signed-off-by: Daniel Stone <daniels@collabora.com>
There are now formats defined for 2-plane YUV420 at 10, 12,
and 16 bit depth using the most significant bits of the 16bit
word (P010, P012, and P016), and 3-plane YUV420 at those
depths using the least significant bits of the 16 bit word
(S010, S012, and S016).

VC4_GEN_6 can support all those formats although only composing
using at most 10bits of resolution, so add them as supported
formats for all planes.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
@6by9
Copy link
Contributor Author

6by9 commented Jul 15, 2025

Actually we can add DRM_FORMAT_Q01[026] as well.
I'll update this in a bit.

@6by9
Copy link
Contributor Author

6by9 commented Jul 15, 2025

Actually we can add DRM_FORMAT_Q01[026] as well. I'll update this in a bit.

No I won't as they don't exist! Only Q410 and Q401 which are YUV444 formats.

@pelwell pelwell merged commit c4d7426 into raspberrypi:rpi-6.12.y Jul 16, 2025
11 of 12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 17, 2025
kernel: ARM: dts: watchdog param creates early-watchdog
See: raspberrypi/linux#6961

kernel: Additional YUV420 10bit fmts
See: raspberrypi/linux#6959

kernel: Update panel-waveshare-dsi-v2 driver
See: raspberrypi/linux#6957
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Jul 17, 2025
kernel: ARM: dts: watchdog param creates early-watchdog
See: raspberrypi/linux#6961

kernel: Additional YUV420 10bit fmts
See: raspberrypi/linux#6959

kernel: Update panel-waveshare-dsi-v2 driver
See: raspberrypi/linux#6957
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.

3 participants