From patchwork Tue Jun 30 13:05:17 2020 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: 8516 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CA852BFFE2 for ; Tue, 30 Jun 2020 13:05:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 39DE560C56; Tue, 30 Jun 2020 15:05:28 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4EB01609C7 for ; Tue, 30 Jun 2020 15:05:26 +0200 (CEST) X-Halon-ID: 5b30dc94-bad2-11ea-8fb8-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 5b30dc94-bad2-11ea-8fb8-005056917f90; Tue, 30 Jun 2020 15:05:25 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 30 Jun 2020 15:05:17 +0200 Message-Id: <20200630130518.99866-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/2] libcamera: ipu3: Make it easier to read when a request may be completed X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It's confusing to read the code and understand that a request is only completed before being processed by the ImgU if it only contains a single RAW buffer. Add a boolean variable with a explanatory name to make this clearer, no functional change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- * Changes since v1 - Rename flag from requestComplete to isComplete --- src/libcamera/pipeline/ipu3/ipu3.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 1bdad209de6e47fb..958d8362b55783de 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -874,10 +874,12 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) * If the request contains a buffer for the RAW stream only, complete it * now as there's no need for ImgU processing. */ - if (request->findBuffer(&rawStream_) && - pipe_->completeBuffer(camera_, request, buffer)) { - pipe_->completeRequest(camera_, request); - return; + if (request->findBuffer(&rawStream_)) { + bool isComplete = pipe_->completeBuffer(camera_, request, buffer); + if (isComplete) { + pipe_->completeRequest(camera_, request); + return; + } } imgu_->input_->queueBuffer(buffer); From patchwork Tue Jun 30 13:05:18 2020 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: 8517 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 90710BFFE2 for ; Tue, 30 Jun 2020 13:05:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BA02A60C5C; Tue, 30 Jun 2020 15:05:28 +0200 (CEST) Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CADDF609C7 for ; Tue, 30 Jun 2020 15:05:26 +0200 (CEST) X-Halon-ID: 5d3440f1-bad2-11ea-8fb8-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id 5d3440f1-bad2-11ea-8fb8-005056917f90; Tue, 30 Jun 2020 15:05:26 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 30 Jun 2020 15:05:18 +0200 Message-Id: <20200630130518.99866-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200630130518.99866-1-niklas.soderlund@ragnatech.se> References: <20200630130518.99866-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] libcamera: ipu3: cio2: Do not proxy signal X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Do not proxy the signal in the CI2Device when there is no need for it, remove it. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- This is a leftover form the CIO2 rework which fell thru the cracks I'm sorry I missed to resort it in the last version. * Changes since v1 - Merge the return with the last function call in CIO2Device::init(). --- src/libcamera/pipeline/ipu3/cio2.cpp | 14 +------------- src/libcamera/pipeline/ipu3/cio2.h | 6 +++--- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index aa1459fb3599283b..97a434a73b2855e5 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -15,7 +15,6 @@ #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/media_device.h" #include "libcamera/internal/v4l2_subdevice.h" -#include "libcamera/internal/v4l2_videodevice.h" namespace libcamera { @@ -121,13 +120,7 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) std::string cio2Name = "ipu3-cio2 " + std::to_string(index); output_ = V4L2VideoDevice::fromEntityName(media, cio2Name); - ret = output_->open(); - if (ret) - return ret; - - output_->bufferReady.connect(this, &CIO2Device::cio2BufferReady); - - return 0; + return output_->open(); } /** @@ -289,9 +282,4 @@ void CIO2Device::freeBuffers() LOG(IPU3, Error) << "Failed to release CIO2 buffers"; } -void CIO2Device::cio2BufferReady(FrameBuffer *buffer) -{ - bufferReady.emit(buffer); -} - } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h index dc764b101f112f05..4fd949f8e5132e07 100644 --- a/src/libcamera/pipeline/ipu3/cio2.h +++ b/src/libcamera/pipeline/ipu3/cio2.h @@ -13,15 +13,15 @@ #include +#include "libcamera/internal/v4l2_videodevice.h" + namespace libcamera { class CameraSensor; class FrameBuffer; class MediaDevice; class Request; -class V4L2DeviceFormat; class V4L2Subdevice; -class V4L2VideoDevice; struct Size; struct StreamConfiguration; @@ -48,7 +48,7 @@ public: int queueBuffer(Request *request, FrameBuffer *rawBuffer); void tryReturnBuffer(FrameBuffer *buffer); - Signal bufferReady; + Signal &bufferReady() { return output_->bufferReady; } private: void freeBuffers(); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 958d8362b55783de..00559ce318e1b8c3 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -805,7 +805,7 @@ int PipelineHandlerIPU3::registerCameras() * associated ImgU input where they get processed and * returned through the ImgU main and secondary outputs. */ - data->cio2_.bufferReady.connect(data.get(), + data->cio2_.bufferReady().connect(data.get(), &IPU3CameraData::cio2BufferReady); data->imgu_->input_->bufferReady.connect(&data->cio2_, &CIO2Device::tryReturnBuffer);