[{"id":18094,"web_url":"https://patchwork.libcamera.org/comment/18094/","msgid":"<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","date":"2021-07-12T07:50:14","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 12/07/2021 00:15, Laurent Pinchart wrote:\n> The createIPA() template function starts with code that doesn't depend\n> on the template parameters. Split it to a non-template function to avoid\n> code duplication in the binary.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  include/libcamera/internal/ipa_manager.h | 13 ++++---------\n>  src/libcamera/ipa_manager.cpp            | 17 +++++++++++++++++\n>  2 files changed, 21 insertions(+), 9 deletions(-)\n> \n> diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\n> index 42201839901b..0687842e5c06 100644\n> --- a/include/libcamera/internal/ipa_manager.h\n> +++ b/include/libcamera/internal/ipa_manager.h\n> @@ -34,15 +34,7 @@ public:\n>  \t\t\t\t\t    uint32_t minVersion,\n>  \t\t\t\t\t    uint32_t maxVersion)\n>  \t{\n> -\t\tIPAModule *m = nullptr;\n> -\n> -\t\tfor (IPAModule *module : self_->modules_) {\n> -\t\t\tif (module->match(pipe, minVersion, maxVersion)) {\n> -\t\t\t\tm = module;\n> -\t\t\t\tbreak;\n> -\t\t\t}\n> -\t\t}\n> -\n> +\t\tIPAModule *m = self_->module(pipe, minVersion, maxVersion);\n>  \t\tif (!m)\n>  \t\t\treturn nullptr;\n>  \n> @@ -62,6 +54,9 @@ private:\n>  \t\t      std::vector<std::string> &files);\n>  \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n>  \n> +\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n> +\t\t\t  uint32_t maxVersion);\n> +\n>  \tbool isSignatureValid(IPAModule *ipa) const;\n>  \n>  \tstd::vector<IPAModule *> modules_;\n> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> index b4606c6159e5..9533c8fadea6 100644\n> --- a/src/libcamera/ipa_manager.cpp\n> +++ b/src/libcamera/ipa_manager.cpp\n> @@ -245,6 +245,23 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n>  \treturn count;\n>  }\n>  \n> +/**\n> + * \\brief Retrieve and IPA module that matches a given pipeline handler\n\nThis actually finds the 'first' matching IPA module (for however the\nlist is sorted).\n\nWe can already have multiple potentially matching IPA modules available\non a system. Should this be more explicit on what is matched?\n\n\n\n> + * \\param[in] pipe The pipeline handler\n> + * \\param[in] minVersion Minimum acceptable version of IPA module\n> + * \\param[in] maxVersion Maximum acceptable version of IPA module\n> + */\n> +IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n> +\t\t\t      uint32_t maxVersion)\n> +{\n> +\tfor (IPAModule *module : modules_) {\n> +\t\tif (module->match(pipe, minVersion, maxVersion))\n> +\t\t\treturn module;\n> +\t}\n> +\n> +\treturn nullptr;\n> +}\n> +\n>  /**\n>   * \\fn IPAManager::createIPA()\n>   * \\brief Create an IPA proxy that matches a given pipeline handler\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id D94A7C3224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jul 2021 07:50:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 57CE768506;\n\tMon, 12 Jul 2021 09:50:18 +0200 (CEST)","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 A1E9268506\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 09:50:16 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2D41FCC;\n\tMon, 12 Jul 2021 09:50:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dP/wyJ0G\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626076216;\n\tbh=w/ndZgx6L+8ngp5rmwOpMUb/eJ6pvOYQtj96mOmkNDw=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=dP/wyJ0GTv69plwl5k/Ew/4aSF0NCgwEjZadwN5fM6G6H9z2zrCBOv1+Q+nhj5mQj\n\t24By0bdEKAfuyBXy7pSXeOamcum4y0U0NlFCSqxyynLA7+XRFbUQ2qale9wATkdZw9\n\tkKopuGah0K/mUbILNVzfbkmDR5uU38lfe84xG0No=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210711231547.19664-1-laurent.pinchart@ideasonboard.com>\n\t<20210711231547.19664-3-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","Date":"Mon, 12 Jul 2021 08:50:14 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210711231547.19664-3-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18097,"web_url":"https://patchwork.libcamera.org/comment/18097/","msgid":"<85ffc8c2-3e73-3847-5a6e-168d58840909@ideasonboard.com>","date":"2021-07-12T07:56:00","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 12/07/2021 08:50, Kieran Bingham wrote:\n> Hi Laurent,\n> \n> On 12/07/2021 00:15, Laurent Pinchart wrote:\n>> The createIPA() template function starts with code that doesn't depend\n>> on the template parameters. Split it to a non-template function to avoid\n>> code duplication in the binary.\n>>\n>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>> ---\n>>  include/libcamera/internal/ipa_manager.h | 13 ++++---------\n>>  src/libcamera/ipa_manager.cpp            | 17 +++++++++++++++++\n>>  2 files changed, 21 insertions(+), 9 deletions(-)\n>>\n>> diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\n>> index 42201839901b..0687842e5c06 100644\n>> --- a/include/libcamera/internal/ipa_manager.h\n>> +++ b/include/libcamera/internal/ipa_manager.h\n>> @@ -34,15 +34,7 @@ public:\n>>  \t\t\t\t\t    uint32_t minVersion,\n>>  \t\t\t\t\t    uint32_t maxVersion)\n>>  \t{\n>> -\t\tIPAModule *m = nullptr;\n>> -\n>> -\t\tfor (IPAModule *module : self_->modules_) {\n>> -\t\t\tif (module->match(pipe, minVersion, maxVersion)) {\n>> -\t\t\t\tm = module;\n>> -\t\t\t\tbreak;\n>> -\t\t\t}\n>> -\t\t}\n>> -\n>> +\t\tIPAModule *m = self_->module(pipe, minVersion, maxVersion);\n>>  \t\tif (!m)\n>>  \t\t\treturn nullptr;\n>>  \n>> @@ -62,6 +54,9 @@ private:\n>>  \t\t      std::vector<std::string> &files);\n>>  \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n>>  \n>> +\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n>> +\t\t\t  uint32_t maxVersion);\n>> +\n>>  \tbool isSignatureValid(IPAModule *ipa) const;\n>>  \n>>  \tstd::vector<IPAModule *> modules_;\n>> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n>> index b4606c6159e5..9533c8fadea6 100644\n>> --- a/src/libcamera/ipa_manager.cpp\n>> +++ b/src/libcamera/ipa_manager.cpp\n>> @@ -245,6 +245,23 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n>>  \treturn count;\n>>  }\n>>  \n>> +/**\n>> + * \\brief Retrieve and IPA module that matches a given pipeline handler\n> \n> This actually finds the 'first' matching IPA module (for however the\n> list is sorted).\n> \n> We can already have multiple potentially matching IPA modules available\n> on a system. Should this be more explicit on what is matched?\n\nThis wasn't an objection, just a comment,\n\nFor the patch:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n>> + * \\param[in] pipe The pipeline handler\n>> + * \\param[in] minVersion Minimum acceptable version of IPA module\n>> + * \\param[in] maxVersion Maximum acceptable version of IPA module\n>> + */\n>> +IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n>> +\t\t\t      uint32_t maxVersion)\n>> +{\n>> +\tfor (IPAModule *module : modules_) {\n>> +\t\tif (module->match(pipe, minVersion, maxVersion))\n>> +\t\t\treturn module;\n>> +\t}\n>> +\n>> +\treturn nullptr;\n>> +}\n>> +\n>>  /**\n>>   * \\fn IPAManager::createIPA()\n>>   * \\brief Create an IPA proxy that matches a given pipeline handler\n>>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 19983BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jul 2021 07:56:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C93AB68524;\n\tMon, 12 Jul 2021 09:56:04 +0200 (CEST)","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 B4A3368506\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 09:56:03 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 59B65CC;\n\tMon, 12 Jul 2021 09:56:03 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FdrGtd+E\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626076563;\n\tbh=G2yrUFXhwVlMwfgpZE/C8dSzyOAFCRyaXRYC28k9jd0=;\n\th=Subject:From:To:References:Reply-To:Date:In-Reply-To:From;\n\tb=FdrGtd+EDfIlFkMPJSj5Ujfp3F8jioqXthvMN69goJkvbaOXC04qsdRMNRSONaWpu\n\tACuG5Lrnd9KDW6KePz0pnoT0JG06DTLO7npb+cowINGWozy/BVYrZkl6p4Vmv7Id/B\n\td3WlN1YVzFMtj8Z84e1+QAvWhE7Te+tVujOdwpPw=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210711231547.19664-1-laurent.pinchart@ideasonboard.com>\n\t<20210711231547.19664-3-laurent.pinchart@ideasonboard.com>\n\t<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","Organization":"Ideas on Board","Message-ID":"<85ffc8c2-3e73-3847-5a6e-168d58840909@ideasonboard.com>","Date":"Mon, 12 Jul 2021 08:56:00 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Reply-To":"kieran.bingham@ideasonboard.com","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18154,"web_url":"https://patchwork.libcamera.org/comment/18154/","msgid":"<YOy7Lb/Z5y2Mb+T0@pendragon.ideasonboard.com>","date":"2021-07-12T21:59:09","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Mon, Jul 12, 2021 at 08:50:14AM +0100, Kieran Bingham wrote:\n> On 12/07/2021 00:15, Laurent Pinchart wrote:\n> > The createIPA() template function starts with code that doesn't depend\n> > on the template parameters. Split it to a non-template function to avoid\n> > code duplication in the binary.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  include/libcamera/internal/ipa_manager.h | 13 ++++---------\n> >  src/libcamera/ipa_manager.cpp            | 17 +++++++++++++++++\n> >  2 files changed, 21 insertions(+), 9 deletions(-)\n> > \n> > diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\n> > index 42201839901b..0687842e5c06 100644\n> > --- a/include/libcamera/internal/ipa_manager.h\n> > +++ b/include/libcamera/internal/ipa_manager.h\n> > @@ -34,15 +34,7 @@ public:\n> >  \t\t\t\t\t    uint32_t minVersion,\n> >  \t\t\t\t\t    uint32_t maxVersion)\n> >  \t{\n> > -\t\tIPAModule *m = nullptr;\n> > -\n> > -\t\tfor (IPAModule *module : self_->modules_) {\n> > -\t\t\tif (module->match(pipe, minVersion, maxVersion)) {\n> > -\t\t\t\tm = module;\n> > -\t\t\t\tbreak;\n> > -\t\t\t}\n> > -\t\t}\n> > -\n> > +\t\tIPAModule *m = self_->module(pipe, minVersion, maxVersion);\n> >  \t\tif (!m)\n> >  \t\t\treturn nullptr;\n> >  \n> > @@ -62,6 +54,9 @@ private:\n> >  \t\t      std::vector<std::string> &files);\n> >  \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n> >  \n> > +\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n> > +\t\t\t  uint32_t maxVersion);\n> > +\n> >  \tbool isSignatureValid(IPAModule *ipa) const;\n> >  \n> >  \tstd::vector<IPAModule *> modules_;\n> > diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> > index b4606c6159e5..9533c8fadea6 100644\n> > --- a/src/libcamera/ipa_manager.cpp\n> > +++ b/src/libcamera/ipa_manager.cpp\n> > @@ -245,6 +245,23 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n> >  \treturn count;\n> >  }\n> >  \n> > +/**\n> > + * \\brief Retrieve and IPA module that matches a given pipeline handler\n\ns/and/an/\n\n> This actually finds the 'first' matching IPA module (for however the\n> list is sorted).\n> \n> We can already have multiple potentially matching IPA modules available\n> on a system. Should this be more explicit on what is matched?\n\nI think so, but if I wrote \"the first\" here, I'd have to define an\norder, and there's no defined ordered :-) That's why I went for \"an IPA\nmodule\". Note that this is a private function, so the documentation\nwon't be compiled.\n\nI think this should be addressed when we'll work on IPA module selection\namong multiple options.\n\n> > + * \\param[in] pipe The pipeline handler\n> > + * \\param[in] minVersion Minimum acceptable version of IPA module\n> > + * \\param[in] maxVersion Maximum acceptable version of IPA module\n> > + */\n> > +IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n> > +\t\t\t      uint32_t maxVersion)\n> > +{\n> > +\tfor (IPAModule *module : modules_) {\n> > +\t\tif (module->match(pipe, minVersion, maxVersion))\n> > +\t\t\treturn module;\n> > +\t}\n> > +\n> > +\treturn nullptr;\n> > +}\n> > +\n> >  /**\n> >   * \\fn IPAManager::createIPA()\n> >   * \\brief Create an IPA proxy that matches a given pipeline handler","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DEEDDC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jul 2021 21:59:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B02168521;\n\tMon, 12 Jul 2021 23:59:58 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BDF868513\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 23:59:56 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 07A84CC;\n\tMon, 12 Jul 2021 23:59:55 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Vr7yuLXD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626127196;\n\tbh=qDCyxvI7KmCCd3cRAdMpbl0qshHlr/EXpoFvuYvRom0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Vr7yuLXDBVK/EZqi8pneBen3Ynyrrhtm1heMspotnLvisd7QgcvkzVcbSw56aevq3\n\t5gPk8yVfnSAHfnLRMwWTUkaIdKemAZhQyYoISLHTUlOCX5/fu0jvgwf1ppOCKWwmNQ\n\tgx+rHCa3X7qx/kpda8BGx5W0bOGMdISkVmx3/NV8=","Date":"Tue, 13 Jul 2021 00:59:09 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YOy7Lb/Z5y2Mb+T0@pendragon.ideasonboard.com>","References":"<20210711231547.19664-1-laurent.pinchart@ideasonboard.com>\n\t<20210711231547.19664-3-laurent.pinchart@ideasonboard.com>\n\t<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":18220,"web_url":"https://patchwork.libcamera.org/comment/18220/","msgid":"<20210719031910.GH2395@pyrite.rasen.tech>","date":"2021-07-19T03:19:10","subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Kieran and Laurent,\n\nOn Tue, Jul 13, 2021 at 12:59:09AM +0300, Laurent Pinchart wrote:\n> Hi Kieran,\n> \n> On Mon, Jul 12, 2021 at 08:50:14AM +0100, Kieran Bingham wrote:\n> > On 12/07/2021 00:15, Laurent Pinchart wrote:\n> > > The createIPA() template function starts with code that doesn't depend\n> > > on the template parameters. Split it to a non-template function to avoid\n> > > code duplication in the binary.\n> > > \n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > ---\n> > >  include/libcamera/internal/ipa_manager.h | 13 ++++---------\n> > >  src/libcamera/ipa_manager.cpp            | 17 +++++++++++++++++\n> > >  2 files changed, 21 insertions(+), 9 deletions(-)\n> > > \n> > > diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h\n> > > index 42201839901b..0687842e5c06 100644\n> > > --- a/include/libcamera/internal/ipa_manager.h\n> > > +++ b/include/libcamera/internal/ipa_manager.h\n> > > @@ -34,15 +34,7 @@ public:\n> > >  \t\t\t\t\t    uint32_t minVersion,\n> > >  \t\t\t\t\t    uint32_t maxVersion)\n> > >  \t{\n> > > -\t\tIPAModule *m = nullptr;\n> > > -\n> > > -\t\tfor (IPAModule *module : self_->modules_) {\n> > > -\t\t\tif (module->match(pipe, minVersion, maxVersion)) {\n> > > -\t\t\t\tm = module;\n> > > -\t\t\t\tbreak;\n> > > -\t\t\t}\n> > > -\t\t}\n> > > -\n> > > +\t\tIPAModule *m = self_->module(pipe, minVersion, maxVersion);\n> > >  \t\tif (!m)\n> > >  \t\t\treturn nullptr;\n> > >  \n> > > @@ -62,6 +54,9 @@ private:\n> > >  \t\t      std::vector<std::string> &files);\n> > >  \tunsigned int addDir(const char *libDir, unsigned int maxDepth = 0);\n> > >  \n> > > +\tIPAModule *module(PipelineHandler *pipe, uint32_t minVersion,\n> > > +\t\t\t  uint32_t maxVersion);\n> > > +\n> > >  \tbool isSignatureValid(IPAModule *ipa) const;\n> > >  \n> > >  \tstd::vector<IPAModule *> modules_;\n> > > diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp\n> > > index b4606c6159e5..9533c8fadea6 100644\n> > > --- a/src/libcamera/ipa_manager.cpp\n> > > +++ b/src/libcamera/ipa_manager.cpp\n> > > @@ -245,6 +245,23 @@ unsigned int IPAManager::addDir(const char *libDir, unsigned int maxDepth)\n> > >  \treturn count;\n> > >  }\n> > >  \n> > > +/**\n> > > + * \\brief Retrieve and IPA module that matches a given pipeline handler\n> \n> s/and/an/\n> \n> > This actually finds the 'first' matching IPA module (for however the\n> > list is sorted).\n\nYeah, that's the behavior that we had in the first place.\n\n> > \n> > We can already have multiple potentially matching IPA modules available\n> > on a system. Should this be more explicit on what is matched?\n> \n> I think so, but if I wrote \"the first\" here, I'd have to define an\n> order, and there's no defined ordered :-) That's why I went for \"an IPA\n> module\". Note that this is a private function, so the documentation\n> won't be compiled.\n> \n> I think this should be addressed when we'll work on IPA module selection\n> among multiple options.\n\niirc, this was set as a todo and we just took the \"first\" (of whatever\norder) IPA \"for now\".\n\nAnd now that we finally have multiple IPAs it has to be addressed :S\n\n\nAnyway, for this patch,\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> \n> > > + * \\param[in] pipe The pipeline handler\n> > > + * \\param[in] minVersion Minimum acceptable version of IPA module\n> > > + * \\param[in] maxVersion Maximum acceptable version of IPA module\n> > > + */\n> > > +IPAModule *IPAManager::module(PipelineHandler *pipe, uint32_t minVersion,\n> > > +\t\t\t      uint32_t maxVersion)\n> > > +{\n> > > +\tfor (IPAModule *module : modules_) {\n> > > +\t\tif (module->match(pipe, minVersion, maxVersion))\n> > > +\t\t\treturn module;\n> > > +\t}\n> > > +\n> > > +\treturn nullptr;\n> > > +}\n> > > +\n> > >  /**\n> > >   * \\fn IPAManager::createIPA()\n> > >   * \\brief Create an IPA proxy that matches a given pipeline handler","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 69630C0109\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 Jul 2021 03:19:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D45D86853C;\n\tMon, 19 Jul 2021 05:19:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0E15660278\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 Jul 2021 05:19:19 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AC8DD465;\n\tMon, 19 Jul 2021 05:19:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"BnTpN2ui\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1626664758;\n\tbh=o5PLoy2KIx5ZQZOdT+qnQF4mWpGffza46aPlxdc+fGk=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BnTpN2uikrcsqo8I6wsXkU9zRBhAITecpgZ545W2bSvLo+VhhBqrCvM2RAd94AShq\n\tF9w92Yn9t3WEVLuWtoatgmGWzt6EPw0zAIPEOUJamatDksLVbyDT3bOWEwXn5gvJHZ\n\tzSkB2ZdjT9JNYasTD/+lu5gkuvDF8jmrBe60zMXg=","Date":"Mon, 19 Jul 2021 12:19:10 +0900","From":"paul.elder@ideasonboard.com","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210719031910.GH2395@pyrite.rasen.tech>","References":"<20210711231547.19664-1-laurent.pinchart@ideasonboard.com>\n\t<20210711231547.19664-3-laurent.pinchart@ideasonboard.com>\n\t<a72a880a-a016-c4ee-3746-0427607644a8@ideasonboard.com>\n\t<YOy7Lb/Z5y2Mb+T0@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<YOy7Lb/Z5y2Mb+T0@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/3] libcamera: ipa_manager: Split\n\tcommon code out of createIPA()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]