libcamera: ipa_manager: Remove singleton requirement
The IPAManager class implements a singleton pattern due to the need of accessing the instance in a static member function. The function now takes a pointer to a PipelineHandler, which we can use to access the CameraManager, and from there, the IPAManager. Add accessors to the internal API to expose the CameraManager from the PipelineHandler, and the IPAManager from the CameraManager. This requires allocating the IPAManager dynamically to avoid a loop in includes. Use those accessors to replace the IPAManager singleton. Update the IPA interface unit test to instantiate a CameraManager instead of an IPAManager and ProcessManager, to reflect the new way that the IPAManager is accessed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
@@ -95,8 +95,6 @@ LOG_DEFINE_CATEGORY(IPAManager)
|
||||
* IPC.
|
||||
*/
|
||||
|
||||
IPAManager *IPAManager::self_ = nullptr;
|
||||
|
||||
/**
|
||||
* \brief Construct an IPAManager instance
|
||||
*
|
||||
@@ -105,10 +103,6 @@ IPAManager *IPAManager::self_ = nullptr;
|
||||
*/
|
||||
IPAManager::IPAManager()
|
||||
{
|
||||
if (self_)
|
||||
LOG(IPAManager, Fatal)
|
||||
<< "Multiple IPAManager objects are not allowed";
|
||||
|
||||
#if HAVE_IPA_PUBKEY
|
||||
if (!pubKey_.isValid())
|
||||
LOG(IPAManager, Warning) << "Public key not valid";
|
||||
@@ -153,16 +147,12 @@ IPAManager::IPAManager()
|
||||
if (!ipaCount)
|
||||
LOG(IPAManager, Warning)
|
||||
<< "No IPA found in '" IPA_MODULE_DIR "'";
|
||||
|
||||
self_ = this;
|
||||
}
|
||||
|
||||
IPAManager::~IPAManager()
|
||||
{
|
||||
for (IPAModule *module : modules_)
|
||||
delete module;
|
||||
|
||||
self_ = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user