libcamera
v0.0.0+925-96eaad12
Supporting cameras in Linux since 2019
|
A memory region to store a single plane of a frame. More...
Public Member Functions | |
int | dmabuf () const |
Get the dmabuf file handle backing the buffer. | |
int | setDmabuf (int fd, unsigned int length) |
Set the dmabuf file handle backing the buffer. More... | |
void * | mem () |
Retrieve the CPU accessible memory address of the Plane. More... | |
unsigned int | length () const |
Retrieve the length of the memory region. More... | |
A memory region to store a single plane of a frame.
Planar pixel formats use multiple memory regions to store planes corresponding to the different colour components of a frame. The Plane class tracks the specific details of a memory region used to store a single plane for a given frame and provides the means to access the memory, both for the application and for DMA. A Buffer then contains one or multiple planes depending on its pixel format.
To support DMA access, planes are associated with dmabuf objects represented by file handles. Each plane carries a dmabuf file handle and an offset within the buffer. Those file handles may refer to the same dmabuf object, depending on whether the devices accessing the memory regions composing the image support non-contiguous DMA to planes ore require DMA-contiguous memory.
To support CPU access, planes carry the CPU address of their backing memory. Similarly to the dmabuf file handles, the CPU addresses for planes composing an image may or may not be contiguous.
|
inline |
Retrieve the length of the memory region.
void * libcamera::Plane::mem | ( | ) |
Retrieve the CPU accessible memory address of the Plane.
int libcamera::Plane::setDmabuf | ( | int | fd, |
unsigned int | length | ||
) |
Set the dmabuf file handle backing the buffer.
[in] | fd | The dmabuf file handle |
[in] | length | The size of the memory region |
The fd dmabuf file handle is duplicated and stored. The caller may close the original file handle.