libcamera: pipeline_handler: Add createIPA() function

IPA proxies are created with a call to IPAManager::createIPA(), which is
a static member function. This requires a complicated dance in the
createIPA() function to retrieve the IPAManager instance through the
camera manager, itself retrieved from the pipeline handler. Simplify the
code by turning IPAManager::createIPA() into a non-static member
function, and providing a wrapper in the PipelineHandler class to keep
instantiation of IPA proxies easy in pipeline handlers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
This commit is contained in:
Laurent Pinchart
2025-10-20 18:06:03 +03:00
parent 1e4e158d98
commit db998e618a
12 changed files with 43 additions and 33 deletions

View File

@@ -105,6 +105,7 @@ LOG_DEFINE_CATEGORY(IPAManager)
* CameraManager.
*/
IPAManager::IPAManager(const GlobalConfiguration &configuration)
: configuration_(configuration)
{
#if HAVE_IPA_PUBKEY
if (!pubKey_.isValid())

View File

@@ -31,7 +31,6 @@
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/request.h"
@@ -1151,7 +1150,7 @@ int PipelineHandlerIPU3::registerCameras()
int IPU3CameraData::loadIPA()
{
ipa_ = IPAManager::createIPA<ipa::ipu3::IPAProxyIPU3>(pipe(), 1, 1);
ipa_ = pipe()->createIPA<ipa::ipu3::IPAProxyIPU3>(1, 1);
if (!ipa_)
return -ENOENT;

View File

@@ -35,7 +35,6 @@
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/request.h"
@@ -382,7 +381,7 @@ int MaliC55CameraData::loadIPA()
if (!sensor_)
return 0;
ipa_ = IPAManager::createIPA<ipa::mali_c55::IPAProxyMaliC55>(pipe(), 1, 1);
ipa_ = pipe()->createIPA<ipa::mali_c55::IPAProxyMaliC55>(1, 1);
if (!ipa_)
return -ENOENT;

View File

@@ -40,7 +40,6 @@
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/media_pipeline.h"
#include "libcamera/internal/pipeline_handler.h"
@@ -395,7 +394,7 @@ const PipelineHandlerRkISP1 *RkISP1CameraData::pipe() const
int RkISP1CameraData::loadIPA(unsigned int hwRevision, uint32_t supportedBlocks)
{
ipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe(), 1, 1);
ipa_ = pipe()->createIPA<ipa::rkisp1::IPAProxyRkISP1>(1, 1);
if (!ipa_)
return -ENOENT;

View File

@@ -20,7 +20,6 @@
#include <libcamera/property_ids.h>
#include "libcamera/internal/camera_lens.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/v4l2_subdevice.h"
using namespace std::chrono_literals;
@@ -1161,7 +1160,7 @@ int CameraData::loadIPA(ipa::RPi::InitResult *result)
{
int ret;
ipa_ = IPAManager::createIPA<ipa::RPi::IPAProxyRPi>(pipe(), 1, 1);
ipa_ = pipe()->createIPA<ipa::RPi::IPAProxyRPi>(1, 1);
if (!ipa_)
return -ENOENT;

View File

@@ -35,7 +35,6 @@
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/media_device.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/request.h"
@@ -488,7 +487,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
if (data->init())
return false;
data->ipa_ = IPAManager::createIPA<ipa::vimc::IPAProxyVimc>(this, 0, 0);
data->ipa_ = createIPA<ipa::vimc::IPAProxyVimc>(0, 0);
if (!data->ipa_) {
LOG(VIMC, Error) << "no matching IPA found";
return false;

View File

@@ -835,6 +835,16 @@ void PipelineHandler::disconnect()
* \return The CameraManager for this pipeline handler
*/
/**
* \fn PipelineHandler::createIPA()
* \brief Create an IPA proxy that matches this pipeline handler
* \param[in] minVersion Minimum acceptable version of IPA module
* \param[in] maxVersion Maximum acceptable version of IPA module
*
* \return A newly created IPA proxy, or nullptr if no matching IPA module is
* found or if the IPA proxy fails to initialize
*/
/**
* \class PipelineHandlerFactoryBase
* \brief Base class for pipeline handler factories

View File

@@ -23,7 +23,6 @@
#include "libcamera/internal/bayer_format.h"
#include "libcamera/internal/framebuffer.h"
#include "libcamera/internal/ipa_manager.h"
#include "libcamera/internal/software_isp/debayer_params.h"
#include "debayer_cpu.h"
@@ -127,7 +126,7 @@ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,
debayer_->inputBufferReady.connect(this, &SoftwareIsp::inputReady);
debayer_->outputBufferReady.connect(this, &SoftwareIsp::outputReady);
ipa_ = IPAManager::createIPA<ipa::soft::IPAProxySoft>(pipe, 0, 0);
ipa_ = pipe->createIPA<ipa::soft::IPAProxySoft>(0, 0);
if (!ipa_) {
LOG(SoftwareIsp, Error)
<< "Creating IPA for software ISP failed";