[libcamera-devel] [RFC PATCH 01/10] libcamera: framebuffer: Add offset to FrameBuffer::Plane

Hirokazu Honda hiroh at chromium.org
Mon Aug 16 06:31:29 CEST 2021


This adds offset to FrameBuffer::Plane. It enables represents V4L2
multi-planar format and mapping with MappedFrameBuffer.

Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
 include/libcamera/framebuffer.h |  1 +
 src/libcamera/framebuffer.cpp   | 11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h
index 28307890..5de3c744 100644
--- a/include/libcamera/framebuffer.h
+++ b/include/libcamera/framebuffer.h
@@ -42,6 +42,7 @@ class FrameBuffer final : public Extensible
 public:
 	struct Plane {
 		FileDescriptor fd;
+		unsigned int offset;
 		unsigned int length;
 	};
 
diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp
index 42c73134..1d7d5ea3 100644
--- a/src/libcamera/framebuffer.cpp
+++ b/src/libcamera/framebuffer.cpp
@@ -131,7 +131,7 @@ FrameBuffer::Private::Private()
  *
  * The static information describes the memory planes that make a frame. The
  * planes are specified when creating the FrameBuffer and are expressed as a set
- * of dmabuf file descriptors and length.
+ * of dmabuf file descriptors, offset and length.
  *
  * The dynamic information is grouped in a FrameMetadata instance. It is updated
  * during the processing of a queued capture request, and is valid from the
@@ -151,8 +151,8 @@ FrameBuffer::Private::Private()
  *
  * Planar pixel formats use multiple memory regions to store the different
  * colour components of a frame. The Plane structure describes such a memory
- * region by a dmabuf file descriptor and a length. A FrameBuffer then
- * contains one or multiple planes, depending on the pixel format of the
+ * region by a dmabuf file descriptor, an offset and a length. A FrameBuffer
+ * then contains one or multiple planes, depending on the pixel format of the
  * frames it is meant to store.
  *
  * To support DMA access, planes are associated with dmabuf objects represented
@@ -170,6 +170,11 @@ FrameBuffer::Private::Private()
  * \brief The dmabuf file descriptor
  */
 
+/**
+ * \var FrameBuffer::Plane::offset
+ * \brief The plane offset in bytes
+*/
+
 /**
  * \var FrameBuffer::Plane::length
  * \brief The plane length in bytes
-- 
2.33.0.rc1.237.g0d66db33f3-goog



More information about the libcamera-devel mailing list