From fdf1851f0b5f4d31bb61ce63726dcee6d6e647fa Mon Sep 17 00:00:00 2001 From: Kieran Bingham Date: Fri, 6 Aug 2021 13:18:01 +0100 Subject: libcamera: MappedFrameBuffer: Use typed Flags Remove the need for callers to reference PROT_READ/PROT_WRITE directly from by instead exposing the Read/Write mapping options as flags from the MappedFrameBuffer class itself. While here, introduce the header which is required for the uint8_t as part of the Plane. Reviewed-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham --- include/libcamera/internal/mapped_framebuffer.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h index 41e58736..3401a9fc 100644 --- a/include/libcamera/internal/mapped_framebuffer.h +++ b/include/libcamera/internal/mapped_framebuffer.h @@ -7,10 +7,11 @@ #ifndef __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__ #define __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__ -#include +#include #include #include +#include #include #include @@ -44,9 +45,19 @@ private: class MappedFrameBuffer : public MappedBuffer { public: - MappedFrameBuffer(const FrameBuffer *buffer, int flags); + enum class MapFlag { + Read = 1 << 0, + Write = 1 << 1, + ReadWrite = Read | Write, + }; + + using MapFlags = Flags; + + MappedFrameBuffer(const FrameBuffer *buffer, MapFlags flags); }; +LIBCAMERA_FLAGS_ENABLE_OPERATORS(MappedFrameBuffer::MapFlag) + } /* namespace libcamera */ #endif /* __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__ */ -- cgit v1.2.1