ipa: Name IPA modules after their source directory
The IPAModuleInfo::name field is currently a free-formed string that has little use. Tighten its usage rules to make it suitable for building file system paths to IPA-specific resources by matching the directory name of the IPA module. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
256d0a4098
commit
6e1cd1394e
4 changed files with 23 additions and 3 deletions
|
@ -274,7 +274,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
|
||||||
IPA_MODULE_API_VERSION,
|
IPA_MODULE_API_VERSION,
|
||||||
1,
|
1,
|
||||||
"PipelineHandlerRkISP1",
|
"PipelineHandlerRkISP1",
|
||||||
"RkISP1 IPA",
|
"rkisp1",
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ipa_context *ipaCreate()
|
struct ipa_context *ipaCreate()
|
||||||
|
|
|
@ -126,7 +126,7 @@ const struct IPAModuleInfo ipaModuleInfo = {
|
||||||
IPA_MODULE_API_VERSION,
|
IPA_MODULE_API_VERSION,
|
||||||
0,
|
0,
|
||||||
"PipelineHandlerVimc",
|
"PipelineHandlerVimc",
|
||||||
"Dummy IPA for Vimc",
|
"vimc",
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ipa_context *ipaCreate()
|
struct ipa_context *ipaCreate()
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <ctype.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -216,6 +217,11 @@ Span<uint8_t> elfLoadSymbol(Span<uint8_t> elf, const char *symbol)
|
||||||
* \var IPAModuleInfo::name
|
* \var IPAModuleInfo::name
|
||||||
* \brief The name of the IPA module
|
* \brief The name of the IPA module
|
||||||
*
|
*
|
||||||
|
* The name may be used to build file system paths to IPA-specific resources.
|
||||||
|
* It shall only contain printable characters, and may not contain '/', '*',
|
||||||
|
* '?' or '\'. For IPA modules included in libcamera, it shall match the
|
||||||
|
* directory of the IPA module in the source tree.
|
||||||
|
*
|
||||||
* \todo Allow user to choose to isolate open source IPAs
|
* \todo Allow user to choose to isolate open source IPAs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -287,6 +293,20 @@ int IPAModule::loadIPAModuleInfo()
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Validate the IPA module name. */
|
||||||
|
std::string ipaName = info_.name;
|
||||||
|
auto iter = std::find_if_not(ipaName.begin(), ipaName.end(),
|
||||||
|
[](unsigned char c) -> bool {
|
||||||
|
return isprint(c) && c != '/' &&
|
||||||
|
c != '?' && c != '*' &&
|
||||||
|
c != '\\';
|
||||||
|
});
|
||||||
|
if (iter != ipaName.end()) {
|
||||||
|
LOG(IPAModule, Error)
|
||||||
|
<< "Invalid IPA module name '" << ipaName << "'";
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Load the signature. Failures are not fatal. */
|
/* Load the signature. Failures are not fatal. */
|
||||||
File sign{ libPath_ + ".sign" };
|
File sign{ libPath_ + ".sign" };
|
||||||
if (!sign.open(File::ReadOnly)) {
|
if (!sign.open(File::ReadOnly)) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
IPA_MODULE_API_VERSION,
|
IPA_MODULE_API_VERSION,
|
||||||
0,
|
0,
|
||||||
"PipelineHandlerVimc",
|
"PipelineHandlerVimc",
|
||||||
"Dummy IPA for Vimc",
|
"vimc",
|
||||||
};
|
};
|
||||||
|
|
||||||
count += runTest("src/ipa/vimc/ipa_vimc.so", testInfo);
|
count += runTest("src/ipa/vimc/ipa_vimc.so", testInfo);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue