From patchwork Thu Aug 29 23:26:43 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: 1891 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1D0EB60E38 for ; Fri, 30 Aug 2019 01:27:32 +0200 (CEST) X-Halon-ID: 8f9d23e4-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 8f9d23e4-cab4-11e9-837a-0050569116f7; Fri, 30 Aug 2019 01:27:26 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 30 Aug 2019 01:26:43 +0200 Message-Id: <20190829232653.13214-5-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 04/14] libcamera: pipeline: Add method to prepare internal buffers 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 Buffers internal to a pipeline handler (buffers cycled between a CSI-2 pipeline to a ISP pipeline, parameters and statistics buffers) needs to be prepared before they can be properly used inside a pipeline handler. At this point the preparation consists of mapping the Buffer objects memory and associating it with a request. Instead of adding this helper on the Buffer object itself add it to the pipeline handler base class to prevent it from being exposed to applications. Signed-off-by: Niklas Söderlund --- src/libcamera/include/pipeline_handler.h | 2 ++ src/libcamera/pipeline_handler.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h index ffc7adb802215313..91d40ef40a465c4e 100644 --- a/src/libcamera/include/pipeline_handler.h +++ b/src/libcamera/include/pipeline_handler.h @@ -98,6 +98,8 @@ protected: CameraData *cameraData(const Camera *camera); + void prepareInternalBuffer(Buffer *buffer, Request *request, + BufferMemory *mem); CameraManager *manager_; private: diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 558b4b254d111e31..846272485c7d2fc0 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -485,6 +485,24 @@ void PipelineHandler::hotplugMediaDevice(MediaDevice *media) media->disconnected.connect(this, &PipelineHandler::mediaDeviceDisconnected); } +/** + * \brief Prepare buffer for internal usage by a pipeline handler + * \param[in,out] buffer The buffer to prepare + * \param[in] request The request to associate the \a buffer with + * \param[in] mem The memory to associate the \a buffer with + * + * Pipeline handlers creating internal buffers to facilitate data flow in the + * pipeline need to prepare the buffers by setting up the buffer object state. + * This function help pipeline handler implementations to perform this + * preparation. + */ +void PipelineHandler::prepareInternalBuffer(Buffer *buffer, Request *request, + BufferMemory *mem) +{ + buffer->request_ = request; + buffer->mem_ = mem; +} + /** * \brief Slot for the MediaDevice disconnected signal */