libcamera  v0.4.0
Supporting cameras in Linux since 2019
Public Member Functions | Public Attributes | Friends | List of all members
libcamera::Request::Private Class Reference

Request private data. More...

Inheritance diagram for libcamera::Request::Private:
Inheritance graph
[legend]
Collaboration diagram for libcamera::Request::Private:
Collaboration graph
[legend]

Public Member Functions

 Private (Camera *camera)
 Create a Request::Private. More...
 
Cameracamera () const
 Retrieve the camera this request has been queued to. More...
 
bool hasPendingBuffers () const
 Check if a request has buffers yet to be completed. More...
 
bool completeBuffer (FrameBuffer *buffer)
 Complete a buffer for the request. More...
 
void complete ()
 Complete a queued request. More...
 
void cancel ()
 Cancel a queued request. More...
 
void reset ()
 Reset the request internal data to default values. More...
 
void prepare (std::chrono::milliseconds timeout=0ms)
 Prepare the Request to be queued to the device. More...
 
- Public Member Functions inherited from libcamera::Extensible::Private
 Private ()
 Construct an instance of an Extensible class private data.
 

Public Attributes

Signal prepared
 Request preparation completed Signal. More...
 

Friends

class PipelineHandler
 
std::ostream & operator<< (std::ostream &out, const Request &r)
 Insert a text representation of a Request into an output stream. More...
 

Detailed Description

Request private data.

The Request::Private class stores all private data associated with a request. It implements the d-pointer design pattern to hide core Request data from the public API, and exposes utility functions to internal users of the request (namely the PipelineHandler class and its subclasses).

Constructor & Destructor Documentation

◆ Private()

libcamera::Request::Private::Private ( Camera camera)

Create a Request::Private.

Parameters
cameraThe Camera that creates the request

Member Function Documentation

◆ camera()

libcamera::Request::Private::camera ( ) const
inline

Retrieve the camera this request has been queued to.

Returns
The Camera this request has been queued to, or nullptr if the request hasn't been queued

◆ cancel()

void libcamera::Request::Private::cancel ( )

Cancel a queued request.

Mark the request and its associated buffers as cancelled and complete it.

Set each pending buffer in error state and emit the buffer completion signal before completing the Request.

◆ complete()

void libcamera::Request::Private::complete ( )

Complete a queued request.

Mark the request as complete by updating its status to RequestComplete, unless buffers have been cancelled in which case the status is set to RequestCancelled.

◆ completeBuffer()

bool libcamera::Request::Private::completeBuffer ( FrameBuffer buffer)

Complete a buffer for the request.

Parameters
[in]bufferThe buffer that has completed

A request tracks the status of all buffers it contains through a set of pending buffers. This function removes the buffer from the set to mark it as complete. All buffers associate with the request shall be marked as complete by calling this function once and once only before reporting the request as complete with the complete() function.

Returns
True if all buffers contained in the request have completed, false otherwise

◆ hasPendingBuffers()

bool libcamera::Request::Private::hasPendingBuffers ( ) const

Check if a request has buffers yet to be completed.

Returns
True if the request has buffers pending for completion, false otherwise

◆ prepare()

void libcamera::Request::Private::prepare ( std::chrono::milliseconds  timeout = 0ms)

Prepare the Request to be queued to the device.

Parameters
[in]timeoutOptional expiration timeout

Prepare a Request to be queued to the hardware device by ensuring it is ready for the incoming memory transfers.

This currently means waiting on each frame buffer acquire fence to be signalled. An optional expiration timeout can be specified. If not all the fences have been signalled correctly before the timeout expires the Request is cancelled.

The function immediately emits the prepared signal if all the prepare operations have been completed synchronously. If instead the prepare operations require to wait the completion of asynchronous events, such as fences notifications or timer expiration, the prepared signal is emitted upon the asynchronous event completion.

As we currently only handle fences, the function emits the prepared signal immediately if there are no fences to wait on. Otherwise the prepared signal is emitted when all fences have been signalled or the optional timeout has expired.

If not all the fences have been correctly signalled or the optional timeout has expired the Request will be cancelled and the Request::prepared signal emitted.

The intended user of this function is the PipelineHandler base class, which 'prepares' a Request before queuing it to the hardware device.

◆ reset()

void libcamera::Request::Private::reset ( )

Reset the request internal data to default values.

After calling this function, all request internal data will have default values as if the Request::Private instance had just been constructed.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const Request r 
)
friend

Insert a text representation of a Request into an output stream.

Parameters
[in]outThe output stream
[in]rThe Request
Returns
The output stream out

Member Data Documentation

◆ prepared

libcamera::Request::Private::prepared

Request preparation completed Signal.

The signal is emitted once the request preparation has completed and is ready to be queued. The Request might complete with errors in which case it is cancelled.

The intended slot for this signal is the PipelineHandler::doQueueRequests() function which queues Request after they have been prepared or cancel them if they have failed preparing.


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