libcamera: libcamera::FrameBuffer::Private Class Reference

libcamera v0.7.1 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
libcamera::FrameBuffer::Private Class Reference

Base class for FrameBuffer private data. More...

Inheritance diagram for libcamera::FrameBuffer::Private:
[legend]
Collaboration diagram for libcamera::FrameBuffer::Private:
[legend]

## Public Member Functions
| Private (Span< const Plane > planes, uint64_t cookie=0)
| Construct a FrameBuffer::Private instance.
virtual | ~Private ()
| FrameBuffer::Private destructor.
void | setRequest (Request *request)
| Set the request this buffer belongs to.
bool | isContiguous () const
| Check if the frame buffer stores planes contiguously in memory.
Fence * | fence () const
| Retrieve a const pointer to the Fence.
void | setFence (std::unique_ptr< Fence > fence)
| Move a fence in this buffer.
void | cancel ()
| Marks the buffer as cancelled.
FrameMetadata & | metadata ()
| Retrieve the dynamic metadata.
Public Member Functions inherited from libcamera::Extensible::Private
| Private ()
| Construct an instance of an Extensible class private data.

## Detailed Description

Base class for FrameBuffer private data.

The FrameBuffer::Private class stores all private data associated with a framebuffer. It implements the d-pointer design pattern to hide core FrameBuffer data from the public API, and exposes utility functions to pipeline handlers.

## Constructor & Destructor Documentation

## ◆ Private()

libcamera::FrameBuffer::Private::Private | ( | Span< const Plane > | planes,
|  | uint64_t | cookie = 0 )

Construct a FrameBuffer::Private instance.

Parameters

  [in] | planes | The frame memory planes
  [in] | cookie | Cookie

## ◆ ~Private()

libcamera::FrameBuffer::Private::~Private | ( |  | ) |
| virtual

FrameBuffer::Private destructor.

Reimplemented from libcamera::Extensible::Private.

## Member Function Documentation

## ◆ cancel()

void libcamera::FrameBuffer::Private::cancel | ( |  | ) |
| inline

Marks the buffer as cancelled.

If a buffer is not used by a request, it shall be marked as cancelled to indicate that the metadata is invalid.

## ◆ fence()

Fence * libcamera::FrameBuffer::Private::fence | ( |  | ) | const
| inline

Retrieve a const pointer to the Fence.

This function does only return a reference to the the fence and does not change its ownership. The fence is stored in the FrameBuffer and can only be reset with FrameBuffer::releaseFence() in case the buffer has completed with error due to a Fence wait failure.

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.

See also
  Request::addBuffer()

Returns
  A const pointer to the Fence if any, nullptr otherwise

## ◆ isContiguous()

bool libcamera::FrameBuffer::Private::isContiguous | ( |  | ) | const
| inline

Check if the frame buffer stores planes contiguously in memory.

Multi-planar frame buffers can store their planes contiguously in memory, or split them into discontiguous memory areas. This function checks in which of these two categories the frame buffer belongs.

Returns
  True if the planes are stored contiguously in memory, false otherwise

## ◆ metadata()

FrameMetadata & libcamera::FrameBuffer::Private::metadata | ( |  | ) |
| inline

Retrieve the dynamic metadata.

Returns
  Dynamic metadata for the frame contained in the buffer

## ◆ setFence()

void libcamera::FrameBuffer::Private::setFence | ( | std::unique_ptr< Fence > | fence | ) |
| inline

Move a fence in this buffer.

Parameters

  [in] | fence | The Fence

This function associates a Fence with this Framebuffer. The intended caller is the Request::addBuffer() function.

Once a FrameBuffer is associated with a Fence, the FrameBuffer will only be made available to the hardware device once the Fence has been correctly signalled.

See also
  Request::prepare()

If the FrameBuffer completes successfully the core releases the Fence and the Buffer can be reused immediately. If handling of the Fence fails during the request preparation, the Fence is not released and is left in the FrameBuffer. It is applications responsibility to correctly release the fence and handle it opportunely before using the buffer again.

## ◆ setRequest()

void libcamera::FrameBuffer::Private::setRequest | ( | Request * | request | ) |
| inline

Set the request this buffer belongs to.

Parameters

  [in] | request | Request to set

For buffers added to requests by applications, this function is called by Request::addBuffer() or Request::reuse(). For buffers internal to pipeline handlers, it is called by the pipeline handlers themselves.

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

- include/libcamera/internal/framebuffer.h
- src/libcamera/framebuffer.cpp