libcamera::IPAContextWrapper Class Referencefinal

Wrap an ipa_context and expose it as an IPAInterface. More...

Inheritance diagram for libcamera::IPAContextWrapper:

## Public Member Functions

| IPAContextWrapper (struct ipa_context *context)
| Construct an IPAContextWrapper instance that wraps the context. More...
int | init (const IPASettings &settings) override
| Initialise the IPAInterface. More...
int | start () override
| Start the IPA. More...
void | stop () override
| Stop the IPA. More...
void | configure (const CameraSensorInfo &sensorInfo, const std::map< unsigned int, IPAStream > &streamConfig, const std::map< unsigned int, const ControlInfoMap & > &entityControls) override
| Configure the IPA stream and sensor settings. More...
void | mapBuffers (const std::vector< IPABuffer > &buffers) override
| Map buffers shared between the pipeline handler and the IPA. More...
void | unmapBuffers (const std::vector< unsigned int > &ids) override
| Unmap buffers shared by the pipeline to the IPA. More...
virtual void | processEvent (const IPAOperationData &data) override
| Process an event from the pipeline handler. More...

## Additional Inherited Members

Public Attributes inherited from libcamera::IPAInterface
Signal< unsigned int, const IPAOperationData & > | queueFrameAction
| Queue an action associated with a frame to the pipeline handler. More...

## Detailed Description

Wrap an ipa_context and expose it as an IPAInterface.

The IPAContextWrapper class wraps an ipa_context, provided by an IPA module, and exposes an IPAInterface. This mechanism is used for IPAs that are not isolated in a separate process to allow direct calls from pipeline handler using the IPAInterface API instead of the lower-level ipa_context API.

The IPAInterface methods are converted to the ipa_context API by translating all C++ arguments into plain C structures or byte arrays that contain no pointer, as required by the ipa_context API.

## Constructor & Destructor Documentation

## IPAContextWrapper()

libcamera::IPAContextWrapper::IPAContextWrapper | ( | struct ipa_context * | context | ) |

Construct an IPAContextWrapper instance that wraps the context.

Parameters

  [in] | context | The IPA module context

Ownership of the context is passed to the IPAContextWrapper. The context remains valid for the whole lifetime of the wrapper and is destroyed automatically with it.

## Member Function Documentation

## configure()

void libcamera::IPAContextWrapper::configure | ( | const CameraSensorInfo & | sensorInfo,
|  | const std::map< unsigned int, IPAStream > & | streamConfig,
|  | const std::map< unsigned int, const ControlInfoMap & > & | entityControls
| ) |  |

override virtual

Configure the IPA stream and sensor settings.

Parameters

  [in] | sensorInfo | Camera sensor information
  [in] | streamConfig | Configuration of all active streams
  [in] | entityControls | Controls provided by the pipeline entities

This method shall be called when the camera is started to inform the IPA of the camera's streams and the sensor settings. The meaning of the numerical keys in the streamConfig and entityControls maps is defined by the IPA protocol.

The sensorInfo conveys information about the camera sensor settings that the pipeline handler has selected for the configuration. The IPA may use that information to tune its algorithms.

Implements libcamera::IPAInterface.

## init()

int libcamera::IPAContextWrapper::init | ( | const IPASettings & | settings | ) |

override virtual

Initialise the IPAInterface.

Parameters

  [in] | settings | The IPA initialization settings

This function initializes the IPA interface. It shall be called before any other function of the IPAInterface. The settings carry initialization parameters that are valid for the whole life time of the IPA interface.

Implements libcamera::IPAInterface.

## mapBuffers()

void libcamera::IPAContextWrapper::mapBuffers | ( | const std::vector< IPABuffer > & | buffers | ) |

override virtual

Map buffers shared between the pipeline handler and the IPA.

Parameters

  [in] | buffers | List of buffers to map

This method informs the IPA module of memory buffers set up by the pipeline handler that the IPA needs to access. It provides dmabuf file handles for each buffer, and associates the buffers with unique numerical IDs.

IPAs shall map the dmabuf file handles to their address space and keep a cache of the mappings, indexed by the buffer numerical IDs. The IDs are used in all other IPA interface methods to refer to buffers, including the unmapBuffers() method.

All buffers that the pipeline handler wishes to share with an IPA shall be mapped with this method. Buffers may be mapped all at once with a single call, or mapped and unmapped dynamically at runtime, depending on the IPA protocol. Regardless of the protocol, all buffers mapped at a given time shall have unique numerical IDs.

The numerical IDs have no meaning defined by the IPA interface, and IPA protocols shall not give them any specific meaning either. They should be treated as opaque handles by IPAs, with the only exception that ID zero is invalid.

See also
  unmapBuffers()

Todo:
  Provide a generic implementation of mapBuffers and unmapBuffers for IPAs

Implements libcamera::IPAInterface.

## processEvent()

void libcamera::IPAContextWrapper::processEvent | ( | const IPAOperationData & | data | ) |

override virtual

Process an event from the pipeline handler.

Parameters

  [in] | data | IPA operation data

This operation is used by pipeline handlers to inform the IPA module of events that occurred during the on-going capture operation.

The event notified by the pipeline handler with this method is handled by the IPA, which interprets the operation parameters according to the separately documented IPA protocol.

Implements libcamera::IPAInterface.

## start()

int libcamera::IPAContextWrapper::start | ( |  | ) |

override virtual

Start the IPA.

This method informs the IPA module that the camera is about to be started. The IPA module shall prepare any resources it needs to operate.

Returns
  0 on success or a negative error code otherwise

Implements libcamera::IPAInterface.

## stop()

void libcamera::IPAContextWrapper::stop | ( |  | ) |

override virtual

Stop the IPA.

This method informs the IPA module that the camera is stopped. The IPA module shall release resources prepared in start().

Implements libcamera::IPAInterface.

## unmapBuffers()

void libcamera::IPAContextWrapper::unmapBuffers | ( | const std::vector< unsigned int > & | ids | ) |

override virtual

Unmap buffers shared by the pipeline to the IPA.

Parameters

  [in] | ids | List of buffer IDs to unmap

This method removes mappings set up with mapBuffers(). Buffers may be unmapped all at once with a single call, or selectively at runtime, depending on the IPA protocol. Numerical IDs of unmapped buffers may be reused when mapping new buffers.

See also
  mapBuffers()

Implements libcamera::IPAInterface.

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

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