[libcamera-devel,v3,10/13] pipeline: raspberrypi: Validate MandatoryRequestBuffer in queueRequestDevice()
diff mbox series

Message ID 20221206135459.25521-11-naush@raspberrypi.com
State Superseded
Headers show
Series
  • Raspberry Pi: Platform configuration and buffer allocation improvements
Related show

Commit Message

Naushir Patuck Dec. 6, 2022, 1:54 p.m. UTC
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@raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

Patch
diff mbox series

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