libcamera v0.7.2
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
libcamera::FrameBuffer Class Reference

Frame buffer data and its associated dynamic metadata. More...

Classes

struct  Plane
 A memory region to store a single plane of a frame. More...

Public Member Functions

 FrameBuffer (Span< const Plane > planes, unsigned int cookie=0)
 Construct a FrameBuffer with an array of planes.
 FrameBuffer (std::unique_ptr< Private > d)
 Construct a FrameBuffer with an extensible private class.
Span< const Planeplanes () const
 Retrieve the static plane descriptors.
Requestrequest () const
 Retrieve the request this buffer belongs to.
const FrameMetadatametadata () const
 Retrieve the dynamic metadata.
uint64_t cookie () const
 Retrieve the cookie.
void setCookie (uint64_t cookie)
 Set the cookie.
std::unique_ptr< FencereleaseFence ()
 Extract the Fence associated with this Framebuffer.

Detailed Description

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.

Constructor & Destructor Documentation

◆ FrameBuffer() [1/2]

libcamera::FrameBuffer::FrameBuffer ( Span< const Plane > planes,
unsigned int cookie = 0 )

Construct a FrameBuffer with an array of planes.

Parameters
[in]planesThe frame memory planes
[in]cookieCookie

◆ FrameBuffer() [2/2]

libcamera::FrameBuffer::FrameBuffer ( std::unique_ptr< Private > d)

Construct a FrameBuffer with an extensible private class.

Parameters
[in]dThe extensible private class

Member Function Documentation

◆ cookie()

uint64_t libcamera::FrameBuffer::cookie ( ) const

Retrieve the cookie.

See also
setCookie()
Returns
The cookie

◆ metadata()

const FrameMetadata & libcamera::FrameBuffer::metadata ( ) const

Retrieve the dynamic metadata.

Returns
Dynamic metadata for the frame contained in the buffer

◆ planes()

Span< const FrameBuffer::Plane > libcamera::FrameBuffer::planes ( ) const

Retrieve the static plane descriptors.

Returns
Array of plane descriptors

◆ releaseFence()

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.

Returns
A unique pointer to the Fence if set, or nullptr if the fence has been released already

◆ request()

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.

Returns
The Request the FrameBuffer belongs to, or nullptr if the buffer is not associated with a request

◆ setCookie()

void libcamera::FrameBuffer::setCookie ( uint64_t cookie)

Set the cookie.

Parameters
[in]cookieCookie to set

The creator (and only the creator) of the FrameBuffer may store an arbitrary 64-bit integer value in the FrameBuffer, this value is called the cookie. It may be retrieved or set at any time, and is guaranteed not to be modified by the libcamera core. This mechanism is similar to the Request cookie.

An application using a FrameBufferAllocator is considered to be the creator of the allocated FrameBuffer objects, and thus it may manage the cookie as it sees fit.

See also
cookie()

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