[RFC PATCH 2/4] libcamera: internal: Allow to limit the number of queued requests
Sven Püschel
s.pueschel at pengutronix.de
Tue May 27 17:46:48 CEST 2025
Hi Stefan,
On 5/26/25 23:42, Stefan Klug wrote:
> Allow pipeline handler classes to limit the maximum number of requests that
> get queued using queueRequestDevice().
>
> Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
> ---
> include/libcamera/internal/pipeline_handler.h | 5 +++++
> src/libcamera/pipeline_handler.cpp | 3 +++
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
> index dedc29e815fb..86b86d5971dc 100644
> --- a/include/libcamera/internal/pipeline_handler.h
> +++ b/include/libcamera/internal/pipeline_handler.h
> @@ -79,6 +79,11 @@ protected:
> virtual bool acquireDevice(Camera *camera);
> virtual void releaseDevice(Camera *camera);
>
> + virtual unsigned int maxQueuedRequestsDevice() const
> + {
> + return std::numeric_limits<unsigned int>::max();
> + }
> +
is there a benefit of having a virtual function instead of a variable
(initialized to max by default and potentially changed in the subclass
constructors)?
> CameraManager *manager_;
>
> private:
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index 14d8602e67d8..1853bca71371 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -490,6 +490,9 @@ void PipelineHandler::doQueueRequests()
>
> Camera::Private *data = camera->_d();
> while (!data->waitingRequests_.empty()) {
> + if (data->queuedRequests_.size() == maxQueuedRequestsDevice())
> + break;
> +
> Request *request = data->waitingRequests_.front();
> if (!request->_d()->prepared_)
> break;
More information about the libcamera-devel
mailing list