summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-10-15 15:16:56 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-10-18 09:53:59 +0100
commitf4999536b4f75eef1a489936b0c9795fdc234574 (patch)
tree85341cd5a8869f108ac5306b0ae4f5f3e747a6d7 /include
parent2c8c967d725f56940a6c8f7e23930fed58ccf083 (diff)
libcamera-helpers: Integrate latest MappedFrameBuffer
The MappedFrameBuffer helper class has been updated in the libcamera source code. This makes use of the new enum MapFlags type, and corrects the mapping changes that were made during 8708904fad6f ("libcamera: mapped_framebuffer: Return plane begin address by MappedBuffer::maps()") This update also brings back isolated IPA functionality to this external IPA, which is otherwise broken due to the offset/plane changes. The files are renamed to mapped_framebuffer to match the naming in libcamera, but are kept within the 'libcamera-helper' hierarchy of the IPA. Also, a minor todo is added to IPAIPU3::mapBuffers, to highlight that we could potentially map Statistics buffers as read only rather than read/write if we could correctly identify them. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera-helpers/mapped_buffer.h53
-rw-r--r--include/libcamera-helpers/mapped_framebuffer.h65
2 files changed, 65 insertions, 53 deletions
diff --git a/include/libcamera-helpers/mapped_buffer.h b/include/libcamera-helpers/mapped_buffer.h
deleted file mode 100644
index 6cfc572..0000000
--- a/include/libcamera-helpers/mapped_buffer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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/framebuffer.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__ */
-
diff --git a/include/libcamera-helpers/mapped_framebuffer.h b/include/libcamera-helpers/mapped_framebuffer.h
new file mode 100644
index 0000000..4215527
--- /dev/null
+++ b/include/libcamera-helpers/mapped_framebuffer.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2021, Google Inc.
+ *
+ * mapped_framebuffer.h - Frame buffer memory mapping support
+ */
+#ifndef __LIBCAMERA_HELPER_MAPPED_FRAMEBUFFER_H__
+#define __LIBCAMERA_HELPER_MAPPED_FRAMEBUFFER_H__
+
+#include <stdint.h>
+#include <vector>
+
+#include <libcamera/base/class.h>
+#include <libcamera/base/flags.h>
+#include <libcamera/base/span.h>
+
+#include <libcamera/framebuffer.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_; }
+ /* \todo rename to planes(). */
+ const std::vector<Plane> &maps() const { return planes_; }
+
+protected:
+ MappedBuffer();
+
+ int error_;
+ std::vector<Plane> planes_;
+ std::vector<Plane> maps_;
+
+private:
+ LIBCAMERA_DISABLE_COPY(MappedBuffer)
+};
+
+class MappedFrameBuffer : public MappedBuffer
+{
+public:
+ enum class MapFlag {
+ Read = 1 << 0,
+ Write = 1 << 1,
+ ReadWrite = Read | Write,
+ };
+
+ using MapFlags = Flags<MapFlag>;
+
+ MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags);
+};
+
+LIBCAMERA_FLAGS_ENABLE_OPERATORS(MappedFrameBuffer::MapFlag)
+
+} /* namespace libcamera */
+
+#endif /* __LIBCAMERA_HELPER_MAPPED_FRAMEBUFFER_H__ */