diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2019-01-24 17:35:21 +0000 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-02-06 06:49:29 +0200 |
commit | 771befc6dc0e55f4c94c949b54bba6821740aff7 (patch) | |
tree | 262fd0125c7f69c203008b6b8539cfece210611a /src/libcamera/include | |
parent | 93ec63b8673b786065df815ab7035891cfc3a56c (diff) |
libcamera: v4l2_device: Request buffers from the device
Provide an exportBuffers() function which allocates buffers with the MMAP
method, exports them using the dmabuf API and populates the given BufferPool.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/include')
-rw-r--r-- | src/libcamera/include/v4l2_device.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index 87cde10d..510b74f1 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -8,11 +8,16 @@ #define __LIBCAMERA_V4L2_DEVICE_H__ #include <string> +#include <vector> #include <linux/videodev2.h> namespace libcamera { +class Buffer; +class BufferPool; +class MediaEntity; + struct V4L2Capability final : v4l2_capability { const char *driver() const { @@ -67,7 +72,6 @@ public: unsigned int planesCount; }; -class MediaEntity; class V4L2Device { public: @@ -89,6 +93,9 @@ public: int getFormat(V4L2DeviceFormat *format); int setFormat(V4L2DeviceFormat *format); + int exportBuffers(unsigned int count, BufferPool *pool); + int releaseBuffers(); + private: int getFormatSingleplane(V4L2DeviceFormat *format); int setFormatSingleplane(V4L2DeviceFormat *format); @@ -96,10 +103,18 @@ private: int getFormatMultiplane(V4L2DeviceFormat *format); int setFormatMultiplane(V4L2DeviceFormat *format); + int requestBuffers(unsigned int count); + int createPlane(Buffer *buffer, unsigned int plane, + unsigned int length); + std::string deviceNode_; int fd_; V4L2Capability caps_; + enum v4l2_buf_type bufferType_; + enum v4l2_memory memoryType_; + + BufferPool *bufferPool_; }; } /* namespace libcamera */ |