[PATCH/RFC,24/32] pipeline: raspberrypi: common: Configure sensor embedded data
diff mbox series

Message ID 20240301212121.9072-25-laurent.pinchart@ideasonboard.com
State RFC
Headers show
Series
  • libcamera: Support the upstream Unicam driver
Related show

Commit Message

Laurent Pinchart March 1, 2024, 9:21 p.m. UTC
Now that the CameraSensor class implements support for embedded data,
use the corresponding API to enable or disable the embedded data stream.

This changes requires sensor kernel drivers that implement the upstream
embedded data API based on V4L2 streams. As the API is under development
and not merged in the upstream kernel yet, this breaks compatibility
with the downstream Raspberry Pi kernel.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
index d662c8f12145..9a2b8b90d5af 100644
--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp
@@ -527,6 +527,18 @@  int PipelineHandlerBase::configure(Camera *camera, CameraConfiguration *config)
 	if (ret)
 		return ret;
 
+	/*
+	 * Configure embedded data on the sensor. Only check for errors when
+	 * enabling embedded data, as some sensors don't support disabling it,
+	 * and Unicam will simply drop the embedded data packets if we don't
+	 * capture them.
+	 */
+	ret = data->sensor_->setEmbeddedDataEnabled(data->sensorMetadata_);
+	if (ret && data->sensorMetadata_) {
+		LOG(RPI, Error) << "Unable to enable embedded data: " << ret;
+		return ret;
+	}
+
 	/*
 	 * Platform specific internal stream configuration. This also assigns
 	 * external streams which get configured below.