[PATCH v2] drm: drm_fourcc: add 10/12/16bit software decoder YCbCr formats
Daniel Stone
daniel at fooishbar.org
Thu May 8 06:37:51 UTC 2025
Hey there,
On Thu, 1 May 2025 at 12:22, Robert Mader <robert.mader at collabora.com> wrote:
> 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.
[...]
> +/*
> + * 3 plane YCbCr LSB aligned
> + * In order to use these formats in a similar fashion to MSB aligned ones
> + * implementation can multiply the values by 2^6=64.
> + * index 0 = Y plane, [15:0] x:Y [6:10] little endian
> + * index 1 = Cr plane, [15:0] x:Cr [6:10] little endian
> + * index 2 = Cb plane, [15:0] x:Cb [6:10] little endian
> + */
> +#define DRM_FORMAT_S010 fourcc_code('S', '0', '1', '0') /* 2x2 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
> +#define DRM_FORMAT_S210 fourcc_code('S', '2', '1', '0') /* 2x1 subsampled Cb (1) and Cr (2) planes 10 bits per channel */
> +#define DRM_FORMAT_S410 fourcc_code('S', '4', '1', '0') /* non-subsampled Cb (1) and Cr (2) planes 10 bits per channel */
The format spec here (and for the others) forgets to mention that the
X channel MBZ. In every other channel, X denotes 'may contain
arbitrary nonsense so don't read it, and feel free to write whatever
to it'. I think you might want to write this out as 'Z:Y' or something
instead of 'x:Y'. But honestly I'd expect people to still get this
wrong and fill it with all sorts of fun values.
Otherwise this looks good to me though; thanks for typing it up. A
VKMS implementation would be really nice for this if you've got the
time.
Cheers,
Daniel
More information about the dri-devel
mailing list