Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New pixel format support for pisp #5714

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions drivers/media/platform/raspberrypi/pisp_be/pisp_be_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,24 @@ static const struct pisp_be_format supported_formats[] = {
.colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB,
.colorspace_default = V4L2_COLORSPACE_SRGB,
},
{
.fourcc = V4L2_PIX_FMT_RGB48,
.align = 64,
.bit_depth = 48,
.plane_factor = { P3(1.0) },
.num_planes = 1,
.colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB,
.colorspace_default = V4L2_COLORSPACE_SRGB,
},
{
.fourcc = V4L2_PIX_FMT_BGR48,
.align = 64,
.bit_depth = 48,
.plane_factor = { P3(1.0) },
.num_planes = 1,
.colorspace_mask = V4L2_COLORSPACE_MASK_ALL_SRGB,
.colorspace_default = V4L2_COLORSPACE_SRGB,
},
/* Bayer formats - 8-bit */
{
.fourcc = V4L2_PIX_FMT_SRGGB8,
Expand Down Expand Up @@ -457,6 +475,33 @@ static const struct pisp_be_format supported_formats[] = {
.colorspace_mask = V4L2_COLORSPACE_MASK_RAW,
.colorspace_default = V4L2_COLORSPACE_RAW,
},
/* Greyscale Formats */
{
.fourcc = V4L2_PIX_FMT_GREY,
.bit_depth = 8,
.align = 32,
.num_planes = 1,
.colorspace_mask = V4L2_COLORSPACE_MASK_RAW,
.colorspace_default = V4L2_COLORSPACE_RAW,
},
{
.fourcc = V4L2_PIX_FMT_Y16,
.bit_depth = 16,
.align = 32,
.plane_factor = { P3(1.0) },
.num_planes = 1,
.colorspace_mask = V4L2_COLORSPACE_MASK_RAW,
.colorspace_default = V4L2_COLORSPACE_RAW,
},
{
.fourcc = V4L2_PIX_FMT_PISP_COMP1_MONO,
.bit_depth = 8,
.align = 32,
.plane_factor = { P3(1.0) },
.num_planes = 1,
.colorspace_mask = V4L2_COLORSPACE_MASK_RAW,
.colorspace_default = V4L2_COLORSPACE_RAW,
},
/* Opaque BE format for HW verification. */
{
.fourcc = V4L2_PIX_FMT_RPI_BE,
Expand Down
14 changes: 10 additions & 4 deletions drivers/media/platform/raspberrypi/rp1_cfe/cfe_fmts.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,28 +249,34 @@ static const struct cfe_fmt formats[] = {
.code = MEDIA_BUS_FMT_Y10_1X10,
.depth = 10,
.csi_dt = 0x2b,
.remap = { V4L2_PIX_FMT_Y16 },
.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
},
{
.fourcc = V4L2_PIX_FMT_Y12P,
.code = MEDIA_BUS_FMT_Y12_1X12,
.depth = 12,
.csi_dt = 0x2c,
.remap = { V4L2_PIX_FMT_Y16 },
.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
},
{
.fourcc = V4L2_PIX_FMT_Y14P,
.code = MEDIA_BUS_FMT_Y14_1X14,
.depth = 14,
.csi_dt = 0x2d,
.remap = { V4L2_PIX_FMT_Y16 },
.remap = { V4L2_PIX_FMT_Y16, V4L2_PIX_FMT_PISP_COMP1_MONO },
},
{
.fourcc = V4L2_PIX_FMT_Y16,
.code = MEDIA_BUS_FMT_Y16_1X16,
.depth = 16,
.flags = CFE_FORMAT_FLAG_FE_OUT,
},

{
.fourcc = V4L2_PIX_FMT_PISP_COMP1_MONO,
.code = MEDIA_BUS_FMT_Y16_1X16,
.depth = 8,
.flags = CFE_FORMAT_FLAG_FE_OUT,
},
/* Embedded data format */
{
.fourcc = V4L2_META_FMT_SENSOR_DATA,
Expand Down
8 changes: 6 additions & 2 deletions drivers/media/v4l2-core/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_BGRX32: descr = "32-bit XBGR 8-8-8-8"; break;
case V4L2_PIX_FMT_RGBA32: descr = "32-bit RGBA 8-8-8-8"; break;
case V4L2_PIX_FMT_RGBX32: descr = "32-bit RGBX 8-8-8-8"; break;
case V4L2_PIX_FMT_BGR48: descr = "48-bit BGR 16-16-16"; break;
case V4L2_PIX_FMT_RGB48: descr = "48-bit RGB 16-16-16"; break;
case V4L2_PIX_FMT_GREY: descr = "8-bit Greyscale"; break;
case V4L2_PIX_FMT_Y4: descr = "4-bit Greyscale"; break;
case V4L2_PIX_FMT_Y6: descr = "6-bit Greyscale"; break;
Expand Down Expand Up @@ -1510,11 +1512,13 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_PISP_COMP1_RGGB:
case V4L2_PIX_FMT_PISP_COMP1_GRBG:
case V4L2_PIX_FMT_PISP_COMP1_GBRG:
case V4L2_PIX_FMT_PISP_COMP1_BGGR: descr = "PiSP Bayer Comp 1"; break;
case V4L2_PIX_FMT_PISP_COMP1_BGGR:
case V4L2_PIX_FMT_PISP_COMP1_MONO: descr = "PiSP Bayer Comp 1"; break;
case V4L2_PIX_FMT_PISP_COMP2_RGGB:
case V4L2_PIX_FMT_PISP_COMP2_GRBG:
case V4L2_PIX_FMT_PISP_COMP2_GBRG:
case V4L2_PIX_FMT_PISP_COMP2_BGGR: descr = "PiSP Bayer Comp 2"; break;
case V4L2_PIX_FMT_PISP_COMP2_BGGR:
case V4L2_PIX_FMT_PISP_COMP2_MONO: descr = "PiSP Bayer Comp 2"; break;
default:
if (fmt->description[0])
return;
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/media-bus-format.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#define MEDIA_BUS_FMT_YUYV12_2X12 0x201e
#define MEDIA_BUS_FMT_YVYU12_2X12 0x201f
#define MEDIA_BUS_FMT_Y14_1X14 0x202d
#define MEDIA_BUS_FMT_Y16_1X16 0x202e
#define MEDIA_BUS_FMT_UYVY8_1X16 0x200f
#define MEDIA_BUS_FMT_VYUY8_1X16 0x2010
#define MEDIA_BUS_FMT_YUYV8_1X16 0x2011
Expand Down
6 changes: 6 additions & 0 deletions include/uapi/linux/videodev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_ARGB32 v4l2_fourcc('B', 'A', '2', '4') /* 32 ARGB-8-8-8-8 */
#define V4L2_PIX_FMT_XRGB32 v4l2_fourcc('B', 'X', '2', '4') /* 32 XRGB-8-8-8-8 */

/* RGB formats (6 bytes per pixel) */
#define V4L2_PIX_FMT_BGR48 v4l2_fourcc('B', 'G', 'R', '6') /* 16 BGR-16-16-16 */
#define V4L2_PIX_FMT_RGB48 v4l2_fourcc('R', 'G', 'B', '6') /* 16 RGB-16-16-16 */

/* Grey formats */
#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
Expand Down Expand Up @@ -799,10 +803,12 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_PISP_COMP1_GRBG v4l2_fourcc('P', 'C', '1', 'G')
#define V4L2_PIX_FMT_PISP_COMP1_GBRG v4l2_fourcc('P', 'C', '1', 'g')
#define V4L2_PIX_FMT_PISP_COMP1_BGGR v4l2_fourcc('P', 'C', '1', 'B')
#define V4L2_PIX_FMT_PISP_COMP1_MONO v4l2_fourcc('P', 'C', '1', 'M')
#define V4L2_PIX_FMT_PISP_COMP2_RGGB v4l2_fourcc('P', 'C', '2', 'R')
#define V4L2_PIX_FMT_PISP_COMP2_GRBG v4l2_fourcc('P', 'C', '2', 'G')
#define V4L2_PIX_FMT_PISP_COMP2_GBRG v4l2_fourcc('P', 'C', '2', 'g')
#define V4L2_PIX_FMT_PISP_COMP2_BGGR v4l2_fourcc('P', 'C', '2', 'B')
#define V4L2_PIX_FMT_PISP_COMP2_MONO v4l2_fourcc('P', 'C', '2', 'M')

/* SDR formats - used only for Software Defined Radio devices */
#define V4L2_SDR_FMT_CU8 v4l2_fourcc('C', 'U', '0', '8') /* IQ u8 */
Expand Down