[libcamera-devel] [PATCH 4/4] libcamera: v4l2_pixelformat: Add support for 10-bit Bayer formats

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Apr 30 10:41:11 CEST 2020


Hi Laurent,

On 30/04/2020 01:52, Laurent Pinchart wrote:
> Add the MIPI-packed 10-bit Bayer formats to the format tables.
> 

You also add 12 bit formats below.. (also re: $SUBJECT)

Are these DRM formats accepted upstream already?

What about the 8, and 14 bit equivalents too?

These only add the
 MIPI_FORMAT_MOD_CSI2_PACKED, and
 V4L2_PIX_FMT_S{RGGB*}{10,12}P

conversions.

Perhaps subject should state add support for packed bayer formats ?

Or should the non-packed? (V4L2_PIX_FMT_SBGGR10, ) versions

> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
>  src/libcamera/v4l2_pixelformat.cpp | 44 ++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index e1c96b9862c3..96f408a0bbcd 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -102,6 +102,32 @@ const std::map<PixelFormat, PixelFormatInfo> pf2vpf{
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_GREY),
>  	} },
>  
> +	/* Bayer formats. */
> +	{ PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
> +	} },
> +	{ PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), {
> +		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
> +	} },
> +
>  	/* Compressed formats. */
>  	{ PixelFormat(DRM_FORMAT_MJPEG), {
>  		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_MJPEG),
> @@ -132,6 +158,24 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
>  	/* Greyscale formats. */
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_GREY), PixelFormat(DRM_FORMAT_R8) },
>  
> +	/* Bayer formats. */
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),
> +	  PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
> +	  PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
> +	  PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
> +	  PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED) },

new line here to separate groupings?

> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
> +	  PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
> +	  PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
> +	  PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED) },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
> +	  PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED) },

Tables like this are one place I really hate 80 char limits.

I think things like this are so much more readable in columns, 'almost'
regardless of width.

Wrapping 'table' data to fit to an old terminal size (even though we can
pan right and left, even on small terminals) seems to me to hinder
readability in cases like this more than improve it ...

But either-way, because it's always a difficult subject ... and with
$SUBJECT updated as required...

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> +
>  	/* Compressed formats. */
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), PixelFormat(DRM_FORMAT_MJPEG) },
>  };
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list