[libcamera-devel,v2,3/5] libcamera: buffer: Document the BufferPool

Message ID 20190203105517.5355-4-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: Buffer Objects
Related show

Commit Message

Kieran Bingham Feb. 3, 2019, 10:55 a.m. UTC
Add Doxygen documentation for the existing code in the BufferPool class.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 src/libcamera/buffer.cpp | 42 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

Patch

diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index c86847daf193..5abc2a68e978 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -73,6 +73,37 @@  int Buffer::setDmabuf(int fd)
 /**
  * \class BufferPool
  * \brief A pool of buffers
+ *
+ * The BufferPool class groups together a collection of Buffers for passing
+ * between devices. The buffers must be exported by a device before they can be
+ * imported into another device for further use.
+ */
+
+/**
+ * \enum BufferPool::Memory
+ * \brief Identify the memory type used in the BufferPool
+ */
+
+/**
+ * \var BufferPool::Internal
+ * \brief The memory for the Buffers in this pool is allocated internally by the
+ * device associated with the pool
+ */
+
+/**
+ * \var BufferPool::External
+ * \brief The memory for the Buffers in this pool is allocated externally by
+ * another device and can be imported for use by other devices.
+ *
+ * The buffers in the pool have been exported to make them available for sharing
+ * with other devices, and can be managed using their own file descriptors.
+ */
+
+/**
+ * \brief Construct a buffer pool. The \a memory argument declares the intent of
+ * the pool to be either internal or external to a device.
+ *
+ * \sa BufferPool::Memory
  */
 BufferPool::BufferPool(BufferPool::Memory memory)
 	: memory_(memory)
@@ -84,6 +115,9 @@  BufferPool::~BufferPool()
 	free();
 }
 
+/**
+ * \brief Allocate buffers in a pool
+ */
 int BufferPool::allocate(unsigned int count)
 {
 	for (unsigned int i = 0; i < count; ++i) {
@@ -100,6 +134,9 @@  int BufferPool::allocate(unsigned int count)
 	return 0;
 }
 
+/**
+ * \brief Release all buffers from pool.
+ */
 void BufferPool::free()
 {
 	for (Buffer *buffer : buffers_)
@@ -108,4 +145,9 @@  void BufferPool::free()
 	buffers_.clear();
 }
 
+/**
+ * \fn BufferPool::count()
+ * \brief Get the number of Buffers contained within this pool
+ */
+
 } /* namespace libcamera */