From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD000C369C2 for ; Wed, 16 Apr 2025 10:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Sdkzts0oZ32Xc0NbM4rDY8/1yhxTMxRgzx5x42xuyqw=; b=P/n0w5DD18R11Au4S6cqKQBcvn xZSUQYB8One70Al32onUNerSipwkctjBGTlRxJ30RJvWFHfneZuRyYy1TrUKZa61eci285q8ZnOfh L+RalIUmCVSN0ZRviubS11OuXd5qRWtJ20RefPobLf+Wwj+4kQQYal4xltmmVn5yNB3VVyBWxn7DW 5KilHGdP+jM9rb+8GjwpjnsTovcWitZK/jvgSGZS4ZwTerKk7VhbiBGWncYN0JzYERFrHSThlpWZ5 siB69/MwmcS9IoYTLz3vwRHxpzN3r6xxM+7nudhg6Rk5Jp6h0LBYrx+DyNP1pboFzCc+iBgNjEykq FZFAKtEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1u503I-000000099cy-2yEo; Wed, 16 Apr 2025 10:31:32 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1u4ycY-00000008tus-3ThU for linux-arm-kernel@lists.infradead.org; Wed, 16 Apr 2025 08:59:52 +0000 Received: from [192.168.88.20] (91-158-153-178.elisa-laajakaista.fi [91.158.153.178]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 870DA965; Wed, 16 Apr 2025 10:57:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1744793865; bh=IK9UyR16MCakiskdgLYvgLg+KiigxiyDPwyZXHoB2FA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=vatXZo60UrHedGeP6O9FWVxOQTiJDS6lAZMxI+nX/m/FwwmBdX30c4RD18ZKfL9eq qFK9BB8+D9D0x5If8AOC2EzAQQAKtp4vuA6cxsIbJBgZ5bDNfcUtqw1Q9AwgYNHqcj 881aElHAa32eokWKJPUOX5p3ybFQ5tuBnK3S8I0U= Message-ID: <73bd6628-374d-417f-a30f-88a4b1d157bb@ideasonboard.com> Date: Wed, 16 Apr 2025 11:59:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 03/11] drm/fourcc: Add DRM_FORMAT_Y8 To: Pekka Paalanen , Laurent Pinchart Cc: Geert Uytterhoeven , Vishal Sagar , Anatoliy Klymenko , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Michal Simek , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dmitry Baryshkov References: <20250326-xilinx-formats-v4-0-322a300c6d72@ideasonboard.com> <20250326-xilinx-formats-v4-3-322a300c6d72@ideasonboard.com> <20250327112009.6b4dc430@eldfell> <20250327175842.130c0386@eldfell> <20250331105446.098f0fbe@eldfell> <20250331082135.GB13690@pendragon.ideasonboard.com> <20250331135337.61934003@eldfell> <20250401162732.731ef774@eldfell> Content-Language: en-US From: Tomi Valkeinen Autocrypt: addr=tomi.valkeinen@ideasonboard.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yWXYepFtHz9KsBS0DaZb 4IkLmZwEXpZcIOQjQ71fqlpiXkXSIaQ6YMEs8WjBbpP81h7QxWIfWtp+VnwNGc6nq5IQDESH mvQcsFS7d3eGVI6eyjCFdcAO8eMAEQEAAcLBXwQYAQIACQUCTqazRwIbDAAKCRD6PaqMvJYe 9fA7EACS6exUedsBKmt4pT7nqXBcRsqm6YzT6DeCM8PWMTeaVGHiR4TnNFiT3otD5UpYQI7S suYxoTdHrrrBzdlKe5rUWpzoZkVK6p0s9OIvGzLT0lrb0HC9iNDWT3JgpYDnk4Z2mFi6tTbq xKMtpVFRA6FjviGDRsfkfoURZI51nf2RSAk/A8BEDDZ7lgJHskYoklSpwyrXhkp9FHGMaYII m9EKuUTX9JPDG2FTthCBrdsgWYPdJQvM+zscq09vFMQ9Fykbx5N8z/oFEUy3ACyPqW2oyfvU CH5WDpWBG0s5BALp1gBJPytIAd/pY/5ZdNoi0Cx3+Z7jaBFEyYJdWy1hGddpkgnMjyOfLI7B CFrdecTZbR5upjNSDvQ7RG85SnpYJTIin+SAUazAeA2nS6gTZzumgtdw8XmVXZwdBfF+ICof 92UkbYcYNbzWO/GHgsNT1WnM4sa9lwCSWH8Fw1o/3bX1VVPEsnESOfxkNdu+gAF5S6+I6n3a ueeIlwJl5CpT5l8RpoZXEOVtXYn8zzOJ7oGZYINRV9Pf8qKGLf3Dft7zKBP832I3PQjeok7F yjt+9S+KgSFSHP3Pa4E7lsSdWhSlHYNdG/czhoUkSCN09C0rEK93wxACx3vtxPLjXu6RptBw 3dRq7n+mQChEB1am0BueV1JZaBboIL0AGlSJkm23kw== In-Reply-To: <20250401162732.731ef774@eldfell> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250416_015951_019688_D3A5BCF7 X-CRM114-Status: GOOD ( 24.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 01/04/2025 16:27, Pekka Paalanen wrote: > On Mon, 31 Mar 2025 13:53:37 +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: >>>> >>>>> Hi Pekka, >>>>> >>>>> 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 >>>>>>>>>>> Signed-off-by: Tomi Valkeinen >>>>>>>>>> >>>>>>>>>> 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). > > Quantization range is indeed good to note. R8 would be always full > range, but Y8 would follow COLOR_RANGE property. > >> That makes Y8 produce (Y, Y, Y), and we have our answer: R8 should be >> (R, 0, 0), so we have both variants. >> >> Can we specify Y, R, G and B be nominal values in the range 0.0 - 1.0 >> in the KMS color processing? > > I think this 0.0 - 1.0 nominal range definition for the abstract KMS > color processing is necessary. > > It also means that limited range Y8 data, when containing values 0-15 > or 240-255, would produce negative and greater than 1.0 values, > respectively. They might get immediately clamped to 0.0 - 1.0 with the > first color operation they face, though, but the concept seems > important and carrying over to the new color pipelines UAPI which might > choose not to clamp. Is the behavior of values outside the limited range something that needs to be defined? We can't know how each piece of HW behaves with "undefined" input, so should we not just define the behavior as platform specific? In any case: I can't say I fully understood all the discussions wrt. color spaces. But my immediate interest is, of course, this series =). So is there something that you think should be improved here? 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? Tomi