[v3,0/2] Add environment variable to order pipelines match
mbox series

Message ID 20240327172731.434048-1-julien.vuillaumier@nxp.com
Headers show
Series
  • Add environment variable to order pipelines match
Related show

Message

Julien Vuillaumier March 27, 2024, 5:27 p.m. UTC
Hi All,

This is the v3 of the change to support the configuration of the order
of pipelines match, by using an environment variable.

v3:
- PipelineHandlerFactoryBase::getFactoryByName() unnecessary 'else' removed.
- CameraManager::pipelineFactoryMatch() declaration moved to match the
  position of the method definition.
- Add to env variable documentation the information about how the pipeline
  handlers names are defined in the source - also breaked long line at 80
  characters.
- Fix and complement commit messages.
- Fix and complement source comments.

v2:
- Add 'get factory by name' helper to PipelineHandlerFactoryBase as a
  preceding patch
- Move lamba pipeMatch() to a private class function
- Remove unnecessary string empty test
- Inline lamba nameMatch
- Update comments and variable names per v1 reviews 

Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2024-March/040859.html

Thanks


There is currently no way to configure the order used by the CameraManager
to select the pipeline handlers to match devices from the DeviceEnumerator.
That is a limitation when multiple pipeline are compiled in, capable of
handling the devices of the platform. In that case, user can not specify
the pipeline that will bind to the devices and handle the cameras.

This change adds an environment variable, optionnaly initialized with an
ordered list of candidate pipelines that CameraManager shall use to match
the devices. When the variable is not set, CameraManager behavior is
unchanged: every registered pipeline is selected in turn to attempt device
matching. 

Using that variable, user has the option to explicitly select the pipeline
or the subset of available pipelines that CameraManager shall consider
for matching.

Julien Vuillaumier (2):
  libcamera: pipeline: Add a get factory by name helper
  libcamera: camera_manager: Add environment variable to order pipelines
    match

 Documentation/environment_variables.rst       |  8 +++
 include/libcamera/internal/camera_manager.h   |  1 +
 include/libcamera/internal/pipeline_handler.h |  1 +
 src/libcamera/camera_manager.cpp              | 53 ++++++++++++++-----
 src/libcamera/pipeline_handler.cpp            | 22 ++++++++
 5 files changed, 73 insertions(+), 12 deletions(-)