summaryrefslogtreecommitdiff
path: root/src/libcamera/ipa_manager.cpp
AgeCommit message (Collapse)Author
2020-02-24libcamera: ipa_manager: Search for IPA libraries in build treeKieran Bingham
When libcamera is built and tested (or used at all) before installing to the configured prefix path, it will be unable to locate the IPA binaries, or IPA binaries previously installed in the system paths may be incorrect to load. Utilise the build_rpath dynamic tag which is stripped out by meson at install time to determine at runtime if the library currently executing has been installed or not. When not installed and running from a build tree, identify the location of that tree by finding the path of the active libcamera.so itself, and from that point add a relative path to be able to load the most recently built IPA modules. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-24libcamera: ipa_manager: Allow recursive parsingKieran Bingham
Provide an optional means to recurse into subdirectories to search for IPA libraries. This allows IPAs contained within their own build directory to be found when loading from a non-installed build. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-24libcamera: ipa_manager: Simplify addDir() usageKieran Bingham
The addDir call only returns an error if it can't open the directory. Callers only care about the number of modules added, and discard any error information. Simplify the return value and calling code by returning an unsigned int of the number of modules loaded. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-24libcamera: ipa_manager: Re-arrange IPA precedenceKieran Bingham
Setting a user environment path in LIBCAMERA_IPA_MODULE_PATH should take precedence over the system loading locations. Adjust the IPA search orders accordingly. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-13libcamera: ipa_manager: Use utils::split()Laurent Pinchart
Replace the custom string splitting implementation with utils::split(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Kieran: Re-fit to master branch] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-14libcamera: Switch from utils::make_unique to std::make_uniqueLaurent Pinchart
Now that we're using C++-14, drop utils::make_unique for std::make_unique. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20ipa: Switch to the plain C APIJacopo Mondi
Switch IPA communication to the plain C API. As the IPAInterface class is easier to use for pipeline handlers than a plain C API, retain it and add an IPAContextWrapper that translate between the C++ and the C APIs. On the IPA module side usage of IPAInterface may be desired for IPAs implemented in C++ that want to link to libcamera. For those IPAs, a new IPAInterfaceWrapper helper class is introduced to wrap the IPAInterface implemented internally by the IPA module into an ipa_context, ipa_context_ops and ipa_callback_ops. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-04ipa: ipa_manager: Print the loaded IPA modules pathJacopo Mondi
Add debug message to report which IPA modules have been loaded and in which order. The loading order is particularly relevant for the test VIMC IPA, as the same IPA is compiled with an open source license tag and a proprietary one and they both match() against the VIMC pipeline handler. Being informed about their loading order is helpful to understand which one of the two is actually in use. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-04libcamera: ipa_manager: Sort IPA modules by nameLaurent Pinchart
Sort IPA modules by name when enumerating modules in a directory in order to guarantee a stable ordering. This eases debugging by making issues more reproducible. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-09-23libcamera: ipa_manager: Rework error messages when enumerating IPAsLaurent Pinchart
When enumerating IPAs, the system IPA directory and all the directories listed in the LIBCAMERA_IPA_MODULE_PATH environment variable are listed in turn. Failing to list any of those directories results in an error message being printed for every failure. This is particularly common when developing libcamera, as IPAs may not have been installed locally. To avoid unnecessarily worrying error messages, rework the enumeration procedure to only print a message when no IPA can be found at all. Individual missing directories are not considered as an issue anymore. The message is also downgraded from an error to a warning as the situation may still be normal. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2019-07-12libcamera: ipa_manager: use proxyPaul Elder
Make IPAManager isolate an IPA in a Proxy if the IPA's license is not open source, before returning the IPA to the caller. For now, only use the default Linux IPA proxy, and only LGPL 2.1+ is considered open source. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-11libcamera: ipa_manager: Fix handling of unset LIBCAMERA_IPA_MODULE_PATHNiklas Söderlund
If the environment variable LIBCAMERA_IPA_MODULE_PATH is not set utils::secure_getenv() will return a nullptr. Assigning a nullptr to a std::string is not valid and results in a crash, terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_M_construct null not valid Fix this by operating directly on the returned char array instead of turning it into a std::string. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05libcamera: ipa_manager: implement class for managing IPA modulesPaul Elder
IPAManager is a class that will search in given directories for IPA modules, and will load them into a list. It also provides an interface for pipeline handlers to acquire an IPA. A meson build file for the IPAs is added, which also specifies a hard-coded path for where to load the IPAs from in the installation directory. More paths can be specified with the environment variable LIBCAMERA_IPA_MODULE_PATH, with the same syntax as the regular PATH environment variable. Make the test framework set this environment variable. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>