@@ -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 */
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(+)