[libcamera-devel,v4,09/12] pipeline: raspberrypi: Validate MandatoryRequestBuffer in queueRequestDevice()
diff mbox series

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

Commit Message

Naushir Patuck Dec. 9, 2022, 9 a.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 45e66839efb9..2c2b79fa021d 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1152,6 +1152,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