libcamera
v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
|
Provide an interface to support managing memory mapped buffers. More...
Public Types | |
using | Plane = Span< uint8_t > |
A mapped region of memory accessible to the CPU. More... | |
Public Member Functions | |
MappedBuffer (MappedBuffer &&other) | |
Move constructor, construct the MappedBuffer with the contents of other using move semantics. More... | |
MappedBuffer & | operator= (MappedBuffer &&other) |
Move assignment operator, replace the mappings with those of other. More... | |
bool | isValid () const |
Check if the MappedBuffer instance is valid. More... | |
int | error () const |
Retrieve the map error status. More... | |
const std::vector< Plane > & | planes () const |
Retrieve the mapped planes. More... | |
Protected Member Functions | |
MappedBuffer () | |
Construct an empty MappedBuffer. | |
Protected Attributes | |
int | error_ |
Stores the error value if present. More... | |
std::vector< Plane > | planes_ |
Stores the internal mapped planes. More... | |
std::vector< Plane > | maps_ |
Stores the mapped buffer. More... | |
Provide an interface to support managing memory mapped buffers.
The MappedBuffer interface provides access to a set of MappedPlanes which are available for access by the CPU.
This class is not meant to be constructed directly, but instead derived classes should be used to implement the correct mapping of a source buffer.
This allows treating CPU accessible memory through a generic interface regardless of whether it originates from a libcamera FrameBuffer or other source.
A mapped region of memory accessible to the CPU.
The MappedBuffer::Plane uses the Span interface to describe the mapped memory region.
libcamera::MappedBuffer::MappedBuffer | ( | MappedBuffer && | other | ) |
Move constructor, construct the MappedBuffer with the contents of other using move semantics.
[in] | other | The other MappedBuffer |
Moving a MappedBuffer moves the mappings contained in the other to the new MappedBuffer and invalidates the other.
No mappings are unmapped or destroyed in this process.
|
inline |
Retrieve the map error status.
This function retrieves the error status from the MappedBuffer. The error status is a negative number as defined by errno.h. If no error occurred, this function returns 0.
|
inline |
Check if the MappedBuffer instance is valid.
MappedBuffer & libcamera::MappedBuffer::operator= | ( | MappedBuffer && | other | ) |
Move assignment operator, replace the mappings with those of other.
[in] | other | The other MappedBuffer |
Moving a MappedBuffer moves the mappings contained in the other to the new MappedBuffer and invalidates the other.
No mappings are unmapped or destroyed in this process.
|
inline |
Retrieve the mapped planes.
This function retrieves the successfully mapped planes stored as a vector of Span<uint8_t> to provide access to the mapped memory.
|
protected |
Stores the error value if present.
MappedBuffer derived classes shall set this to a negative value as defined by errno.h if an error occured during the mapping process.
|
protected |
Stores the mapped buffer.
MappedBuffer derived classes shall store the mappings they create in this vector which is parsed during destruct to unmap any memory mappings which completed successfully.
|
protected |
Stores the internal mapped planes.
MappedBuffer derived classes shall store the mappings they create in this vector which points the beginning of mapped plane addresses.