From: Pekka Paalanen <pekka.paalanen@haloniitty.fi>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Vishal Sagar <vishal.sagar@amd.com>,
Anatoliy Klymenko <anatoliy.klymenko@amd.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Michal Simek <michal.simek@amd.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Subject: Re: [PATCH v4 03/11] drm/fourcc: Add DRM_FORMAT_Y8
Date: Tue, 1 Apr 2025 09:49:27 +0300 [thread overview]
Message-ID: <20250401094927.4f7e6c7e@eldfell> (raw)
In-Reply-To: <20250331145456.GB27882@pendragon.ideasonboard.com>
[-- Attachment #1: Type: text/plain, Size: 7076 bytes --]
On Mon, 31 Mar 2025 17:54:56 +0300
Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote:
> On Mon, Mar 31, 2025 at 01:53:37PM +0300, Pekka Paalanen wrote:
> > On Mon, 31 Mar 2025 11:21:35 +0300 Laurent Pinchart wrote:
> > > On Mon, Mar 31, 2025 at 10:54:46AM +0300, Pekka Paalanen wrote:
> > > > On Thu, 27 Mar 2025 17:35:39 +0100 Geert Uytterhoeven wrote:
> > > > > On Thu, 27 Mar 2025 at 16:59, Pekka Paalanen wrote:
> > > > > > On Thu, 27 Mar 2025 16:21:16 +0200 Tomi Valkeinen wrote:
> > > > > > > On 27/03/2025 11:20, Pekka Paalanen wrote:
> > > > > > > > On Wed, 26 Mar 2025 15:55:18 +0200 Tomi Valkeinen wrote:
> > > > > > > >> On 26/03/2025 15:52, Geert Uytterhoeven wrote:
> > > > > > > >>> On Wed, 26 Mar 2025 at 14:23, Tomi Valkeinen wrote:
> > > > > > > >>>> Add greyscale Y8 format.
> > > > > > > >>>>
> > > > > > > >>>> Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > > > > > > >>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> > > > > > > >>>
> > > > > > > >>> Thanks for your patch!
> > > > > > > >>>
> > > > > > > >>>> --- a/include/uapi/drm/drm_fourcc.h
> > > > > > > >>>> +++ b/include/uapi/drm/drm_fourcc.h
> > > > > > > >>>> @@ -405,6 +405,9 @@ extern "C" {
> > > > > > > >>>> #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
> > > > > > > >>>> #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
> > > > > > > >>>>
> > > > > > > >>>> +/* Greyscale formats */
> > > > > > > >>>> +
> > > > > > > >>>> +#define DRM_FORMAT_Y8 fourcc_code('G', 'R', 'E', 'Y') /* 8-bit Y-only */
> > > > > > > >>>
> > > > > > > >>> This format differs from e.g. DRM_FORMAT_R8, which encodes
> > > > > > > >>> the number of bits in the FOURCC format. What do you envision
> > > > > > > >>> for e.g. DRM_FORMAT_Y16? fourcc_code('G', 'R', '1', '6')?
> > > > > > > >>
> > > > > > > >> I wanted to use the same fourcc as on V4L2 side. Strictly speaking it's
> > > > > > > >> not required, but different fourccs for the same formats do confuse.
> > > > > > > >>
> > > > > > > >> So, generally speaking, I'd pick an existing fourcc from v4l2 side if
> > > > > > > >> possible, and if not, invent a new one.
> > > > > > > >
> > > > > > > > what's the actual difference between DRM_FORMAT_R8 and DRM_FORMAT_Y8?
> > > > > > > >
> > > > > > > > Is the difference that when R8 gets expanded to RGB, it becomes (R, 0,
> > > > > > > > 0), but Y8 gets expanded to (c1 * Y, c2 * Y, c3 * Y) where c1..c3 are
> > > > > > > > defined by MatrixCoefficients (H.273 terminology)?
> > > > > > > >
> > > > > > > > That would be my intuitive assumption following how YCbCr is handled.
> > > > > > > > Is it obvious enough, or should there be a comment to that effect?
> > > > > > >
> > > > > > > You raise an interesting point. Is it defined how a display driver, that
> > > > > > > supports R8 as a format, shows R8 on screen? I came into this in the
> > > > > > > context of grayscale formats, so I thought R8 would be handled as (R, R,
> > > > > > > R) in RGB. But you say (R, 0, 0), which... also makes sense.
> > > > > >
> > > > > > That is a good question too. I based my assumption on OpenGL behavior
> > > > > > of R8.
> > > > > >
> > > > > > Single channel displays do exist I believe, but being single-channel,
> > > > > > expansion on the other channels is likely meaningless. Hm, but for the
> > > > > > KMS color pipeline, it would be meaningful, like with a CTM.
> > > > > > Interesting.
> > > > > >
> > > > > > I don't know. Maybe Geert does?
> > > > >
> > > > > I did some digging, and was a bit surprised that it was you who told
> > > > > me to use R8 instead of Y8?
> > > > > https://lore.kernel.org/all/20220202111954.6ee9a10c@eldfell
> > > >
> > > > Hi Geert,
> > > >
> > > > indeed I did. I never thought of the question of expansion to R,G,B
> > > > before. Maybe that expansion is what spells R8 and Y8 apart?
> > > >
> > > > I do think that expansion needs to be specified, so that the KMS color
> > > > pipeline computations are defined. There is a big difference between
> > > > multiplying these with an arbitrary 3x3 matrix (e.g. CTM):
> > > >
> > > > - (R, 0, 0)
> > > > - (R, R, R)
> > > > - (c1 * Y, c2 * Y, c3 * Y)
> > >
> > > I'd be very surprised by an YUV to RGB conversion matrix where the first
> > > column would contain different values. What we need to take into account
> > > though is quantization (full vs. limited range).
> >
> > A good point, are the Y coefficients always 1.0 after quantization
> > range has been accounted for?
>
> As far as I understand, they should be. RGB is full range, so the Y
> range should map to [0.0, 1.0] in RGB space. I'm also not aware of any
> colorspace where a grey colour would have different R, G and B values.
>
> There's a related but separate question: if Y is a luma (in Y'CbCr
> terms), it will not be linear, compared to the Y luminance (YCbCr). We
I did not think anyone would use optical YCbCr, since that tends to
not occur in color transformation chains. Hence, to me Y in YCbCr is
Y', the electrical quantity, luma, unless otherwise explicitly stated.
Likewise, sounds like you take Y'CbCr to mean Y'C'bC'r.
(I like to use the term optical instead of linear, because of "linear
with respect to what?".)
> have a DEGAMMA_LUT to linearize data, but that's in the CRTC output
> path, not in the plane path, and I don't see any API element to specify
> the transfer function of data input to a CRTC.
That's what
https://lore.kernel.org/dri-devel/20241220043410.416867-5-alex.hung@amd.com/
addresses.
Thanks,
pq
> > That makes Y8 produce (Y, Y, Y), and we have our answer: R8 should be
> > (R, 0, 0), so we have both variants. Or do we need Y-formats at all?
> >
> > Can we specify Y, R, G and B be nominal values in the range 0.0 - 1.0
> > in the KMS color processing?
> >
> > > > I forgot to consider that in the discussion of single-channel displays,
> > > > because the displays obviously do not consider any other channel than
> > > > the one.
> > > >
> > > > Using DRM_FORMAT_Y8 FB with a single-channel display might even be
> > > > surprising, because the proposed Y8 definition would result in c1 * Y,
> > > > and not Y. The default c1 comes from the BT.601 matrix IIRC?
> > > >
> > > > Therefore I think the difference between R8 and Y8 has been found. Now
> > > > we just need to determine whether R8 means (R, 0, 0) or (R, R, R) to
> > > > nail down the color operations as well. There are questions like what
> > > > is the outcome at the video signal level when we have one KMS plane
> > > > with an R8 FB and another KMS plane with an RGBA8888 FB on the same
> > > > CRTC? What about Y8 or NV12 in the mix? What if the video signal is
> > > > single-channel, RGB, or YCbCr?
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-04-01 6:51 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 13:22 [PATCH v4 00/11] drm: Add new pixel formats for Xilinx Zynqmp Tomi Valkeinen
2025-03-26 13:22 ` [PATCH v4 01/11] drm/fourcc: Add warning for bad bpp Tomi Valkeinen
2025-03-26 13:22 ` [PATCH v4 02/11] drm/fourcc: Add DRM_FORMAT_XV15/XV20 Tomi Valkeinen
2025-03-27 22:34 ` Laurent Pinchart
2025-03-28 10:05 ` Tomi Valkeinen
2025-03-28 10:27 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 03/11] drm/fourcc: Add DRM_FORMAT_Y8 Tomi Valkeinen
2025-03-26 13:52 ` Geert Uytterhoeven
2025-03-26 13:55 ` Tomi Valkeinen
2025-03-27 9:20 ` Pekka Paalanen
2025-03-27 14:21 ` Tomi Valkeinen
2025-03-27 15:58 ` Pekka Paalanen
2025-03-27 16:35 ` Geert Uytterhoeven
2025-03-31 7:54 ` Pekka Paalanen
2025-03-31 8:21 ` Laurent Pinchart
2025-03-31 10:53 ` Pekka Paalanen
2025-03-31 14:54 ` Laurent Pinchart
2025-04-01 6:49 ` Pekka Paalanen [this message]
2025-04-01 13:27 ` Pekka Paalanen
2025-04-16 8:59 ` Tomi Valkeinen
2025-04-17 8:13 ` Pekka Paalanen
2025-04-21 14:50 ` Laurent Pinchart
2025-04-22 9:11 ` Pekka Paalanen
2025-04-22 9:41 ` Geert Uytterhoeven
2025-04-22 10:01 ` Pekka Paalanen
2025-04-22 10:12 ` Geert Uytterhoeven
2025-04-22 11:00 ` Pekka Paalanen
2025-04-25 8:38 ` Tomi Valkeinen
2025-04-25 10:18 ` Pekka Paalanen
2025-03-26 13:22 ` [PATCH v4 04/11] drm/fourcc: Add DRM_FORMAT_Y10_P32 Tomi Valkeinen
2025-03-27 22:53 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 05/11] drm/fourcc: Add DRM_FORMAT_X403 Tomi Valkeinen
2025-03-27 22:55 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 06/11] drm/fourcc: Add DRM_FORMAT_XVUY2101010 Tomi Valkeinen
2025-03-27 23:07 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 07/11] drm: xlnx: zynqmp: Use drm helpers when calculating buffer sizes Tomi Valkeinen
2025-03-26 13:22 ` [PATCH v4 08/11] drm: xlnx: zynqmp: Add support for XV15 & XV20 Tomi Valkeinen
2025-03-27 22:35 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 09/11] drm: xlnx: zynqmp: Add support for Y8 and Y10_P32 Tomi Valkeinen
2025-03-27 22:52 ` Laurent Pinchart
2025-03-31 11:37 ` Tomi Valkeinen
2025-03-26 13:22 ` [PATCH v4 10/11] drm: xlnx: zynqmp: Add support for X403 Tomi Valkeinen
2025-03-27 22:59 ` Laurent Pinchart
2025-03-26 13:22 ` [PATCH v4 11/11] drm: xlnx: zynqmp: Add support for XVUY2101010 Tomi Valkeinen
2025-03-27 23:06 ` Laurent Pinchart
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=20250401094927.4f7e6c7e@eldfell \
--to=pekka.paalanen@haloniitty.fi \
--cc=airlied@gmail.com \
--cc=anatoliy.klymenko@amd.com \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=michal.simek@amd.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
--cc=vishal.sagar@amd.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).