summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-03-01 18:45:29 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-09-30 11:15:29 +0300
commit3ac86ff8bf7e7d0c5857990a2d0a7148b6e48a71 (patch)
treecc44074cceb1784d9a89aeb23f6923a395294edf /src
parent77ee017ed30f64ea33c7e2ccbf8676a30075a717 (diff)
pipeline: raspberrypi: vc4: Fix configuration of the embedded data node
The Unicam embedded data video device suffers from two issues with the upstream driver: - The driver uses the generic metadata V4L2_META_FMT_GENERIC_* formats, instead of the downstream V4L2_META_FMT_SENSOR_DATA. - The driver requires the width and height of the embedded data stream to be configured. Fix them both. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/rpi/vc4/vc4.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
index f55cd4a4..9aa623f9 100644
--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp
+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp
@@ -623,10 +623,25 @@ int Vc4CameraData::platformConfigure(const RPi::RPiCameraConfiguration *rpiConfi
* supports it.
*/
if (sensorMetadata_) {
+ static const std::map<uint32_t, V4L2PixelFormat> metaFormats{
+ { MEDIA_BUS_FMT_META_8, V4L2PixelFormat(V4L2_META_FMT_GENERIC_8) },
+ { MEDIA_BUS_FMT_META_10, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_10) },
+ { MEDIA_BUS_FMT_META_12, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_12) },
+ { MEDIA_BUS_FMT_META_14, V4L2PixelFormat(V4L2_META_FMT_GENERIC_CSI2_14) },
+ };
+
V4L2SubdeviceFormat embeddedFormat = sensor_->embeddedDataFormat();
+ const auto metaFormat = metaFormats.find(embeddedFormat.code);
+ if (metaFormat == metaFormats.end()) {
+ LOG(RPI, Error)
+ << "Unsupported metadata format "
+ << utils::hex(embeddedFormat.code, 4);
+ return -EINVAL;
+ }
+
V4L2DeviceFormat format{};
- format.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA);
- format.planes[0].size = embeddedFormat.size.width * embeddedFormat.size.height;
+ format.fourcc = metaFormat->second;
+ format.size = embeddedFormat.size;
LOG(RPI, Debug) << "Setting embedded data format " << format;
ret = unicam_[Unicam::Embedded].dev()->setFormat(&format);