[libcamera-devel] [PATCH v3 10/13] pipeline: raspberrypi: Validate MandatoryRequestBuffer in queueRequestDevice()

Naushir Patuck naush at raspberrypi.com
Tue Dec 6 14:54:56 CET 2022


Add some validation in queueRequestDevice() to ensure that a frame buffer is
provided in a Request if the MandatoryRequestBuffer flag has been set in
the StreamConfiguration for every configured stream.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 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 371610be649a..b18e11bb438f 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1162,6 +1162,14 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request)
 			stream->setExternalBuffer(buffer);
 		}
 
+		if (!buffer && (stream->configuration().hints &
+				StreamConfiguration::Hint::MandatoryRequestBuffer)) {
+			LOG(RPI, Error) << "MandatoryRequestBuffer hint set for stream "
+					<< stream->name()
+					<< ", but no request buffer provided";
+			return -EINVAL;
+		}
+
 		/*
 		 * If no buffer is provided by the request for this stream, we
 		 * queue a nullptr to the stream to signify that it must use an
-- 
2.25.1



More information about the libcamera-devel mailing list