| Message ID | 20251023144841.403689-7-stefan.klug@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Stefan Klug (2025-10-23 23:48:07) > 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> Looks good to me. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> > --- > include/libcamera/internal/converter.h | 4 +++- > .../internal/converter/converter_v4l2_m2m.h | 6 ++++-- > src/libcamera/converter.cpp | 3 +++ > src/libcamera/converter/converter_v4l2_m2m.cpp | 12 ++++++++---- > 4 files changed, 18 insertions(+), 7 deletions(-) > > diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h > index 4915af7ac5de..4b811686fcf6 100644 > --- a/include/libcamera/internal/converter.h > +++ b/include/libcamera/internal/converter.h > @@ -22,6 +22,7 @@ > #include <libcamera/base/signal.h> > > #include <libcamera/geometry.h> > +#include "libcamera/internal/v4l2_request.h" > > namespace libcamera { > > @@ -79,7 +80,8 @@ public: > virtual void stop() = 0; > > virtual int queueBuffers(FrameBuffer *input, > - const std::map<const Stream *, FrameBuffer *> &outputs) = 0; > + const std::map<const Stream *, FrameBuffer *> &outputs, > + const V4L2Request *request = nullptr) = 0; > > virtual int setInputCrop(const Stream *stream, Rectangle *rect) = 0; > virtual std::pair<Rectangle, Rectangle> inputCropBounds() = 0; > diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h > index d316754040dd..1b2a88c4a608 100644 > --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h > +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h > @@ -66,7 +66,8 @@ public: > Alignment align = Alignment::Down) override; > > int queueBuffers(FrameBuffer *input, > - const std::map<const Stream *, FrameBuffer *> &outputs) override; > + const std::map<const Stream *, FrameBuffer *> &outputs, > + const V4L2Request *request = nullptr) override; > > int setInputCrop(const Stream *stream, Rectangle *rect) override; > std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; } > @@ -88,7 +89,8 @@ private: > int start(); > void stop(); > > - int queueBuffers(FrameBuffer *input, FrameBuffer *output); > + int queueBuffers(FrameBuffer *input, FrameBuffer *output, > + const V4L2Request *request = nullptr); > > int setInputSelection(unsigned int target, Rectangle *rect); > int getInputSelection(unsigned int target, Rectangle *rect); > diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp > index 142fb29a1272..ec0a6db6c035 100644 > --- a/src/libcamera/converter.cpp > +++ b/src/libcamera/converter.cpp > @@ -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 > */ > > diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp > index b2bd54f368d8..ff11a9735db7 100644 > --- a/src/libcamera/converter/converter_v4l2_m2m.cpp > +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp > @@ -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; > } > -- > 2.48.1 >
Hi Stefan, Thank you for the patch! Quoting Stefan Klug (2025-10-23 15:48:07) > 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: Isaac Scott <isaac.scott@ideasonboard.com> > --- > include/libcamera/internal/converter.h | 4 +++- > .../internal/converter/converter_v4l2_m2m.h | 6 ++++-- > src/libcamera/converter.cpp | 3 +++ > src/libcamera/converter/converter_v4l2_m2m.cpp | 12 ++++++++---- > 4 files changed, 18 insertions(+), 7 deletions(-) > > diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h > index 4915af7ac5de..4b811686fcf6 100644 > --- a/include/libcamera/internal/converter.h > +++ b/include/libcamera/internal/converter.h > @@ -22,6 +22,7 @@ > #include <libcamera/base/signal.h> > > #include <libcamera/geometry.h> > +#include "libcamera/internal/v4l2_request.h" > > namespace libcamera { > > @@ -79,7 +80,8 @@ public: > virtual void stop() = 0; > > virtual int queueBuffers(FrameBuffer *input, > - const std::map<const Stream *, FrameBuffer *> &outputs) = 0; > + const std::map<const Stream *, FrameBuffer *> &outputs, > + const V4L2Request *request = nullptr) = 0; > > virtual int setInputCrop(const Stream *stream, Rectangle *rect) = 0; > virtual std::pair<Rectangle, Rectangle> inputCropBounds() = 0; > diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h > index d316754040dd..1b2a88c4a608 100644 > --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h > +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h > @@ -66,7 +66,8 @@ public: > Alignment align = Alignment::Down) override; > > int queueBuffers(FrameBuffer *input, > - const std::map<const Stream *, FrameBuffer *> &outputs) override; > + const std::map<const Stream *, FrameBuffer *> &outputs, > + const V4L2Request *request = nullptr) override; > > int setInputCrop(const Stream *stream, Rectangle *rect) override; > std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; } > @@ -88,7 +89,8 @@ private: > int start(); > void stop(); > > - int queueBuffers(FrameBuffer *input, FrameBuffer *output); > + int queueBuffers(FrameBuffer *input, FrameBuffer *output, > + const V4L2Request *request = nullptr); > > int setInputSelection(unsigned int target, Rectangle *rect); > int getInputSelection(unsigned int target, Rectangle *rect); > diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp > index 142fb29a1272..ec0a6db6c035 100644 > --- a/src/libcamera/converter.cpp > +++ b/src/libcamera/converter.cpp > @@ -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 > */ > > diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp > index b2bd54f368d8..ff11a9735db7 100644 > --- a/src/libcamera/converter/converter_v4l2_m2m.cpp > +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp > @@ -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; > } > -- > 2.48.1 >
diff --git a/include/libcamera/internal/converter.h b/include/libcamera/internal/converter.h index 4915af7ac5de..4b811686fcf6 100644 --- a/include/libcamera/internal/converter.h +++ b/include/libcamera/internal/converter.h @@ -22,6 +22,7 @@ #include <libcamera/base/signal.h> #include <libcamera/geometry.h> +#include "libcamera/internal/v4l2_request.h" namespace libcamera { @@ -79,7 +80,8 @@ public: virtual void stop() = 0; virtual int queueBuffers(FrameBuffer *input, - const std::map<const Stream *, FrameBuffer *> &outputs) = 0; + const std::map<const Stream *, FrameBuffer *> &outputs, + const V4L2Request *request = nullptr) = 0; virtual int setInputCrop(const Stream *stream, Rectangle *rect) = 0; virtual std::pair<Rectangle, Rectangle> inputCropBounds() = 0; diff --git a/include/libcamera/internal/converter/converter_v4l2_m2m.h b/include/libcamera/internal/converter/converter_v4l2_m2m.h index d316754040dd..1b2a88c4a608 100644 --- a/include/libcamera/internal/converter/converter_v4l2_m2m.h +++ b/include/libcamera/internal/converter/converter_v4l2_m2m.h @@ -66,7 +66,8 @@ public: Alignment align = Alignment::Down) override; int queueBuffers(FrameBuffer *input, - const std::map<const Stream *, FrameBuffer *> &outputs) override; + const std::map<const Stream *, FrameBuffer *> &outputs, + const V4L2Request *request = nullptr) override; int setInputCrop(const Stream *stream, Rectangle *rect) override; std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; } @@ -88,7 +89,8 @@ private: int start(); void stop(); - int queueBuffers(FrameBuffer *input, FrameBuffer *output); + int queueBuffers(FrameBuffer *input, FrameBuffer *output, + const V4L2Request *request = nullptr); int setInputSelection(unsigned int target, Rectangle *rect); int getInputSelection(unsigned int target, Rectangle *rect); diff --git a/src/libcamera/converter.cpp b/src/libcamera/converter.cpp index 142fb29a1272..ec0a6db6c035 100644 --- a/src/libcamera/converter.cpp +++ b/src/libcamera/converter.cpp @@ -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 */ diff --git a/src/libcamera/converter/converter_v4l2_m2m.cpp b/src/libcamera/converter/converter_v4l2_m2m.cpp index b2bd54f368d8..ff11a9735db7 100644 --- a/src/libcamera/converter/converter_v4l2_m2m.cpp +++ b/src/libcamera/converter/converter_v4l2_m2m.cpp @@ -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; }
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> --- include/libcamera/internal/converter.h | 4 +++- .../internal/converter/converter_v4l2_m2m.h | 6 ++++-- src/libcamera/converter.cpp | 3 +++ src/libcamera/converter/converter_v4l2_m2m.cpp | 12 ++++++++---- 4 files changed, 18 insertions(+), 7 deletions(-)