[v1,0/1] Add environment variable to order pipelines match
mbox series

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

Message

Julien Vuillaumier March 4, 2024, 6:18 p.m. UTC
Hello,

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.

Thanks


Julien Vuillaumier (1):
  libcamera: camera_manager: Add environment variable to order pipelines
    match

 Documentation/environment_variables.rst |  5 +++
 src/libcamera/camera_manager.cpp        | 51 +++++++++++++++++++++----
 2 files changed, 48 insertions(+), 8 deletions(-)

Comments

Kieran Bingham March 5, 2024, 6:45 a.m. UTC | #1
Hi Julien,

Quoting Julien Vuillaumier (2024-03-04 18:18:15)
> 
> Hello,
> 
> 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.

This indeed is a problem to solve. This looks like a good way to handle
it, I think it's an indication that we need a libcamera configuration
file soon though, which would let these magic environment controls be
set from either a config file or overridden by the environment.

I have also wondered about setting 'prioirities' to pipeline handlers,
such as making the simple pipeline handler a low priority handler, but
that doesn't solve individual cases for instance if that was the
preferred choice, so I think we do need some explicit control from the
users environment.

--
Kieran

 
> Thanks
> 
> 
> Julien Vuillaumier (1):
>   libcamera: camera_manager: Add environment variable to order pipelines
>     match
> 
>  Documentation/environment_variables.rst |  5 +++
>  src/libcamera/camera_manager.cpp        | 51 +++++++++++++++++++++----
>  2 files changed, 48 insertions(+), 8 deletions(-)
> 
> -- 
> 2.34.1
>
Julien Vuillaumier March 6, 2024, 5:57 p.m. UTC | #2
Hi Kieran,

On 05/03/2024 07:45, Kieran Bingham wrote:
> Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
> 
> 
> Hi Julien,
> 
> Quoting Julien Vuillaumier (2024-03-04 18:18:15)
>>
>> Hello,
>>
>> 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.
> 
> This indeed is a problem to solve. This looks like a good way to handle
> it, I think it's an indication that we need a libcamera configuration
> file soon though, which would let these magic environment controls be
> set from either a config file or overridden by the environment.
> 
> I have also wondered about setting 'prioirities' to pipeline handlers,
> such as making the simple pipeline handler a low priority handler, but
> that doesn't solve individual cases for instance if that was the
> preferred choice, so I think we do need some explicit control from the
> users environment.

Assigning priorities to pipelines would be an option indeed, if 
priorities can be reconfigured at runtime to select the desired 
pipeline(s). Though an ordered list seems to give the same flexibility 
and be slightly easier to handle.

Using config file would also be a convenient way of specifying the 
pipelines to select. It could come at some point in addition to the 
environment variable, for instance to setup a static pipeline 
configuration for a platform. The environment variable would still 
remain a convenient option for engineering and testing though.

Thanks,
Julien


> 
> --
> Kieran
> 
> 
>> Thanks
>>
>>
>> Julien Vuillaumier (1):
>>    libcamera: camera_manager: Add environment variable to order pipelines
>>      match
>>
>>   Documentation/environment_variables.rst |  5 +++
>>   src/libcamera/camera_manager.cpp        | 51 +++++++++++++++++++++----
>>   2 files changed, 48 insertions(+), 8 deletions(-)
>>
>> --
>> 2.34.1
>>