libcamera: camera_manager: Move IPAManager creation to start() time

The IPAManager is currently instantiated when constructing the
CameraManager constructor, in the CameraManager::Private constructor.
This is the only sizeable object constructed with the CameraManager, all
other components are constructed when starting the manager.

Early construction of the IPAManager isn't wrong per-se, but prevents
accessing the CameraManager from the IPAManager constructor (as the
former isn't fully constructed). It also results in internal objects
constructed in different threads, which isn't an issue at the moment as
none of the objects constructed by the IPAManager are thread-bound, but
could cause issues later. Finally, it prevents influencing the
IPAManager creation with parameters passed to the CameraManager::start()
function once we implement this, which would be useful for applications
to override configuration parameters related to IPA modules.

Move the instantiation of the IPAManager to start time to fix all those
issues.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-14 00:01:04 +03:00
parent bcaed97380
commit 9bd7dc3a69

View File

@@ -41,7 +41,6 @@ LOG_DEFINE_CATEGORY(Camera)
CameraManager::Private::Private()
: Thread("CameraManager"), initialized_(false)
{
ipaManager_ = std::make_unique<IPAManager>(configuration());
}
int CameraManager::Private::start()
@@ -94,6 +93,8 @@ void CameraManager::Private::run()
int CameraManager::Private::init()
{
ipaManager_ = std::make_unique<IPAManager>(configuration());
enumerator_ = DeviceEnumerator::create();
if (!enumerator_ || enumerator_->enumerate())
return -ENODEV;