libcamera
v0.4.0
Supporting cameras in Linux since 2019
|
Frame buffer data and its associated dynamic metadata. More...
Classes | |
struct | Plane |
A memory region to store a single plane of a frame. More... | |
class | Private |
Base class for FrameBuffer private data. More... | |
Public Member Functions | |
FrameBuffer (const std::vector< Plane > &planes, unsigned int cookie=0) | |
Construct a FrameBuffer with an array of planes. More... | |
FrameBuffer (std::unique_ptr< Private > d) | |
Construct a FrameBuffer with an extensible private class. More... | |
const std::vector< Plane > & | planes () const |
Retrieve the static plane descriptors. More... | |
Request * | request () const |
Retrieve the request this buffer belongs to. More... | |
const FrameMetadata & | metadata () const |
Retrieve the dynamic metadata. More... | |
uint64_t | cookie () const |
Retrieve the cookie. More... | |
void | setCookie (uint64_t cookie) |
Set the cookie. More... | |
std::unique_ptr< Fence > | releaseFence () |
Extract the Fence associated with this Framebuffer. More... | |
Public Member Functions inherited from libcamera::Extensible | |
Extensible (std::unique_ptr< Private > d) | |
Construct an instance of an Extensible class. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from libcamera::Extensible | |
template<typename T > | |
const T * | _d () const |
Retrieve the private data instance. More... | |
template<typename T > | |
T * | _d () |
Retrieve the private data instance. More... | |
Frame buffer data and its associated dynamic metadata.
The FrameBuffer class is the primary interface for applications, IPAs and pipeline handlers to interact with frame memory. It contains all the static and dynamic information to manage the whole life cycle of a frame capture, from buffer creation to consumption.
The static information describes the memory planes that make a frame. The planes are specified when creating the FrameBuffer and are expressed as a set of dmabuf file descriptors, offset and length.
The dynamic information is grouped in a FrameMetadata instance. It is updated during the processing of a queued capture request, and is valid from the completion of the buffer as signaled by Camera::bufferComplete() until the FrameBuffer is either reused in a new request or deleted.
The creator of a FrameBuffer (application, IPA or pipeline handler) may associate to it an integer cookie for any private purpose. The cookie may be set when creating the FrameBuffer, and updated at any time with setCookie(). The cookie is transparent to the libcamera core and shall only be set by the creator of the FrameBuffer. This mechanism supplements the Request cookie.
libcamera::FrameBuffer::FrameBuffer | ( | const std::vector< Plane > & | planes, |
unsigned int | cookie = 0 |
||
) |
Construct a FrameBuffer with an array of planes.
[in] | planes | The frame memory planes |
[in] | cookie | Cookie |
libcamera::FrameBuffer::FrameBuffer | ( | std::unique_ptr< Private > | d | ) |
Construct a FrameBuffer with an extensible private class.
[in] | d | The extensible private class |
uint64_t libcamera::FrameBuffer::cookie | ( | ) | const |
Retrieve the cookie.
The cookie belongs to the creator of the FrameBuffer, which controls its lifetime and value.
const FrameMetadata & libcamera::FrameBuffer::metadata | ( | ) | const |
Retrieve the dynamic metadata.
const std::vector< FrameBuffer::Plane > & libcamera::FrameBuffer::planes | ( | ) | const |
Retrieve the static plane descriptors.
std::unique_ptr< Fence > libcamera::FrameBuffer::releaseFence | ( | ) |
Extract the Fence associated with this Framebuffer.
This function moves the buffer's fence ownership to the caller. After the fence has been released, calling this function always return nullptr.
If buffer with a Fence completes with errors due to a failure in handling the fence, applications are responsible for releasing the Fence before calling Request::addBuffer() again.
Request * libcamera::FrameBuffer::request | ( | ) | const |
Retrieve the request this buffer belongs to.
The intended callers of this function are buffer completion handlers that need to associate a buffer to the request it belongs to.
A FrameBuffer is associated to a request by Request::addBuffer() and the association is valid until the buffer completes. The returned request pointer is valid only during that interval.
void libcamera::FrameBuffer::setCookie | ( | uint64_t | cookie | ) |
Set the cookie.
[in] | cookie | Cookie to set |
The cookie belongs to the creator of the FrameBuffer. Its value may be modified at any time with this function. Applications and IPAs shall not modify the cookie value of buffers they haven't created themselves. The libcamera core never modifies the buffer cookie.