[v6,12/14] libcamera: mali-c55: Enable links between resizer and video node
diff mbox series

Message ID 20241115101334.453104-13-dan.scally@ideasonboard.com
State Accepted
Headers show
Series
  • Miscellaneous Mali-C55 Pipeline Fixes
Related show

Commit Message

Dan Scally Nov. 15, 2024, 10:13 a.m. UTC
The mali-c55 driver now expects links to video devices to be enabled
in order for those devices to be streamed from / to. Enable the media
link between the resizers and their associated video device to fulfil
the requirement.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
Changes in v6:

	- Used MediaDevice::link() to find and cache the links in MaliC55Pipe,
	  which simplies their enablement in ::configure()

Changes in v5:

	- None

 src/libcamera/pipeline/mali-c55/mali-c55.cpp | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
index e973abc2..c0206ea2 100644
--- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp
+++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp
@@ -509,6 +509,7 @@  private:
 	struct MaliC55Pipe {
 		std::unique_ptr<V4L2Subdevice> resizer;
 		std::unique_ptr<V4L2VideoDevice> cap;
+		MediaLink *link;
 		Stream *stream;
 	};
 
@@ -835,6 +836,17 @@  int PipelineHandlerMaliC55::configure(Camera *camera,
 		Stream *stream = streamConfig.stream();
 		MaliC55Pipe *pipe = pipeFromStream(data, stream);
 
+		/*
+		 * Enable the media link between the pipe's resizer and the
+		 * capture video device
+		 */
+
+		ret = pipe->link->setEnabled(true);
+		if (ret) {
+			LOG(MaliC55, Error) << "Couldn't enable resizer's link";
+			return ret;
+		}
+
 		if (isFormatRaw(streamConfig.pixelFormat))
 			ret = configureRawStream(data, streamConfig, subdevFormat);
 		else
@@ -1028,6 +1040,12 @@  bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)
 	if (frPipe->cap->open() < 0)
 		return false;
 
+	frPipe->link = media_->link("mali-c55 resizer fr", 1, "mali-c55 fr", 0);
+	if (!frPipe->link) {
+		LOG(MaliC55, Error) << "No link between fr resizer and video node";
+		return false;
+	}
+
 	frPipe->cap->bufferReady.connect(this, &PipelineHandlerMaliC55::imageBufferReady);
 
 	dsFitted_ = !!media_->getEntityByName("mali-c55 ds");
@@ -1044,6 +1062,13 @@  bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)
 		if (dsPipe->cap->open() < 0)
 			return false;
 
+		dsPipe->link = media_->link("mali-c55 resizer ds", 1,
+					    "mali-c55 ds", 0);
+		if (!dsPipe->link) {
+			LOG(MaliC55, Error) << "No link between ds resizer and video node";
+			return false;
+		}
+
 		dsPipe->cap->bufferReady.connect(this, &PipelineHandlerMaliC55::imageBufferReady);
 	}