summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-06-05 14:58:58 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-06-08 17:11:26 +0900
commit6e730695deef37b9a66bb9547df41d17d2872028 (patch)
tree40f09253aa3e34c3c0fea1c342f5bd49c682e989
parent46d544345cbae270da533a737e334880720ceea5 (diff)
libcamera: IPAManager: remove instance() and make createIPA() static
As the only usage of IPAManager::instance() is by the pipeline handlers to call IPAManager::createIPA(), remove the former and make the latter static. Update the pipeline handlers and tests accordingly. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
-rw-r--r--include/libcamera/internal/ipa_manager.h8
-rw-r--r--src/libcamera/ipa_manager.cpp20
-rw-r--r--src/libcamera/pipeline/raspberrypi/raspberrypi.cpp2
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp2
-rw-r--r--src/libcamera/pipeline/vimc/vimc.cpp2
-rw-r--r--test/ipa/ipa_interface_test.cpp2
6 files changed, 10 insertions, 26 deletions
diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h
index f17fd0a8..4a143b6a 100644
--- a/include/libcamera/internal/ipa_manager.h
+++ b/include/libcamera/internal/ipa_manager.h
@@ -25,11 +25,9 @@ public:
IPAManager();
~IPAManager();
- static IPAManager *instance();
-
- std::unique_ptr<IPAProxy> createIPA(PipelineHandler *pipe,
- uint32_t maxVersion,
- uint32_t minVersion);
+ static std::unique_ptr<IPAProxy> createIPA(PipelineHandler *pipe,
+ uint32_t maxVersion,
+ uint32_t minVersion);
private:
static IPAManager *self_;
diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp
index e7fddf42..d7a75104 100644
--- a/src/libcamera/ipa_manager.cpp
+++ b/src/libcamera/ipa_manager.cpp
@@ -99,8 +99,7 @@ IPAManager *IPAManager::self_ = nullptr;
* \brief Construct an IPAManager instance
*
* The IPAManager class is meant to only be instantiated once, by the
- * CameraManager. Pipeline handlers shall use the instance() function to access
- * the IPAManager instance.
+ * CameraManager.
*/
IPAManager::IPAManager()
{
@@ -160,19 +159,6 @@ IPAManager::~IPAManager()
}
/**
- * \brief Retrieve the IPA manager instance
- *
- * The IPAManager is constructed by the CameraManager. This function shall be
- * used to retrieve the single instance of the manager.
- *
- * \return The IPA manager instance
- */
-IPAManager *IPAManager::instance()
-{
- return self_;
-}
-
-/**
* \brief Identify shared library objects within a directory
* \param[in] libDir The directory to search for shared objects
* \param[in] maxDepth The maximum depth of sub-directories to parse
@@ -273,7 +259,7 @@ std::unique_ptr<IPAProxy> IPAManager::createIPA(PipelineHandler *pipe,
{
IPAModule *m = nullptr;
- for (IPAModule *module : modules_) {
+ for (IPAModule *module : self_->modules_) {
if (module->match(pipe, minVersion, maxVersion)) {
m = module;
break;
@@ -289,7 +275,7 @@ std::unique_ptr<IPAProxy> IPAManager::createIPA(PipelineHandler *pipe,
*
* \todo Implement a better proxy selection
*/
- const char *proxyName = isSignatureValid(m)
+ const char *proxyName = self_->isSignatureValid(m)
? "IPAProxyThread" : "IPAProxyLinux";
IPAProxyFactory *pf = nullptr;
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index e16a9c7f..b9b88506 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -1118,7 +1118,7 @@ void RPiCameraData::frameStarted(uint32_t sequence)
int RPiCameraData::loadIPA()
{
- ipa_ = IPAManager::instance()->createIPA(pipe_, 1, 1);
+ ipa_ = IPAManager::createIPA(pipe_, 1, 1);
if (!ipa_)
return -ENOENT;
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index d807fc2c..900f873a 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -395,7 +395,7 @@ private:
int RkISP1CameraData::loadIPA()
{
- ipa_ = IPAManager::instance()->createIPA(pipe_, 1, 1);
+ ipa_ = IPAManager::createIPA(pipe_, 1, 1);
if (!ipa_)
return -ENOENT;
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index ba9fca50..3881545b 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -410,7 +410,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
std::unique_ptr<VimcCameraData> data = std::make_unique<VimcCameraData>(this, media);
- data->ipa_ = IPAManager::instance()->createIPA(this, 0, 0);
+ data->ipa_ = IPAManager::createIPA(this, 0, 0);
if (data->ipa_ != nullptr) {
std::string conf = data->ipa_->configurationFile("vimc.conf");
data->ipa_->init(IPASettings{ conf });
diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp
index 153493ba..1bc93a63 100644
--- a/test/ipa/ipa_interface_test.cpp
+++ b/test/ipa/ipa_interface_test.cpp
@@ -95,7 +95,7 @@ protected:
EventDispatcher *dispatcher = thread()->eventDispatcher();
Timer timer;
- ipa_ = IPAManager::instance()->createIPA(pipe_.get(), 0, 0);
+ ipa_ = IPAManager::createIPA(pipe_.get(), 0, 0);
if (!ipa_) {
cerr << "Failed to create VIMC IPA interface" << endl;
return TestFail;