From patchwork Thu Aug 29 23:26:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 1892 Return-Path: Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A43E060BE5 for ; Fri, 30 Aug 2019 01:27:32 +0200 (CEST) X-Halon-ID: 8fee1d91-cab4-11e9-837a-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [79.202.45.17]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 8fee1d91-cab4-11e9-837a-0050569116f7; Fri, 30 Aug 2019 01:27:27 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Aug 2019 01:26:44 +0200 Message-Id: <20190829232653.13214-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20190829232653.13214-1-niklas.soderlund@ragnatech.se> References: <20190829232653.13214-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 05/14] libcamera: pipeline: Add callback to initialize IPA X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Aug 2019 23:27:33 -0000 Add a callback so the IPA can be initialized before a camera is exposed to an application. Signed-off-by: Niklas Söderlund --- src/libcamera/include/pipeline_handler.h | 2 ++ src/libcamera/pipeline_handler.cpp | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index 91d40ef40a465c4e..ca40e7ef2b85f372 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -43,6 +43,8 @@ public: } virtual ~CameraData() {} + virtual int initIPA() { return 0; }; + Camera *camera_; PipelineHandler *pipe_; std::list queuedRequests_; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 846272485c7d2fc0..613751619a398968 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -66,6 +66,20 @@ LOG_DEFINE_CATEGORY(Pipeline) * is needed for the camera both parameters should be set to 0. */ +/** + * \fn CameraData::initIPA() + * \brief Callback to initialize the IPA + * + * This callback is called once a IPA have been associated with the camera. + * It allows the CameraData to preform initialization of the IPA before the + * camera is registered in the system. + * + * If this callback returns an error, the camera it represents will not be + * registered in the system. + * + * \return 0 on success or a negative error code otherwise + */ + /** * \var CameraData::camera_ * \brief The camera related to this CameraData instance @@ -461,6 +475,12 @@ void PipelineHandler::registerCamera(std::shared_ptr camera, << " no IPA found"; return; } + + if (data->initIPA()) { + LOG(Pipeline, Warning) << "Skipping " << camera->name() + << " initialization of camera data failed"; + return; + } } cameraData_[camera.get()] = std::move(data);