[{"id":1755,"web_url":"https://patchwork.libcamera.org/comment/1755/","msgid":"<20190604105816.GI4771@pendragon.ideasonboard.com>","date":"2019-06-04T10:58:16","subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: ipa_module: match\n\tIPA module with pipeline handler","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 Mon, Jun 03, 2019 at 07:16:32PM -0400, Paul Elder wrote:\n> Add a method to IPAModule to check if it matches with a given pipeline\n> handler.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n> New patch, but this IPAModule::match method used to be IPAManager::match\n> \n>  src/libcamera/include/ipa_module.h |  4 ++++\n>  src/libcamera/ipa_module.cpp       | 19 +++++++++++++++++++\n>  2 files changed, 23 insertions(+)\n> \n> diff --git a/src/libcamera/include/ipa_module.h b/src/libcamera/include/ipa_module.h\n> index 557435c..48ff2b6 100644\n> --- a/src/libcamera/include/ipa_module.h\n> +++ b/src/libcamera/include/ipa_module.h\n> @@ -13,6 +13,8 @@\n>  #include <libcamera/ipa/ipa_interface.h>\n>  #include <libcamera/ipa/ipa_module_info.h>\n>  \n> +#include \"pipeline_handler.h\"\n\nYou can forward-declare class PipelineHandler instead of including this\nfile.\n\n> +\n>  namespace libcamera {\n>  \n>  class IPAModule\n> @@ -29,6 +31,8 @@ public:\n>  \n>  \tstd::unique_ptr<IPAInterface> createInstance();\n>  \n> +\tbool match(PipelineHandler *pipe) const;\n> +\n>  private:\n>  \tstruct IPAModuleInfo info_;\n>  \n> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\n> index 91d97ae..c1b04fe 100644\n> --- a/src/libcamera/ipa_module.cpp\n> +++ b/src/libcamera/ipa_module.cpp\n> @@ -18,6 +18,7 @@\n>  #include <unistd.h>\n>  \n>  #include \"log.h\"\n> +#include \"pipeline_handler.h\"\n>  \n>  /**\n>   * \\file ipa_module.h\n> @@ -417,4 +418,22 @@ std::unique_ptr<IPAInterface> IPAModule::createInstance()\n>  \treturn std::unique_ptr<IPAInterface>(ipaCreate_());\n>  }\n>  \n> +/**\n> + * \\brief Match this IPAModule with a PipelineHandler\n\n\"Verify if the IPA module matches a given pipeline handler\" ?\n\n> + * \\param[in] pipe Pipeline handler to match with\n> + *\n> + * Checks if this IPA module matches the \\a pipe pipeline handler.\n\n\"This method checks\" or \"Check\". I'd go for the former.\n\n> + * Matching is based on the fields of the IPA module info, and the\n> + * corresponding attributes of the pipeline handler, such as pipeline version\n> + * and name.\n> + *\n> + * \\return true if the pipeline handler matches the IPA module, false otherwise\n\ns/true/True/\ns/false/ or false/\n\n> + */\n> +bool IPAModule::match(PipelineHandler *pipe) const\n> +{\n> +\treturn info_.moduleAPIVersion == IPA_MODULE_API_VERSION &&\n\nI would move the first check to IPAModule::loadIPAModuleInfo(), as an\ninvalid module API version means we can't interpret the contents of the\nstructure, so we can use the module at all.\n\n> +\t       info_.pipelineVersion == pipe->version() &&\n\nI was about to write that we should match the major exactly and the\nminor with a minimum required version, but given that we're still\ndiscussing how to handle IPA versioning, would it make sense to drop the\ncomments that explain how major/minor versions work in the other\npatches, and just require an exact match for now ? It will make this\nseries a bit simpler, and avoid blocking it until we sort out the\nversioning scheme. What do you think ? If you agree, with the small\nissues above fixed,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\t       !strcmp(info_.pipelineName, pipe->name());\n> +}\n> +\n>  } /* namespace libcamera */","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 E751861FD8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  4 Jun 2019 12:58:29 +0200 (CEST)","from pendragon.ideasonboard.com (unknown\n\t[IPv6:2a02:2788:668:163:5bb7:9f6c:564c:d55e])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 715D55D;\n\tTue,  4 Jun 2019 12:58:29 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1559645909;\n\tbh=u2bw//l1/EhkFWuaGDapbcc00DHTZlSxOMkel/xju44=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JYQH5Ga8d5IWMyFAoDdEYHr0YRY/z2OccAB2VTHacYws1E0tbJy94bf3B3duQTIeC\n\tTav3iTl0C7zaEybdl73Vgdl2Q4CsR+iOnvnll/HTaIEqZobYQZ4YfzVopeHiBOjMGc\n\tFGX2vw0kRRBIMhvPswNB8b93HcZgsYLfQ2yBw8nw=","Date":"Tue, 4 Jun 2019 13:58:16 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190604105816.GI4771@pendragon.ideasonboard.com>","References":"<20190603231637.28554-1-paul.elder@ideasonboard.com>\n\t<20190603231637.28554-6-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190603231637.28554-6-paul.elder@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 05/10] libcamera: ipa_module: match\n\tIPA module with pipeline handler","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":"Tue, 04 Jun 2019 10:58:30 -0000"}}]