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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 146F5C61DA3 for ; Fri, 27 Jan 2023 14:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234006AbjA0OxS (ORCPT ); Fri, 27 Jan 2023 09:53:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233973AbjA0OxP (ORCPT ); Fri, 27 Jan 2023 09:53:15 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2335223657; Fri, 27 Jan 2023 06:53:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5383ACE28BB; Fri, 27 Jan 2023 14:53:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57053C433D2; Fri, 27 Jan 2023 14:53:08 +0000 (UTC) Message-ID: <9f34a103-2dab-39bc-43c6-ea9ca494d7ad@xs4all.nl> Date: Fri, 27 Jan 2023 15:53:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 06/10] media: Add B412 video format Content-Language: en-US To: Ming Qian , mchehab@kernel.org, mirela.rabulea@oss.nxp.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> From: Hans Verkuil In-Reply-To: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/2022 04:11, Ming Qian wrote: > B412 is a reversed RGB format with alpha channel last, > 12 bits per component like ABGR32, > expanded to 16bits. > Data in the 12 high bits, zeros in the 4 low bits, > arranged in little endian order. > > Signed-off-by: Ming Qian > --- > Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ > drivers/media/v4l2-core/v4l2-common.c | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 12 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > index f7785c93292a..b9d1e48c0224 100644 > --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > @@ -793,6 +793,15 @@ arranged in little endian order. > - G\ :sub:`15-4` > - R\ :sub:`15-4` > - > + * .. _V4L2-PIX-FMT-B412: > + > + - ``V4L2_PIX_FMT_B412`` > + - 'B412' > + > + - B\ :sub:`15-4` > + - G\ :sub:`15-4` > + - R\ :sub:`15-4` > + - A\ :sub:`15-4` > > .. raw:: latex > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index 0cc58abae562..5384648903a9 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) > { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_B312, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > + { .format = V4L2_PIX_FMT_B412, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > > /* YUV packed formats */ > { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 8c3d40d3acf5..8cb21024bd96 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; > case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; > case V4L2_PIX_FMT_B312: descr = "12-bit Depth BGR"; break; > + case V4L2_PIX_FMT_B412: descr = "12-bit Depth BGRA"; break; > case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; > case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; > case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index c67f895210de..a26ff16a52c8 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -579,6 +579,7 @@ struct v4l2_pix_format { > > /* RGB formats (6 or 8 bytes per pixel) */ > #define V4L2_PIX_FMT_B312 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ > +#define V4L2_PIX_FMT_B412 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ This would be ABGR32_12, to correspond with the 8 bit ABGR32. Unfortunately, that define has a terrible mismatch with the actual component order (alpha comes last in memory, not first as the name suggests). It would be nice to be able to fix this, but I think that would be even more confusing. Regards, Hans > > /* Grey formats */ > #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ 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 68D04C54EAA for ; Fri, 27 Jan 2023 14:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=ztXDFKN/186E0VM6YYhOQOkGBr1yO70i8oTqNGvBois=; b=wAPU79phK3GLJD 2l40/P6K1Sh/alFetGLhW2Ph1333wMmWUPgWQvkI3r0nxJWKvYm7caNBxWzbA7+rzBbaM+ZO8aXkd DVevTVy9erLQ5n9lZ8lhsHIQhonuiuX6PXCIkt4Yx+dESHzLzvurDzovNE+s/2U3JArIdaGZp6V1b 6KoHsvhbDMxKf+/on6kBNMY7Mw5+fRLusIew2+hJ2nPQHVOG9bdqOEQfGfJbpLW01NiQqPKRCcVxJ KaTSGqfcNXzxYwAbLU63A+wA69/ahjrbzpIHrdnHNxP+Zl9BbAPMng57Xdf0hrkZ4PM/QkK9n7h2s K/CR5AbwX3yoYlv6zeYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLQ6P-00FMrB-G2; Fri, 27 Jan 2023 14:53:17 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLQ6L-00FMqZ-Ig for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 14:53:15 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01D1BB82129; Fri, 27 Jan 2023 14:53:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57053C433D2; Fri, 27 Jan 2023 14:53:08 +0000 (UTC) Message-ID: <9f34a103-2dab-39bc-43c6-ea9ca494d7ad@xs4all.nl> Date: Fri, 27 Jan 2023 15:53:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 06/10] media: Add B412 video format Content-Language: en-US To: Ming Qian , mchehab@kernel.org, mirela.rabulea@oss.nxp.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> From: Hans Verkuil In-Reply-To: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_065313_938597_FC35B32F X-CRM114-Status: GOOD ( 20.37 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 20/12/2022 04:11, Ming Qian wrote: > B412 is a reversed RGB format with alpha channel last, > 12 bits per component like ABGR32, > expanded to 16bits. > Data in the 12 high bits, zeros in the 4 low bits, > arranged in little endian order. > > Signed-off-by: Ming Qian > --- > Documentation/userspace-api/media/v4l/pixfmt-rgb.rst | 9 +++++++++ > drivers/media/v4l2-core/v4l2-common.c | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 12 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > index f7785c93292a..b9d1e48c0224 100644 > --- a/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > +++ b/Documentation/userspace-api/media/v4l/pixfmt-rgb.rst > @@ -793,6 +793,15 @@ arranged in little endian order. > - G\ :sub:`15-4` > - R\ :sub:`15-4` > - > + * .. _V4L2-PIX-FMT-B412: > + > + - ``V4L2_PIX_FMT_B412`` > + - 'B412' > + > + - B\ :sub:`15-4` > + - G\ :sub:`15-4` > + - R\ :sub:`15-4` > + - A\ :sub:`15-4` > > .. raw:: latex > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index 0cc58abae562..5384648903a9 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -253,6 +253,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) > { .format = V4L2_PIX_FMT_RGB555, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_BGR666, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_B312, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > + { .format = V4L2_PIX_FMT_B412, .pixel_enc = V4L2_PIXEL_ENC_RGB, .mem_planes = 1, .comp_planes = 1, .bpp = { 8, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > > /* YUV packed formats */ > { .format = V4L2_PIX_FMT_YUYV, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 8c3d40d3acf5..8cb21024bd96 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1299,6 +1299,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break; > case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break; > case V4L2_PIX_FMT_B312: descr = "12-bit Depth BGR"; break; > + case V4L2_PIX_FMT_B412: descr = "12-bit Depth BGRA"; break; > case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break; > case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break; > case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index c67f895210de..a26ff16a52c8 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -579,6 +579,7 @@ struct v4l2_pix_format { > > /* RGB formats (6 or 8 bytes per pixel) */ > #define V4L2_PIX_FMT_B312 v4l2_fourcc('B', '3', '1', '2') /* 48 BGR 12-bit per component */ > +#define V4L2_PIX_FMT_B412 v4l2_fourcc('B', '4', '1', '2') /* 64 BGRA 12-bit per component */ This would be ABGR32_12, to correspond with the 8 bit ABGR32. Unfortunately, that define has a terrible mismatch with the actual component order (alpha comes last in memory, not first as the name suggests). It would be nice to be able to fix this, but I think that would be even more confusing. Regards, Hans > > /* Grey formats */ > #define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel