[{"id":2601,"web_url":"https://patchwork.libcamera.org/comment/2601/","msgid":"<20190904180952.GE5433@pendragon.ideasonboard.com>","date":"2019-09-04T18:09:52","subject":"Re: [libcamera-devel] [PATCH v2 05/14] libcamera: pipeline: Add\n\tcallback to initialize IPA","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Fri, Aug 30, 2019 at 01:26:44AM +0200, Niklas Söderlund wrote:\n> Add a callback so the IPA can be initialized before a camera is exposed\n> to an application.\n> \n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/include/pipeline_handler.h |  2 ++\n>  src/libcamera/pipeline_handler.cpp       | 20 ++++++++++++++++++++\n>  2 files changed, 22 insertions(+)\n> \n> diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\n> index 91d40ef40a465c4e..ca40e7ef2b85f372 100644\n> --- a/src/libcamera/include/pipeline_handler.h\n> +++ b/src/libcamera/include/pipeline_handler.h\n> @@ -43,6 +43,8 @@ public:\n>  \t}\n>  \tvirtual ~CameraData() {}\n>  \n> +\tvirtual int initIPA() { return 0; };\n> +\n>  \tCamera *camera_;\n>  \tPipelineHandler *pipe_;\n>  \tstd::list<Request *> queuedRequests_;\n> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\n> index 846272485c7d2fc0..613751619a398968 100644\n> --- a/src/libcamera/pipeline_handler.cpp\n> +++ b/src/libcamera/pipeline_handler.cpp\n> @@ -66,6 +66,20 @@ LOG_DEFINE_CATEGORY(Pipeline)\n>   * is needed for the camera both parameters should be set to 0.\n>   */\n>  \n> +/**\n> + * \\fn CameraData::initIPA()\n> + * \\brief Callback to initialize the IPA\n> + *\n> + * This callback is called once a IPA have been associated with the camera.\n> + * It allows the CameraData to preform initialization of the IPA before the\n> + * camera is registered in the system.\n> + *\n> + * If this callback returns an error, the camera it represents will not be\n> + * registered in the system.\n> + *\n> + * \\return 0 on success or a negative error code otherwise\n> + */\n\nThis calls for an explicit loadIPA() method as proposed in the review of\n03/14, to let the pipeline handler initialise the IPA before registering\nthe camera. Furthermore, looking at the patch that uses this (14/14),\nit's as much about initialising the IPA than the pipeline handler, so\nthe method isn't well named. Dropping it will avoid having to find a\ngood name :-)\n\n> +\n>  /**\n>   * \\var CameraData::camera_\n>   * \\brief The camera related to this CameraData instance\n> @@ -461,6 +475,12 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera,\n>  \t\t\t\t\t       << \" no IPA found\";\n>  \t\t\treturn;\n>  \t\t}\n> +\n> +\t\tif (data->initIPA()) {\n> +\t\t\tLOG(Pipeline, Warning) << \"Skipping \" << camera->name()\n> +\t\t\t\t<< \" initialization of camera data failed\";\n> +\t\t\treturn;\n> +\t\t}\n>  \t}\n>  \n>  \tcameraData_[camera.get()] = std::move(data);","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 1769060BB2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Sep 2019 20:09:59 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8E149440;\n\tWed,  4 Sep 2019 20:09:58 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1567620598;\n\tbh=tyS/Vx8rfDS/ANFkdwG7sPyyY7NRz3zDOL9iYPvwhSc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=hdY0YTyfZtwpmMlWk/3frIpFqR9TDMIpKC8f74QVILEucjIWtnQlSMFOHgBNAcqYQ\n\tsiDm69XgiHeLvibdSnfzwVpP0eR4YsbTiRaHF4m65vtlqDz/giy0eacbGH/T7XsNeP\n\t103InGsKP3YVj0li80J9fMBbdqMXIXJmIlIYHLa8=","Date":"Wed, 4 Sep 2019 21:09:52 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190904180952.GE5433@pendragon.ideasonboard.com>","References":"<20190829232653.13214-1-niklas.soderlund@ragnatech.se>\n\t<20190829232653.13214-6-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190829232653.13214-6-niklas.soderlund@ragnatech.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 05/14] libcamera: pipeline: Add\n\tcallback to initialize IPA","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, 04 Sep 2019 18:09:59 -0000"}}]