Re: (EXT) Re: [PATCH 7/8] media: imx: utils: Add more Bayer formats

From: Alexander Stein
Date: Mon Feb 07 2022 - 05:44:15 EST


Hi Laurent,

Am Samstag, 5. Februar 2022, 04:31:36 CET schrieb Laurent Pinchart:
> Hi Alexander,
>
> Thank you for the patch.
>
> On Fri, Feb 04, 2022 at 01:15:13PM +0100, Alexander Stein wrote:
> > Without this the ioctl VIDIOC_ENUM_FMT will not list the 10/12/14-Bit
> > Bayer formats. This in return results in
> > "v4l2-ctl --set-fmt-video pixelformat='RG10'" failing to set the
> > pixelformat as it is not enumerated as supported format.
> >
> > Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
>
> Do IPUv3-based SoCs support 10-, 12- and 14-bit formats ? If so,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

I'm no expert regarding IPUv3. But according to i.MX6D/Q RM Rev4 apparently
there is difference between Bayer format or "Generic data"
(CSI0_SENS_DATA_FORMAT: b011). Data width is set independently in
CSI0_DATA_WIDTH where 10-, 12- and 14-bit is supported (even the odd ones in
bewteen).
I don't know if I got the right place, but [1] seems to do the mapping for
IPUv3 what imx7_csi_configure() is doing for CSI on imx7/8. The
MEDIA_BUS_FMT_Sxxxx14_1X14 formats are not added to the list yet though, but
that is a different matter.
Unless someone objects I'm going forwards with this patch.

Regards,
Alexander

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/
drivers/gpu/ipu-v3/ipu-csi.c#n302

> > ---
> > This adds the following formats to `v4l2-ctl --list-formats`
> > [...]
> >
> > [18]: 'BG10' (10-bit Bayer BGBG/GRGR)
> > [19]: 'GB10' (10-bit Bayer GBGB/RGRG)
> > [20]: 'BA10' (10-bit Bayer GRGR/BGBG)
> > [21]: 'RG10' (10-bit Bayer RGRG/GBGB)
> > [22]: 'BG12' (12-bit Bayer BGBG/GRGR)
> > [23]: 'GB12' (12-bit Bayer GBGB/RGRG)
> > [24]: 'BA12' (12-bit Bayer GRGR/BGBG)
> > [25]: 'RG12' (12-bit Bayer RGRG/GBGB)
> > [26]: 'BG14' (14-bit Bayer BGBG/GRGR)
> > [27]: 'GB14' (14-bit Bayer GBGB/RGRG)
> > [28]: 'GR14' (14-bit Bayer GRGR/BGBG)
> > [29]: 'RG14' (14-bit Bayer RGRG/GBGB)
> >
> > [...]
> >
> > drivers/staging/media/imx/imx-media-utils.c | 72 +++++++++++++++++++++
> > 1 file changed, 72 insertions(+)
> >
> > diff --git a/drivers/staging/media/imx/imx-media-utils.c
> > b/drivers/staging/media/imx/imx-media-utils.c index
> > e0a256a08c3b..ea56c82d3b32 100644
> > --- a/drivers/staging/media/imx/imx-media-utils.c
> > +++ b/drivers/staging/media/imx/imx-media-utils.c
> > @@ -130,6 +130,78 @@ static const struct imx_media_pixfmt pixel_formats[]
> > = {>
> > .cs = IPUV3_COLORSPACE_RGB,
> > .bpp = 8,
> > .bayer = true,
> >
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SBGGR10,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR10_1X10),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 10,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGBRG10,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG10_1X10),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 10,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGRBG10,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG10_1X10),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 10,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SRGGB10,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB10_1X10),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 10,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SBGGR12,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR12_1X12),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 12,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGBRG12,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG12_1X12),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 12,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGRBG12,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG12_1X12),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 12,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SRGGB12,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB12_1X12),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 12,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SBGGR14,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR14_1X14),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 14,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGBRG14,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG14_1X14),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 14,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SGRBG14,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG14_1X14),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 14,
> > + .bayer = true,
> > + }, {
> > + .fourcc = V4L2_PIX_FMT_SRGGB14,
> > + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB14_1X14),
> > + .cs = IPUV3_COLORSPACE_RGB,
> > + .bpp = 14,
> > + .bayer = true,
> >
> > }, {
> >
> > .fourcc = V4L2_PIX_FMT_SBGGR16,
> > .codes = IMX_BUS_FMTS(