libcamera: pipeline: Rename pipelines to a shorter name

The PipelineHandlerFactoryBase class has a name that is propagated to
the PipelineHandler instance it creates.

In present implementation, this name comes from the
REGISTER_PIPELINE_HANDLER registration macro. It corresponds to the
stringified name of the PipelineHandler derived class. Therefore,
PipelineHandler factories and instances names can be quite long such as
"PipelineHandlerRkISP1".

A libcamera user may have to explicitly refer to a PipelineHandler name
for configuration purpose: one usage of the name can be to define a
pipeline handlers match list and their priorities. It is desired, for
user convenience, to use a short name to designate a pipeline handler.
Reusing the short pipeline names already defined in the meson option
files is an existing and consistent way of naming pipelines.

This change adds an explicit name parameter to the
REGISTER_PIPELINE_HANDLER registration macro. That parameter is used to
define the name of a pipeline handler factory, instead of the current
pipeline handler class name.

Each pipeline registration is updated accordingly. The short name
assigned corresponds to the pipeline directory name in the source tree.
It is consistent with pipelines names used in meson.

Changing the pipeline name has an impact on the IPA modules: each module
defines a IPAModuleInfo structure. This structure has a pipelineName
member defining the pipeline handler name it shall match with.
Therefore, each internal IPA module definition has to be changed to have
its IPAModuleInfo pipelineName name updated with the short pipeline
handler name.

In addition to this pipelineName member, the IPAModuleInfo structure
also has a name member, associated to the IPA module name. Having
renamed the pipelines to a short name, the pipeline name and the IPA
module names of the IPAModuleInfo structure are the same: for in-tree
IPA, they correspond to the respective pipeline and IPA subdirectories
in the source tree.  However the IPA name could be different, for
instance with a close source IPA implementation built out-of-tree. Thus,
it makes sense to keep the IPA name in that structure, as the 2
definitions may not always be redundant.

Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Kieran: Adjust for clang-format style fix, reformat commitmsg]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Julien Vuillaumier 2024-05-03 16:49:17 +02:00 committed by Kieran Bingham
parent e43d2a35fa
commit 5ed35fca68
18 changed files with 22 additions and 18 deletions

View file

@ -258,7 +258,7 @@ implementations for the overridden class members.
return false; return false;
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerVivid) REGISTER_PIPELINE_HANDLER(PipelineHandlerVivid, "vivid")
} /* namespace libcamera */ } /* namespace libcamera */
@ -266,6 +266,8 @@ Note that you must register the ``PipelineHandler`` subclass with the pipeline
handler factory using the `REGISTER_PIPELINE_HANDLER`_ macro which handler factory using the `REGISTER_PIPELINE_HANDLER`_ macro which
registers it and creates a global symbol to reference the class and make it registers it and creates a global symbol to reference the class and make it
available to try and match devices. available to try and match devices.
String "vivid" is the name assigned to the pipeline, matching the pipeline
subdirectory name in the source tree.
.. _REGISTER_PIPELINE_HANDLER: https://libcamera.org/api-html/pipeline__handler_8h.html .. _REGISTER_PIPELINE_HANDLER: https://libcamera.org/api-html/pipeline__handler_8h.html

View file

@ -140,7 +140,7 @@ public:
} }
}; };
#define REGISTER_PIPELINE_HANDLER(handler) \ #define REGISTER_PIPELINE_HANDLER(handler, name) \
static PipelineHandlerFactory<handler> global_##handler##Factory(#handler); static PipelineHandlerFactory<handler> global_##handler##Factory(name);
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -673,7 +673,7 @@ extern "C" {
const struct IPAModuleInfo ipaModuleInfo = { const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
1, 1,
"PipelineHandlerIPU3", "ipu3",
"ipu3", "ipu3",
}; };

View file

@ -459,7 +459,7 @@ extern "C" {
const struct IPAModuleInfo ipaModuleInfo = { const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
1, 1,
"PipelineHandlerRkISP1", "rkisp1",
"rkisp1", "rkisp1",
}; };

View file

@ -583,7 +583,7 @@ extern "C" {
const struct IPAModuleInfo ipaModuleInfo = { const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
1, 1,
"PipelineHandlerVc4", "rpi/vc4",
"rpi/vc4", "rpi/vc4",
}; };

View file

@ -389,7 +389,7 @@ extern "C" {
const struct IPAModuleInfo ipaModuleInfo = { const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
0, 0,
"SimplePipelineHandler", "simple",
"simple", "simple",
}; };

View file

@ -200,7 +200,7 @@ extern "C" {
const struct IPAModuleInfo ipaModuleInfo = { const struct IPAModuleInfo ipaModuleInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
0, 0,
"PipelineHandlerVimc", "vimc",
"vimc", "vimc",
}; };

View file

@ -1112,6 +1112,6 @@ void PipelineHandlerISI::bufferReady(FrameBuffer *buffer)
completeRequest(request); completeRequest(request);
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerISI) REGISTER_PIPELINE_HANDLER(PipelineHandlerISI, "imx8-isi")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -1420,6 +1420,6 @@ void IPU3CameraData::frameStart(uint32_t sequence)
*testPatternMode); *testPatternMode);
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3) REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3, "ipu3")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -1061,6 +1061,6 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator)
return true; return true;
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerMaliC55) REGISTER_PIPELINE_HANDLER(PipelineHandlerMaliC55, "mali-c55")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -1322,6 +1322,6 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)
data->delayedCtrls_->get(buffer->metadata().sequence)); data->delayedCtrls_->get(buffer->metadata().sequence));
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1) REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1, "rkisp1")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -1018,6 +1018,6 @@ bool Vc4CameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em
return true; return true;
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerVc4) REGISTER_PIPELINE_HANDLER(PipelineHandlerVc4, "rpi/vc4")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -1732,6 +1732,6 @@ void SimplePipelineHandler::releasePipeline(SimpleCameraData *data)
} }
} }
REGISTER_PIPELINE_HANDLER(SimplePipelineHandler) REGISTER_PIPELINE_HANDLER(SimplePipelineHandler, "simple")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -709,6 +709,6 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer)
pipe()->completeRequest(request); pipe()->completeRequest(request);
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC) REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC, "uvcvideo")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -623,6 +623,6 @@ void VimcCameraData::paramsBufferReady([[maybe_unused]] unsigned int id,
{ {
} }
REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc) REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc, "vimc")
} /* namespace libcamera */ } /* namespace libcamera */

View file

@ -830,6 +830,8 @@ std::vector<PipelineHandlerFactoryBase *> &PipelineHandlerFactoryBase::factories
* \def REGISTER_PIPELINE_HANDLER * \def REGISTER_PIPELINE_HANDLER
* \brief Register a pipeline handler with the pipeline handler factory * \brief Register a pipeline handler with the pipeline handler factory
* \param[in] handler Class name of PipelineHandler derived class to register * \param[in] handler Class name of PipelineHandler derived class to register
* \param[in] name Name assigned to the pipeline handler, matching the pipeline
* subdirectory name in the source tree.
* *
* Register a PipelineHandler subclass with the factory and make it available to * Register a PipelineHandler subclass with the factory and make it available to
* try and match devices. * try and match devices.

View file

@ -56,7 +56,7 @@ protected:
const std::vector<PipelineHandlerFactoryBase *> &factories = const std::vector<PipelineHandlerFactoryBase *> &factories =
PipelineHandlerFactoryBase::factories(); PipelineHandlerFactoryBase::factories();
for (const PipelineHandlerFactoryBase *factory : factories) { for (const PipelineHandlerFactoryBase *factory : factories) {
if (factory->name() == "PipelineHandlerVimc") { if (factory->name() == "vimc") {
pipe_ = factory->create(nullptr); pipe_ = factory->create(nullptr);
break; break;
} }

View file

@ -57,7 +57,7 @@ protected:
const struct IPAModuleInfo testInfo = { const struct IPAModuleInfo testInfo = {
IPA_MODULE_API_VERSION, IPA_MODULE_API_VERSION,
0, 0,
"PipelineHandlerVimc", "vimc",
"vimc", "vimc",
}; };