[{"id":1769,"web_url":"https://patchwork.libcamera.org/comment/1769/","msgid":"<20190605133048.GA4784@pendragon.ideasonboard.com>","date":"2019-06-05T13:30:48","subject":"Re: [libcamera-devel] [PATCH v3 02/10] libcamera: pipeline: add name","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 Tue, Jun 04, 2019 at 08:53:08PM -0400, Paul Elder wrote:\n> In order to match an IPA module with a pipeline handler, the pipeline\n> handler must have a name. Add a name attribute and getter to\n> PipelineHandler such that it can automatically be defined by\n> REGISTER_PIPELINE_HANDLER.\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 v3:\n> - remove version completely from the pipeline hander's side, as the\n>   pipeline handler will now specify its acceptable version range when it\n>   asks the IPAManager for an IPAInterface (so IPAModules still need a\n>   pipeline version)\n> - nicer, less intrusive way of setting the pipeline names by making the\n>   pipeline handler factory a friend class of pipeline handler\n> \n> Changes in v2:\n> - make the name and version getters into methods of the base PipelineHandler\n>   class, so that the specialized pipeline handlers no longer have to\n>   specify overriding\n> - add PIPELINE_VERSION macro to create one version number from major and\n>   minor pair\n> \n>  src/libcamera/include/pipeline_handler.h | 14 +++++++++++++-\n>  src/libcamera/pipeline_handler.cpp       | 17 +++++++++++++++++\n>  2 files changed, 30 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\n> index 7da6df1..84307e4 100644\n> --- a/src/libcamera/include/pipeline_handler.h\n> +++ b/src/libcamera/include/pipeline_handler.h\n> @@ -77,6 +77,8 @@ public:\n>  \tbool completeBuffer(Camera *camera, Request *request, Buffer *buffer);\n>  \tvoid completeRequest(Camera *camera, Request *request);\n>  \n> +\tconst char *name() const { return name_; }\n> +\n>  protected:\n>  \tvoid registerCamera(std::shared_ptr<Camera> camera,\n>  \t\t\t    std::unique_ptr<CameraData> data);\n> @@ -93,6 +95,10 @@ private:\n>  \tstd::vector<std::shared_ptr<MediaDevice>> mediaDevices_;\n>  \tstd::vector<std::weak_ptr<Camera>> cameras_;\n>  \tstd::map<const Camera *, std::unique_ptr<CameraData>> cameraData_;\n> +\n> +\tconst char *name_;\n> +\n> +\tfriend class PipelineHandlerFactory;\n>  };\n>  \n>  class PipelineHandlerFactory\n> @@ -108,6 +114,9 @@ public:\n>  \tstatic void registerType(PipelineHandlerFactory *factory);\n>  \tstatic std::vector<PipelineHandlerFactory *> &factories();\n>  \n> +protected:\n> +\tvoid setInfo(PipelineHandler *handler, const char *name);\n> +\n>  private:\n>  \tstd::string name_;\n>  };\n> @@ -119,7 +128,10 @@ public:\t\t\t\t\t\t\t\t\t\\\n>  \thandler##Factory() : PipelineHandlerFactory(#handler) {}\t\\\n>  \tstd::shared_ptr<PipelineHandler> create(CameraManager *manager)\t\\\n>  \t{\t\t\t\t\t\t\t\t\\\n> -\t\treturn std::make_shared<handler>(manager);\t\t\\\n> +\t\tstd::shared_ptr<handler> h =\t\t\t\t\\\n> +\t\t\tstd::make_shared<handler>(manager);\t\t\\\n> +\t\tsetInfo(h.get(), #handler);\t\t\t\t\\\n> +\t\treturn h;\t\t\t\t\t\t\\\n>  \t}\t\t\t\t\t\t\t\t\\\n>  };\t\t\t\t\t\t\t\t\t\\\n>  static handler##Factory global_##handler##Factory;\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index dd56907..800931d 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -505,6 +505,12 @@ CameraData *PipelineHandler::cameraData(const Camera *camera)\n>   * constant for the whole lifetime of the pipeline handler.\n>   */\n>  \n> +/**\n> + * \\fn PipelineHandler::name()\n> + * \\brief Retrieve the pipeline handler name\n> + * \\return The pipeline handler name\n> + */\n> +\n>  /**\n>   * \\class PipelineHandlerFactory\n>   * \\brief Registration of PipelineHandler classes and creation of instances\n> @@ -582,6 +588,17 @@ std::vector<PipelineHandlerFactory *> &PipelineHandlerFactory::factories()\n>  \treturn factories;\n>  }\n>  \n> +/**\n> + * \\brief Set the information of a given pipeline handler\n> + * \\param[in] handler The handler whose info is to be set\n> + * \\param[in] name The name of the pipeline handler\n> + */\n> +void PipelineHandlerFactory::setInfo(PipelineHandler *handler,\n> +\t\t\t\t     const char *name)\n> +{\n> +\thandler->name_ = name;\n> +}\n> +\n>  /**\n>   * \\def REGISTER_PIPELINE_HANDLER\n>   * \\brief Register a pipeline handler with the pipeline handler factory","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 683B665F89\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  5 Jun 2019 15:31:16 +0200 (CEST)","from pendragon.ideasonboard.com (85-76-19-33-nat.elisa-mobile.fi\n\t[85.76.19.33])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1964784;\n\tWed,  5 Jun 2019 15:31:14 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1559741476;\n\tbh=yVUhM9OYOYqdlIa+2s7w0jP1+8sCMbqf7meoj6NFOyY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WSECwyOU7WHnjR0ZKyFfJHCJRGvA9nIIMsTHQ9B/baCVEXV+ykfLNW05ibW/GgAdy\n\tLNjA5fzB1AZT/sGvB63zDk7YSG/uTek2inRbD2+yD2C7k0+4kJVOGQbdxg/Ma9xXwb\n\tDKEpnXxARM6NTeZIFh3a/XxBPvQqF4g8hdNiDgZ0=","Date":"Wed, 5 Jun 2019 16:30:48 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190605133048.GA4784@pendragon.ideasonboard.com>","References":"<20190605005316.4835-1-paul.elder@ideasonboard.com>\n\t<20190605005316.4835-3-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190605005316.4835-3-paul.elder@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v3 02/10] libcamera: pipeline: add name","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":"Wed, 05 Jun 2019 13:31:16 -0000"}}]