[{"id":2219,"web_url":"https://patchwork.libcamera.org/comment/2219/","msgid":"<20190711062226.GG5247@pendragon.ideasonboard.com>","date":"2019-07-11T06:22:26","subject":"Re: [libcamera-devel] [PATCH v3 5/7] libcamera: ipa_manager: use\n\tproxy","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nI think you missed my review on v2.\n\nOn Wed, Jul 10, 2019 at 03:44:48AM +0900, Paul Elder wrote:\n> Make IPAManager isolate an IPA in a Proxy if the IPA's license is not\n> open source, before returning the IPA to the caller. For now, only use\n> the default Linux IPA proxy, and only LGPL 2.1+ is considered open\n> source.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n> Changes in v3:\n> - license checking is done with SPDX license strings, and only LGPL 2.1+\n>   is accepted for now\n> \n> New in v2\n> - replaces adding shims\n> - since Proxies are not external shared objects like the shims in v1\n>   were, there is no longer a list of shims that is treated like\n>   IPAModules\n> - instead the matching is done by searching the list of proxy factories\n> \n>  src/libcamera/ipa_manager.cpp | 46 +++++++++++++++++++++++++++++++++--\n>  1 file changed, 44 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index 532b77d..49a12ca 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -14,6 +14,7 @@\n>  #include \"ipa_module.h\"\n>  #include \"log.h\"\n>  #include \"pipeline_handler.h\"\n> +#include \"ipa_proxy.h\"\n>  #include \"utils.h\"\n>  \n>  /**\n> @@ -25,6 +26,18 @@ namespace libcamera {\n>  \n>  LOG_DEFINE_CATEGORY(IPAManager)\n>  \n> +namespace {\n> +\n> +bool isOpenSource(const char *license)\n> +{\n> +\tif (!strcmp(license, \"LGPL-2.1-or-later\"))\n> +\t\treturn true;\n> +\n> +\treturn false;\n> +}\n> +\n> +} /* namespace */\n> +\n>  /**\n>   * \\class IPAManager\n>   * \\brief Manager for IPA modules\n> @@ -129,7 +142,7 @@ int IPAManager::addDir(const char *libDir)\n>   * \\param[in] maxVersion Maximum acceptable version of IPA module\n>   *\n>   * \\return A newly created IPA interface, or nullptr if no matching\n> - * IPA module is found\n> + * IPA module is found or if the IPA interface fails to initialize\n>   */\n>  std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n>  \t\t\t\t\t\t    uint32_t maxVersion,\n> @@ -144,7 +157,36 @@ std::unique_ptr<IPAInterface> IPAManager::createIPA(PipelineHandler *pipe,\n>  \t\t}\n>  \t}\n>  \n> -\tif (!m || !m->load())\n> +\tif (!m)\n> +\t\treturn nullptr;\n> +\n> +\tif (!isOpenSource(m->info().license)) {\n> +\t\tIPAProxyFactory *pf = nullptr;\n> +\t\tstd::vector<IPAProxyFactory *> &factories = IPAProxyFactory::factories();\n> +\n> +\t\tfor (IPAProxyFactory *factory : factories) {\n> +\t\t\t/* TODO: Better matching */\n> +\t\t\tif (!strcmp(factory->name().c_str(), \"IPAProxyLinux\")) {\n> +\t\t\t\tpf = factory;\n> +\t\t\t\tbreak;\n> +\t\t\t}\n> +\t\t}\n> +\n> +\t\tif (!pf) {\n> +\t\t\tLOG(IPAManager, Error) << \"Failed to get proxy factory\";\n> +\t\t\treturn nullptr;\n> +\t\t}\n> +\n> +\t\tstd::unique_ptr<IPAProxy> proxy = pf->create(m);\n> +\t\tif (!proxy->isValid()) {\n> +\t\t\tLOG(IPAManager, Error) << \"Failed to load proxy\";\n> +\t\t\treturn nullptr;\n> +\t\t}\n> +\n> +\t\treturn proxy;\n> +\t}\n> +\n> +\tif (!m->load())\n>  \t\treturn nullptr;\n>  \n>  \treturn m->createInstance();","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7FF8160C23\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 11 Jul 2019 08:22:54 +0200 (CEST)","from pendragon.ideasonboard.com (softbank126163157105.bbtec.net\n\t[126.163.157.105])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E3E7431C;\n\tThu, 11 Jul 2019 08:22:52 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562826174;\n\tbh=qPmc4v9rRwl8KNFo5BxqsQUg64dbjiBpZyAiw+aDf/4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kRjWQW/yiWr99L3u9KQ0BHAznsFH+EDJo/8M+A+L5TmI25Iz3tAH6rnYQ6S3IE05O\n\tLs+Dv/EM4H1yoMeJ+khq8ndaBtyqNY8KmYhDqspNM912yLhvNFlv0YGBuTEpy5ns3q\n\tL2LbugAAbIpq/51h+AboXL4E+ccR9LIDdQz3AXoE=","Date":"Thu, 11 Jul 2019 09:22:26 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190711062226.GG5247@pendragon.ideasonboard.com>","References":"<20190709184450.32023-1-paul.elder@ideasonboard.com>\n\t<20190709184450.32023-6-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190709184450.32023-6-paul.elder@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 5/7] libcamera: ipa_manager: use\n\tproxy","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 11 Jul 2019 06:22:54 -0000"}}]