From patchwork Tue Mar 12 12:12:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 726 Return-Path: Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D4E8610D5 for ; Tue, 12 Mar 2019 13:12:26 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BFFBC1C0002; Tue, 12 Mar 2019 12:12:25 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 12 Mar 2019 13:12:39 +0100 Message-Id: <20190312121242.2253-12-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312121242.2253-1-jacopo@jmondi.org> References: <20190312121242.2253-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 11/14] libcamera: ipu3: Connect CIO2 and ImgU bufferReady signals 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: Tue, 12 Mar 2019 12:12:26 -0000 Connect the CIO2 output bufferRead signal to a slot that simply queue the received buffer to ImgU for processing, and connect the ImgU main output bufferReady signal to the cameraData slot that notifies to applications that a new image buffer is available. Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 58 +++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1a7b96d9ada7..4d08383291ea 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -95,7 +95,9 @@ public: { } - void bufferReady(Buffer *buffer); + void imguOutputBufferReady(Buffer *buffer); + void imguInputBufferReady(Buffer *buffer); + void cio2BufferReady(Buffer *buffer); CIO2Device cio2; ImgUDevice *imgu; @@ -402,6 +404,21 @@ int PipelineHandlerIPU3::start(Camera *camera) IPU3CameraData *data = cameraData(camera); int ret; + /* + * Connect video devices' 'bufferReady' signals to their slot to + * implement the image processing pipeline. + * + * Frames produced by the CIO2 unit are shared with the associated + * ImgU input where they get processed and returned through the ImgU + * main and secondary outputs. + */ + data->cio2.output->bufferReady.connect(data, + &IPU3CameraData::cio2BufferReady); + data->imgu->input->bufferReady.connect(data, + &IPU3CameraData::imguInputBufferReady); + data->imgu->output->bufferReady.connect(data, + &IPU3CameraData::imguOutputBufferReady); + /* * Enqueue all available buffers to the CIO2 unit to start frame * capture. Start ImgU video devices and queue buffers to the output @@ -1001,9 +1018,6 @@ void PipelineHandlerIPU3::registerCameras() std::shared_ptr camera = Camera::create(this, cameraName, streams); - cio2->output->bufferReady.connect(data.get(), - &IPU3CameraData::bufferReady); - registerCamera(std::move(camera), std::move(data)); LOG(IPU3, Info) @@ -1015,7 +1029,29 @@ void PipelineHandlerIPU3::registerCameras() } } -void IPU3CameraData::bufferReady(Buffer *buffer) +/* ---------------------------------------------------------------------------- + * Buffer Ready slots + */ + +/** + * \brief ImgU input BufferReady slot + * \param buffer The completed buffer + * + * Buffer completed from the ImgU input are immediately queued back to the + * CIO2 unit to continue frame capture. + */ +void IPU3CameraData::imguInputBufferReady(Buffer *buffer) +{ + cio2.output->queueBuffer(buffer); +} + +/** + * \brief ImgU output BufferReady slot + * \param buffer The completed buffer + * + * Buffer completed from the ImgU output are directed to the applications. + */ +void IPU3CameraData::imguOutputBufferReady(Buffer *buffer) { Request *request = queuedRequests_.front(); @@ -1023,6 +1059,18 @@ void IPU3CameraData::bufferReady(Buffer *buffer) pipe_->completeRequest(camera_, request); } +/** + * \brief CIO2 BufferReady slot + * \param buffer The completed buffer + * + * Buffer completed from the CIO2 are immediately queued to the ImgU unit + * for further processing. + */ +void IPU3CameraData::cio2BufferReady(Buffer *buffer) +{ + imgu->input->queueBuffer(buffer); +} + REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3); } /* namespace libcamera */