libcamera  v0.0.0+925-96eaad12
Supporting cameras in Linux since 2019
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
libcamera::Plane Class Referencefinal

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...
 

Detailed Description

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.

Member Function Documentation

◆ length()

libcamera::Plane::length ( ) const
inline

Retrieve the length of the memory region.

Returns
The length of the memory region

◆ mem()

void * libcamera::Plane::mem ( )

Retrieve the CPU accessible memory address of the Plane.

Returns
The CPU accessible memory address on success or nullptr otherwise.

◆ setDmabuf()

int libcamera::Plane::setDmabuf ( int  fd,
unsigned int  length 
)

Set the dmabuf file handle backing the buffer.

Parameters
[in]fdThe dmabuf file handle
[in]lengthThe size of the memory region

The fd dmabuf file handle is duplicated and stored. The caller may close the original file handle.

Returns
0 on success or a negative error code otherwise

The documentation for this class was generated from the following files: