csi camera bayer support type.

In drivers\media\platform\tegra\camera\camera_common.c

we can see that

static const struct camera_common_colorfmt camera_common_color_fmts[] = {
	{
		MEDIA_BUS_FMT_SRGGB12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB12,
	},
	{
		MEDIA_BUS_FMT_SRGGB10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB10,
	},
	{
		MEDIA_BUS_FMT_SBGGR10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SBGGR10,
	},
	{
		MEDIA_BUS_FMT_SRGGB8_1X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB8,
	},
	/*
	 * The below two formats are not supported by VI4,
	 * keep them at the last to ensure they get discarded
	 */
	{
		MEDIA_BUS_FMT_XRGGB10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
	{
		MEDIA_BUS_FMT_XBGGR10P_3X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_XRGGB10P,
	},
};

And in Media_bus_format.h we can see

#define MEDIA_BUS_FMT_SBGGR10_1X10		0x3007
#define MEDIA_BUS_FMT_SGBRG10_1X10		0x300e
#define MEDIA_BUS_FMT_SGRBG10_1X10		0x300a
#define MEDIA_BUS_FMT_SRGGB10_1X10		0x300f
#define MEDIA_BUS_FMT_SBGGR12_1X12		0x3008
#define MEDIA_BUS_FMT_SGBRG12_1X12		0x3010
#define MEDIA_BUS_FMT_SGRBG12_1X12		0x3011
#define MEDIA_BUS_FMT_SRGGB12_1X12		0x3012

Our sensor format is MEDIA_BUS_FMT_SBGGR12_1X12, so it could be handled in camera_common.c ? What shall we do to support bggr12 in ISP pipeline ? And so does the monochrome?

Since there is no document on how ISP pipeline using these propertyies, please advice. Thanks.

hello jilternj,

  1. we did handle BGGR12 color format as V4L2 standard.
    please refer to below sources,
$sources/drivers/media/platform/tegra/camera/sensor_common.c

camera_common.c

int camera_common_initialize(struct camera_common_data *s_data,
		const char *dev_name)
{
...
	err = sensor_common_init_sensor_properties(s_data->dev,
						s_data->dev->of_node,
						&s_data->sensor_props);

sensor_common.c

static int sensor_common_parse_image_props(
	struct device *dev, struct device_node *node,
	struct sensor_image_properties *image)
{
...
	err = extract_pixel_format(temp_str, &image->pixel_format);
...
}

static int extract_pixel_format(
	const char *pixel_t, u32 *format)
{
...
	else if (strncmp(pixel_t, "bayer_bggr12", size) == 0)
		*format = <b>V4L2_PIX_FMT_SBGGR12</b>;
...
}
  1. may I have more details about your monochrome sensor?
    for example,
    what’s the color pattern ordering of your monochrome sensor.
    is there a register settings to configure it as monochrome output.

@JerryChang - ad 2) the monochrome sensor has no CFA. All pixels are therefore luma only, which might be noted as YYYY. The generic requirement from ISP is to pass this data as luma only, so no colour matrix nor AWB is executed, and the output format shall be also luma only, to reduce the memory buffer footprint, since the chroma planes are practically constant zeroes. If your ISP has to do some colour conversion, then R=G=B= Y is the formula to use, to promote achromatic input to a full colour pipeline.

As far as MIPI CSI is considered, there is no difference in data format between the RGGB and YYYY formats, since not even the RGGB format has order specific headers to identify one of the four variants of CFA order, and it has to be configured manually on the receiver side. Thus the monochrome uses the same RAW format as the colour one. Well, actually the monochrome was first, so the colour is just its extension, as there are many CFA flavour above the four basic ones.

What is the setting in the ISP override file, to avoid any demosaicing and just pass the data as is, to the output?

Or if your ISP is not able to handle monochrome images and for monochrome imaging, the only usable operational mode is using RAW capture through V4L2?

hello danieel,

for general bayer format sensors, demosaic is needed to generate a view-able image, which was done by ISP hardware.
there’s no configuration to disable demosaic and just pass the data through ISP, you should try to using v4l2 standard to capture RAW files for further development.
thanks

The monochrome sensor has no bayer pattern, the image is achromatic and visible normally after applying a gamma curve to the generally linear raw data coming from the sensor. That is an ISP task. Also AE can be applied to the monochrome operation.

Yes, in sensor_common.c there is V4L2_PIX_FMT_SBGGR12 , but when _set_mt operation happened, it will route to camera_common_s_fmt function, and in this function, it query camera_common_color_fmts, there is no bggr12.

hello danieel,

since NV’s ISP cannot disable demosaic functions, you should consider handling RAW files by your own.

hello jilternj,

you should also add the declaration of the RGGB12 to specify its color space and pixel format.