[v2,3/3] libcamera: formats: Add NV12MT_COL128 8/10-bit pixel formats
diff mbox series

Message ID 20260629094216.747340-4-naush@raspberrypi.com
State New
Headers show
Series
  • Add NV12MT_COL128 8/10-bit pixel formats
Related show

Commit Message

Naushir Patuck June 29, 2026, 8:36 a.m. UTC
Add the NV12MT_COL128 (NV12 8-bit) and NV12MT_10_COL128 (P030 10-bit)
column layout pixel formats available from the PiSP Backend hardware.

Map the matching V4L2 FourCCs to the libcamera::formats conversion table.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
---
 src/libcamera/formats.cpp          | 20 ++++++++++++++++++++
 src/libcamera/formats.yaml         |  6 ++++++
 src/libcamera/v4l2_pixelformat.cpp |  4 ++++
 3 files changed, 30 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index bfcdfc08960d..c407802ea135 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -366,6 +366,26 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.pixelsPerGroup = 2,
 		.planes = {{ { 2, 1 }, { 2, 2 }, { 0, 0 } }},
 	} },
+	{ formats::NV12MT_COL128, {
+		.name = "NV12MT_COL128",
+		.format = formats::NV12MT_COL128,
+		.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_NV12MT_COL128), },
+		.bitsPerPixel = 12,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = false,
+		.pixelsPerGroup = 2,
+		.planes = {{ { 2, 1 }, { 2, 2 }, { 0, 0 } }},
+	} },
+	{ formats::NV12MT_10_COL128, {
+		.name = "NV12MT_10_COL128",
+		.format = formats::NV12MT_10_COL128,
+		.v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_NV12MT_10_COL128), },
+		.bitsPerPixel = 15,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = true,
+		.pixelsPerGroup = 6,
+		.planes = {{ { 8, 1 }, { 8, 2 }, { 0, 0 } }},
+	} },
 	{ formats::NV21, {
 		.name = "NV21",
 		.format = formats::NV21,
diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
index 2d54d391ca01..3bf010c47aa6 100644
--- a/src/libcamera/formats.yaml
+++ b/src/libcamera/formats.yaml
@@ -73,6 +73,12 @@  formats:
       fourcc: DRM_FORMAT_NV24
   - NV42:
       fourcc: DRM_FORMAT_NV42
+  - NV12MT_COL128:
+      fourcc: DRM_FORMAT_NV12
+      mod: DRM_FORMAT_MOD_BROADCOM_SAND128
+  - NV12MT_10_COL128:
+      fourcc: DRM_FORMAT_P030
+      mod: DRM_FORMAT_MOD_BROADCOM_SAND128
 
   - YUV420:
       fourcc: DRM_FORMAT_YUV420
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index e8b3eb9c1394..bfd662b0de47 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -103,6 +103,10 @@  const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
 		{ formats::NV12, "Y/CbCr 4:2:0" } },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_NV12M),
 		{ formats::NV12, "Y/CbCr 4:2:0 (N-C)" } },
+	{ V4L2PixelFormat(V4L2_PIX_FMT_NV12MT_COL128),
+		{ formats::NV12MT_COL128, "Y/CbCr 4:2:0 (128 col)" } },
+	{ V4L2PixelFormat(V4L2_PIX_FMT_NV12MT_10_COL128),
+		{ formats::NV12MT_10_COL128, "10-bit Y/CbCr 4:2:0 (128 col)" } },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_NV21),
 		{ formats::NV21, "Y/CrCb 4:2:0" } },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_NV21M),