libcamera: converter: Add V4L2 request support

Add V4L2 request support to the V4L2M2MConverter class. Extend the
functions related to buffer queuing with an optional request parameter
that gets passed to the lower layers.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
This commit is contained in:
Stefan Klug
2025-11-25 17:28:16 +01:00
parent cdc2620549
commit 041625628c
4 changed files with 18 additions and 7 deletions

View File

@@ -205,11 +205,14 @@ Converter::~Converter()
* \param[in] input The frame buffer to apply the conversion
* \param[out] outputs The container holding the output stream pointers and
* their respective frame buffer outputs.
* \param[in] request An optional request
*
* This function queues the \a input frame buffer on the output streams of the
* \a outputs map key and retrieve the output frame buffer indicated by the
* buffer map value.
*
* If \a request is provided the buffers are tied to that request.
*
* \return 0 on success or a negative error code otherwise
*/

View File

@@ -22,6 +22,7 @@
#include <libcamera/stream.h>
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/v4l2_request.h"
#include "libcamera/internal/v4l2_videodevice.h"
/**
@@ -197,9 +198,11 @@ void V4L2M2MConverter::V4L2M2MStream::stop()
m2m_->output()->releaseBuffers();
}
int V4L2M2MConverter::V4L2M2MStream::queueBuffers(FrameBuffer *input, FrameBuffer *output)
int V4L2M2MConverter::V4L2M2MStream::queueBuffers(FrameBuffer *input,
FrameBuffer *output,
const V4L2Request *request)
{
int ret = m2m_->output()->queueBuffer(input);
int ret = m2m_->output()->queueBuffer(input, request);
if (ret < 0)
return ret;
@@ -696,7 +699,8 @@ int V4L2M2MConverter::validateOutput(StreamConfiguration *cfg, bool *adjusted,
* \copydoc libcamera::Converter::queueBuffers
*/
int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
const std::map<const Stream *, FrameBuffer *> &outputs)
const std::map<const Stream *, FrameBuffer *> &outputs,
const V4L2Request *request)
{
std::set<FrameBuffer *> outputBufs;
int ret;
@@ -721,7 +725,7 @@ int V4L2M2MConverter::queueBuffers(FrameBuffer *input,
/* Queue the input and output buffers to all the streams. */
for (auto [stream, buffer] : outputs) {
ret = streams_.at(stream)->queueBuffers(input, buffer);
ret = streams_.at(stream)->queueBuffers(input, buffer, request);
if (ret < 0)
return ret;
}