Re: [PATCH v4 03/11] drm/fourcc: Add DRM_FORMAT_Y8

Tomi Valkeinen
2025-04-25T08:38:33Z

Hi Pekka,

On 17/04/2025 11:13, Pekka Paalanen wrote:
>> My understanding is that the Y-only pixel formats behave in a well
>> defined way (or, as well defined as the YUV formats), and there's
>> nothing more to add here. Is that right?
>
> There are two things:
>
> - Y8 follows COLOR_RANGE property, just like all other YUV formats.
> - Y8 implies that Cb and Cr are both neutral (0.0 in nominal values).
>
> I'd like these explicitly written down, so that they become obvious to
> everyone. I suspect either one might be easy to forget when writing
> code and taking shortcuts without thinking.

I didn't find a suitable place in the docs for this, but would this, in
the drm_fourcc.h, be enough:

/*
* Y-only (greyscale) formats
*
* The Y-only formats are handled similarly to the YCbCr formats in the
display
* pipeline, with the Cb and Cr implicitly neutral (0.0 in nominal
values). This
* also means that COLOR_RANGE property applies to the Y-only formats.
*
*/

#define DRM_FORMAT_Y8 fourcc_code('G', 'R', 'E', 'Y') /* 8-bit Y-only */
#define DRM_FORMAT_Y10_P32 fourcc_code('Y', 'P', 'A', '4') /* [31:0]
x:Y2:Y1:Y0 2:10:10:10 little endian */

Tomi