drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h
Extension
.h
Size
14630 bytes
Lines
520
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pisp_be_format {
	unsigned int fourcc;
	unsigned int align;
	unsigned int bit_depth;
	/* 0P3 factor for plane sizing */
	unsigned int plane_factor[PISPBE_MAX_PLANES];
	unsigned int num_planes;
	unsigned int colorspace_mask;
	enum v4l2_colorspace colorspace_default;
};

#define V4L2_COLORSPACE_MASK(colorspace) BIT(colorspace)

#define V4L2_COLORSPACE_MASK_JPEG	\
	V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_JPEG)
#define V4L2_COLORSPACE_MASK_SMPTE170M	\
	V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_SMPTE170M)
#define V4L2_COLORSPACE_MASK_REC709	\
	V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_REC709)
#define V4L2_COLORSPACE_MASK_SRGB	\
	V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_SRGB)
#define V4L2_COLORSPACE_MASK_RAW	\
	V4L2_COLORSPACE_MASK(V4L2_COLORSPACE_RAW)

/*
 * All three colour spaces SRGB, SMPTE170M and REC709 are fundamentally sRGB
 * underneath (as near as makes no difference to us), just with different YCbCr
 * encodings. Therefore the ISP can generate sRGB on its main output and any of
 * the others on its low resolution output. Applications should, when using both
 * outputs, program the colour spaces on them to be the same, matching whatever
 * is requested for the low resolution output, even if the main output is
 * producing an RGB format. In turn this requires us to allow all these colour
 * spaces for every YUV/RGB output format.
 */
#define V4L2_COLORSPACE_MASK_ALL_SRGB (V4L2_COLORSPACE_MASK_JPEG	| \
				       V4L2_COLORSPACE_MASK_SRGB	| \
				       V4L2_COLORSPACE_MASK_SMPTE170M	| \
				       V4L2_COLORSPACE_MASK_REC709)

static const struct pisp_be_format supported_formats[] = {
	/* Single plane YUV formats */
	{
		.fourcc		    = V4L2_PIX_FMT_YUV420,
		/* 128 alignment to ensure U/V planes are 64 byte aligned. */
		.align		    = 128,
		.bit_depth	    = 8,
		.plane_factor	    = { P3(1), P3(0.25), P3(0.25) },
		.num_planes	    = 1,
		.colorspace_mask    = V4L2_COLORSPACE_MASK_ALL_SRGB,
		.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
	},
	{
		.fourcc		    = V4L2_PIX_FMT_YVU420,
		/* 128 alignment to ensure U/V planes are 64 byte aligned. */
		.align		    = 128,
		.bit_depth	    = 8,
		.plane_factor	    = { P3(1), P3(0.25), P3(0.25) },
		.num_planes	    = 1,
		.colorspace_mask    = V4L2_COLORSPACE_MASK_ALL_SRGB,
		.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
	},
	{
		.fourcc		    = V4L2_PIX_FMT_NV12,
		.align		    = 32,
		.bit_depth	    = 8,
		.plane_factor	    = { P3(1), P3(0.5) },
		.num_planes	    = 1,
		.colorspace_mask    = V4L2_COLORSPACE_MASK_ALL_SRGB,
		.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
	},
	{
		.fourcc		    = V4L2_PIX_FMT_NV21,
		.align		    = 32,
		.bit_depth	    = 8,
		.plane_factor	    = { P3(1), P3(0.5) },
		.num_planes	    = 1,
		.colorspace_mask    = V4L2_COLORSPACE_MASK_ALL_SRGB,
		.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
	},
	{
		.fourcc		    = V4L2_PIX_FMT_YUYV,
		.align		    = 64,
		.bit_depth	    = 16,
		.plane_factor	    = { P3(1) },
		.num_planes	    = 1,
		.colorspace_mask    = V4L2_COLORSPACE_MASK_ALL_SRGB,
		.colorspace_default = V4L2_COLORSPACE_SMPTE170M,
	},
	{
		.fourcc		    = V4L2_PIX_FMT_UYVY,

Annotation

Implementation Notes