[{"id":2231,"web_url":"https://patchwork.libcamera.org/comment/2231/","msgid":"<20190712064307.GF4831@pendragon.ideasonboard.com>","date":"2019-07-12T06:43:07","subject":"Re: [libcamera-devel] [PATCH v4 6/8] 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\nOn Fri, Jul 12, 2019 at 03:50:45AM +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\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> Changes in v4:\n> - move IPAModule open source verification to IPAModule::isOpenSource()\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 | 34 ++++++++++++++++++++++++++++++++--\n>  1 file changed, 32 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index 532b77d..4276d99 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -12,6 +12,7 @@\n>  #include <sys/types.h>\n>  \n>  #include \"ipa_module.h\"\n> +#include \"ipa_proxy.h\"\n>  #include \"log.h\"\n>  #include \"pipeline_handler.h\"\n>  #include \"utils.h\"\n> @@ -129,7 +130,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 +145,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 (!m->isOpenSource()) {\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[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DA4F60BC8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Jul 2019 08:43:35 +0200 (CEST)","from pendragon.ideasonboard.com (softbank126209254147.bbtec.net\n\t[126.209.254.147])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 15CB72B2;\n\tFri, 12 Jul 2019 08:43:33 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1562913815;\n\tbh=FewRzVoUOwtJwRCpATy0xAQ0ZR6NrLpthr1YpWhpYws=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=kpUU78P1XjNcDk1GV5Syga0ZAQ9qjZ2WnlglpuPp585tcLmJqfKfQqJitsZCExobd\n\t90o4tyAf4HqSUgs2UAlgEajv36IqmwWTEB7Na09UZ3YZk1iXheh9NpXbZw+lBHqR8R\n\tuzfXZMj78SAQw4rxRczhIjSlNkZRyFaeP/uFBvw4=","Date":"Fri, 12 Jul 2019 09:43:07 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190712064307.GF4831@pendragon.ideasonboard.com>","References":"<20190711185047.11671-1-paul.elder@ideasonboard.com>\n\t<20190711185047.11671-7-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190711185047.11671-7-paul.elder@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v4 6/8] 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":"Fri, 12 Jul 2019 06:43:35 -0000"}}]