[libcamera-devel] [PATCH 3/3] libcamera: raspberrypi: Fail on dmaHeaps_ open error

Jacopo Mondi jacopo at jmondi.org
Thu Aug 27 10:20:38 CEST 2020


Provide an RPiCameraData::init() method where the dmaHeaps_ member
is opened.

This allows to fail earlier in case the allocator fails to open.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 42c9caa03e2e..38da45607d4b 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -291,6 +291,7 @@ public:
 	{
 	}
 
+	int init();
 	void frameStarted(uint32_t sequence);
 
 	int loadIPA();
@@ -904,6 +905,8 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator)
 		return false;
 
 	std::unique_ptr<RPiCameraData> data = std::make_unique<RPiCameraData>(this);
+	if (data->init())
+		return false;
 
 	/* Locate and open the unicam video streams. */
 	data->unicam_[Unicam::Embedded] = RPiStream("Unicam Embedded", unicam_->getEntityByName("unicam-embedded"));
@@ -1084,6 +1087,11 @@ void PipelineHandlerRPi::freeBuffers(Camera *camera)
 		stream->releaseBuffers();
 }
 
+int RPiCameraData::init()
+{
+	return dmaHeap_.open();
+}
+
 void RPiCameraData::frameStarted(uint32_t sequence)
 {
 	LOG(RPI, Debug) << "frame start " << sequence;
-- 
2.28.0



More information about the libcamera-devel mailing list