summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHarvey Yang <chenghaoyang@chromium.org>2024-10-22 07:43:37 +0000
committerKieran Bingham <kieran.bingham@ideasonboard.com>2024-11-20 10:47:27 +0000
commit168488275aacc804ffd264187dca8b3e48b21d9e (patch)
tree70094c4cd01544c9de672885a18a0f3344e79c84 /include
parent83c5ad0facdbd0173da2bb9ac0f0adc74c3db5ba (diff)
libcamera: add DmaBufAllocator::exportBuffers()
Add a helper function exportBuffers in DmaBufAllocator to make it easier to use. It'll be used in Virtual Pipeline Handler and SoftwareIsp. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/dma_buf_allocator.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/libcamera/internal/dma_buf_allocator.h b/include/libcamera/internal/dma_buf_allocator.h
index d2a0a0d1..9211d483 100644
--- a/include/libcamera/internal/dma_buf_allocator.h
+++ b/include/libcamera/internal/dma_buf_allocator.h
@@ -7,11 +7,17 @@
#pragma once
+#include <memory>
+#include <string>
+#include <vector>
+
#include <libcamera/base/flags.h>
#include <libcamera/base/unique_fd.h>
namespace libcamera {
+class FrameBuffer;
+
class DmaBufAllocator
{
public:
@@ -28,7 +34,14 @@ public:
bool isValid() const { return providerHandle_.isValid(); }
UniqueFD alloc(const char *name, std::size_t size);
+ int exportBuffers(unsigned int count,
+ const std::vector<unsigned int> &planeSizes,
+ std::vector<std::unique_ptr<FrameBuffer>> *buffers);
+
private:
+ std::unique_ptr<FrameBuffer> createBuffer(
+ std::string name, const std::vector<unsigned int> &planeSizes);
+
UniqueFD allocFromHeap(const char *name, std::size_t size);
UniqueFD allocFromUDmaBuf(const char *name, std::size_t size);
UniqueFD providerHandle_;