libcamera: converter_v4l2_m2m: Add suport for V4L2 requests

To actually use requests with the m2m device, requests need to be
allocated on the underlying media device. This can only be done if the
media device is opened which means acquiring it. Add a function to check
if the m2m device supports requests by acquiring the media device,
asking it and then releasing it again. Also add a function to allocate
requests that acquires the internal media device and releases it after
allocating the requests.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Stefan Klug
2025-11-25 17:28:17 +01:00
parent 041625628c
commit 6d8109f4f1
2 changed files with 40 additions and 1 deletions

View File

@@ -73,6 +73,11 @@ public:
std::pair<Rectangle, Rectangle> inputCropBounds() override { return inputCropBounds_; }
std::pair<Rectangle, Rectangle> inputCropBounds(const Stream *stream) override;
int allocateRequests(unsigned int count,
std::vector<std::unique_ptr<V4L2Request>> *requests);
bool supportsRequests();
private:
class V4L2M2MStream : protected Loggable
{
@@ -122,6 +127,8 @@ private:
std::map<const Stream *, std::unique_ptr<V4L2M2MStream>> streams_;
std::map<FrameBuffer *, unsigned int> queue_;
std::pair<Rectangle, Rectangle> inputCropBounds_;
std::shared_ptr<MediaDevice> media_;
};
} /* namespace libcamera */