[libcamera-devel,v2] libcamera: v4l2_subdevice: Add JPEG_1X8 and BGR888_1X24 mbus formats to formatInfoMap
diff mbox series

Message ID 20221010102418.430215-1-xavier.roumegue@oss.nxp.com
State Accepted
Headers show
Series
  • [libcamera-devel,v2] libcamera: v4l2_subdevice: Add JPEG_1X8 and BGR888_1X24 mbus formats to formatInfoMap
Related show

Commit Message

Xavier Roumegue Oct. 10, 2022, 10:24 a.m. UTC
From: Xavier Roumegue <xavier.roumegue@oss.nxp.com>

The warnings "Unknown subdev format 0x4001, defaulting to RGB encoding" and
"Unknown subdev format 0x1013, defaulting to RGB encoding" are thrown while using
simple pipeline handler with NXP ISI hardware.
The JPEG_1X8 and BGR888_1X24 media bus formats, supported by the ISI driver, are
missing in the V4L2SubdeviceFormatInfo structure storing the correspondence
between a media bus format and a colour encoding. So populate the structure with
the missing media bus formats.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
---
 src/libcamera/v4l2_subdevice.cpp | 2 ++
 1 file changed, 2 insertions(+)

Comments

Umang Jain Oct. 14, 2022, 2:18 p.m. UTC | #1
Hi Xavier,

Thank you for the patch.

On 10/10/22 3:54 PM, Xavier Roumegue (OSS) via libcamera-devel wrote:
> From: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
>
> The warnings "Unknown subdev format 0x4001, defaulting to RGB encoding" and
> "Unknown subdev format 0x1013, defaulting to RGB encoding" are thrown while using

Glad to see these warnings are catching things what we intended for, 
since it has recently been introduced.
> simple pipeline handler with NXP ISI hardware.
> The JPEG_1X8 and BGR888_1X24 media bus formats, supported by the ISI driver, are
> missing in the V4L2SubdeviceFormatInfo structure storing the correspondence
> between a media bus format and a colour encoding. So populate the structure with
> the missing media bus formats.
>
> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   src/libcamera/v4l2_subdevice.cpp | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> index 9ef95963..37cd63c6 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -68,6 +68,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
>   	{ MEDIA_BUS_FMT_RGB565_2X8_LE, { 16, "RGB565_2X8_LE", PixelFormatInfo::ColourEncodingRGB } },
>   	{ MEDIA_BUS_FMT_RGB666_1X18, { 18, "RGB666_1X18", PixelFormatInfo::ColourEncodingRGB } },
>   	{ MEDIA_BUS_FMT_RGB888_1X24, { 24, "RGB888_1X24", PixelFormatInfo::ColourEncodingRGB } },
> +	{ MEDIA_BUS_FMT_BGR888_1X24, { 24, "BGR888_1X24", PixelFormatInfo::ColourEncodingRGB } },
>   	{ MEDIA_BUS_FMT_RGB888_2X12_BE, { 24, "RGB888_2X12_BE", PixelFormatInfo::ColourEncodingRGB } },
>   	{ MEDIA_BUS_FMT_RGB888_2X12_LE, { 24, "RGB888_2X12_LE", PixelFormatInfo::ColourEncodingRGB } },
>   	{ MEDIA_BUS_FMT_ARGB8888_1X32, { 32, "ARGB8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
> @@ -133,6 +134,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
>   	{ MEDIA_BUS_FMT_SRGGB12_1X12, { 12, "SRGGB12_1X12", PixelFormatInfo::ColourEncodingRAW } },
>   	/* \todo Clarify colour encoding for HSV formats */
>   	{ MEDIA_BUS_FMT_AHSV8888_1X32, { 32, "AHSV8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
> +	{ MEDIA_BUS_FMT_JPEG_1X8, { 8, "JPEG_1X8", PixelFormatInfo::ColourEncodingYUV } },
>   };
>   
>   } /* namespace */
Laurent Pinchart Oct. 15, 2022, 4:54 p.m. UTC | #2
Hi Xavier,

Thank you for the patch.

On Mon, Oct 10, 2022 at 12:24:18PM +0200, Xavier Roumegue (OSS) via libcamera-devel wrote:
> From: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> 
> The warnings "Unknown subdev format 0x4001, defaulting to RGB encoding" and
> "Unknown subdev format 0x1013, defaulting to RGB encoding" are thrown while using
> simple pipeline handler with NXP ISI hardware.
> The JPEG_1X8 and BGR888_1X24 media bus formats, supported by the ISI driver, are
> missing in the V4L2SubdeviceFormatInfo structure storing the correspondence
> between a media bus format and a colour encoding. So populate the structure with
> the missing media bus formats.
> 
> Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
> ---
>  src/libcamera/v4l2_subdevice.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> index 9ef95963..37cd63c6 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -68,6 +68,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
>  	{ MEDIA_BUS_FMT_RGB565_2X8_LE, { 16, "RGB565_2X8_LE", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_RGB666_1X18, { 18, "RGB666_1X18", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_RGB888_1X24, { 24, "RGB888_1X24", PixelFormatInfo::ColourEncodingRGB } },
> +	{ MEDIA_BUS_FMT_BGR888_1X24, { 24, "BGR888_1X24", PixelFormatInfo::ColourEncodingRGB } },

Let's put BGR before RGB to maintain some kind of ordering :-) I'll
handle this when applying the patch to my tree.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	{ MEDIA_BUS_FMT_RGB888_2X12_BE, { 24, "RGB888_2X12_BE", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_RGB888_2X12_LE, { 24, "RGB888_2X12_LE", PixelFormatInfo::ColourEncodingRGB } },
>  	{ MEDIA_BUS_FMT_ARGB8888_1X32, { 32, "ARGB8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
> @@ -133,6 +134,7 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
>  	{ MEDIA_BUS_FMT_SRGGB12_1X12, { 12, "SRGGB12_1X12", PixelFormatInfo::ColourEncodingRAW } },
>  	/* \todo Clarify colour encoding for HSV formats */
>  	{ MEDIA_BUS_FMT_AHSV8888_1X32, { 32, "AHSV8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
> +	{ MEDIA_BUS_FMT_JPEG_1X8, { 8, "JPEG_1X8", PixelFormatInfo::ColourEncodingYUV } },
>  };
>  
>  } /* namespace */

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index 9ef95963..37cd63c6 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -68,6 +68,7 @@  const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
 	{ MEDIA_BUS_FMT_RGB565_2X8_LE, { 16, "RGB565_2X8_LE", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB666_1X18, { 18, "RGB666_1X18", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB888_1X24, { 24, "RGB888_1X24", PixelFormatInfo::ColourEncodingRGB } },
+	{ MEDIA_BUS_FMT_BGR888_1X24, { 24, "BGR888_1X24", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB888_2X12_BE, { 24, "RGB888_2X12_BE", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_RGB888_2X12_LE, { 24, "RGB888_2X12_LE", PixelFormatInfo::ColourEncodingRGB } },
 	{ MEDIA_BUS_FMT_ARGB8888_1X32, { 32, "ARGB8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
@@ -133,6 +134,7 @@  const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
 	{ MEDIA_BUS_FMT_SRGGB12_1X12, { 12, "SRGGB12_1X12", PixelFormatInfo::ColourEncodingRAW } },
 	/* \todo Clarify colour encoding for HSV formats */
 	{ MEDIA_BUS_FMT_AHSV8888_1X32, { 32, "AHSV8888_1X32", PixelFormatInfo::ColourEncodingRGB } },
+	{ MEDIA_BUS_FMT_JPEG_1X8, { 8, "JPEG_1X8", PixelFormatInfo::ColourEncodingYUV } },
 };
 
 } /* namespace */