summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorUmang Jain <umang.jain@ideasonboard.com>2021-06-22 13:02:08 +0530
committerUmang Jain <umang.jain@ideasonboard.com>2021-06-28 14:12:06 +0530
commitdaf1cf0c737bdee9e42a9aaf64af997609a90951 (patch)
treeb6c8c29b07c36eb9b7053f5d253a1fb6747591ab /include
parentaaed11a3dc55d8fb0a4702bffef1e9f80a562b3b (diff)
src: Import MappedBuffer class from libcamera
This libcamera internal class, needs to be imported from libcamera code base, in order to have standalone ipu3-ipa build. Other libcamera components required by ipu3-ipa, will be linked through libcamera_platform.so in subsequent commit. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera-helpers/mapped_buffer.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/include/libcamera-helpers/mapped_buffer.h b/include/libcamera-helpers/mapped_buffer.h
new file mode 100644
index 0000000..b34a70c
--- /dev/null
+++ b/include/libcamera-helpers/mapped_buffer.h
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2020, Google Inc.
+ *
+ * buffer.h - Internal buffer handling
+ */
+#ifndef __LIBCAMERA_MAPPED_BUFFER_H__
+#define __LIBCAMERA_MAPPED_BUFFER_H__
+
+#include <sys/mman.h>
+#include <vector>
+
+#include <libcamera/base/class.h>
+#include <libcamera/base/span.h>
+
+#include <libcamera/buffer.h>
+
+namespace libcamera {
+
+class MappedBuffer
+{
+public:
+ using Plane = Span<uint8_t>;
+
+ ~MappedBuffer();
+
+ MappedBuffer(MappedBuffer &&other);
+ MappedBuffer &operator=(MappedBuffer &&other);
+
+ bool isValid() const { return error_ == 0; }
+ int error() const { return error_; }
+ const std::vector<Plane> &maps() const { return maps_; }
+
+protected:
+ MappedBuffer();
+
+ int error_;
+ std::vector<Plane> maps_;
+
+private:
+ LIBCAMERA_DISABLE_COPY(MappedBuffer)
+};
+
+class MappedFrameBuffer : public MappedBuffer
+{
+public:
+ MappedFrameBuffer(const FrameBuffer *buffer, int flags);
+};
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_MAPPED_BUFFER_H__ */
+