From: Hans Verkuil <hverkuil-cisco@xs4all.nl> To: Ming Qian <ming.qian@nxp.com>, 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 Subject: Re: [PATCH 06/10] media: Add B412 video format Date: Fri, 27 Jan 2023 15:53:06 +0100 [thread overview] Message-ID: <9f34a103-2dab-39bc-43c6-ea9ca494d7ad@xs4all.nl> (raw) In-Reply-To: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> 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 <ming.qian@nxp.com> > --- > 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 */
WARNING: multiple messages have this Message-ID (diff)
From: Hans Verkuil <hverkuil-cisco@xs4all.nl> To: Ming Qian <ming.qian@nxp.com>, 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 Subject: Re: [PATCH 06/10] media: Add B412 video format Date: Fri, 27 Jan 2023 15:53:06 +0100 [thread overview] Message-ID: <9f34a103-2dab-39bc-43c6-ea9ca494d7ad@xs4all.nl> (raw) In-Reply-To: <86983e95cfd05ba9b3b4688e25b58e96ab23d185.1671071730.git.ming.qian@nxp.com> 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 <ming.qian@nxp.com> > --- > 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
next prev parent reply other threads:[~2023-01-27 14:53 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-20 3:11 [PATCH 00/10] media: imx-jpeg: Add support for 12 bit extended Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-20 3:11 ` [PATCH 01/10] media: Add P012 and P012M video format Ming Qian 2022-12-20 3:11 ` Ming Qian 2023-01-27 14:31 ` Hans Verkuil 2023-01-27 14:31 ` Hans Verkuil 2023-01-30 8:15 ` [EXT] " Ming Qian 2023-01-30 8:15 ` Ming Qian 2023-02-10 15:08 ` Nicolas Dufresne 2023-02-10 15:08 ` Nicolas Dufresne 2023-02-13 9:16 ` Ming Qian 2023-02-13 9:16 ` Ming Qian 2022-12-20 3:11 ` [PATCH 02/10] media: Add Y012 " Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-20 3:11 ` [PATCH 03/10] media: Add Y212 " Ming Qian 2022-12-20 3:11 ` Ming Qian 2023-01-27 14:37 ` Hans Verkuil 2023-01-27 14:37 ` Hans Verkuil 2023-02-22 15:31 ` Nicolas Dufresne 2023-02-22 15:31 ` Nicolas Dufresne 2023-02-23 1:35 ` [EXT] " Ming Qian 2023-02-23 1:35 ` Ming Qian 2022-12-20 3:11 ` [PATCH 04/10] media: Add Y312 " Ming Qian 2022-12-20 3:11 ` Ming Qian 2023-01-27 14:42 ` Hans Verkuil 2023-01-27 14:42 ` Hans Verkuil 2022-12-20 3:11 ` [PATCH 05/10] media: Add B312 " Ming Qian 2022-12-20 3:11 ` Ming Qian 2023-01-27 14:46 ` Hans Verkuil 2023-01-27 14:46 ` Hans Verkuil 2022-12-20 3:11 ` [PATCH 06/10] media: Add B412 " Ming Qian 2022-12-20 3:11 ` Ming Qian 2023-01-27 14:53 ` Hans Verkuil [this message] 2023-01-27 14:53 ` Hans Verkuil 2022-12-20 3:11 ` [PATCH 07/10] media: imx-jpeg: Refine the function mxc_jpeg_find_format Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-20 3:11 ` [PATCH 08/10] media: imx-jpeg: Clear slot next desc ptr if config error Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-20 3:11 ` [PATCH 09/10] media: imx-jpeg: Decoder add support for 12bit jpeg Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-20 3:11 ` [PATCH 10/10] media: imx-jpeg: Encoder " Ming Qian 2022-12-20 3:11 ` Ming Qian 2022-12-22 21:47 ` [PATCH 00/10] media: imx-jpeg: Add support for 12 bit extended mirela.rabulea 2022-12-22 21:47 ` mirela.rabulea
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=9f34a103-2dab-39bc-43c6-ea9ca494d7ad@xs4all.nl \ --to=hverkuil-cisco@xs4all.nl \ --cc=devicetree@vger.kernel.org \ --cc=festevam@gmail.com \ --cc=kernel@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-imx@nxp.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=mchehab@kernel.org \ --cc=ming.qian@nxp.com \ --cc=mirela.rabulea@oss.nxp.com \ --cc=s.hauer@pengutronix.de \ --cc=shawnguo@kernel.org \ --cc=xiahong.bao@nxp.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.