From patchwork Sat Jun 27 03:00:33 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: 8445 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 C7346C2E66 for ; Sat, 27 Jun 2020 03:00:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9F18E60AF7; Sat, 27 Jun 2020 05:00:54 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 768A1609C8 for ; Sat, 27 Jun 2020 05:00:52 +0200 (CEST) X-Halon-ID: 5436d7ec-b822-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 5436d7ec-b822-11ea-86ee-0050569116f7; Sat, 27 Jun 2020 05:00:19 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sat, 27 Jun 2020 05:00:33 +0200 Message-Id: <20200627030043.2088585-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200627030043.2088585-1-niklas.soderlund@ragnatech.se> References: <20200627030043.2088585-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/13] libcamera: ipu3: Always import buffers for ImgU sinks 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" When the IPU3 pipeline was first developed buffers of sinks from the ImgU that where not active still needed to have allocated buffers associated with them or streaming was not allowed to start. This is no longer true, it's enough that the sinks have imported buffers for streaming to start. As we already need to import buffers for streams that are active we can align the two cases and always import buffers. With this there is no longer a reason to store the allocated FrameBuffers to keep them alive and the vector tracking them can be removed. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 405550b1302fb370..5a473e18c082cee8 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -49,7 +49,6 @@ public: V4L2VideoDevice *dev; unsigned int pad; std::string name; - std::vector> buffers; }; ImgUDevice() @@ -1124,9 +1123,6 @@ int ImgUDevice::configureOutput(ImgUOutput *output, */ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount) { - IPU3Stream *outStream = &data->outStream_; - IPU3Stream *vfStream = &data->vfStream_; - /* Share buffers between CIO2 output and ImgU input. */ int ret = input_->importBuffers(bufferCount); if (ret) { @@ -1147,28 +1143,15 @@ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount) goto error; } - /* - * Allocate buffers for both outputs. If an output is active, prepare - * for buffer import, otherwise allocate internal buffers. Use the same - * number of buffers in either case. - */ - if (outStream->active_) - ret = output_.dev->importBuffers(bufferCount); - else - ret = output_.dev->allocateBuffers(bufferCount, - &output_.buffers); + ret = output_.dev->importBuffers(bufferCount); if (ret < 0) { - LOG(IPU3, Error) << "Failed to allocate ImgU output buffers"; + LOG(IPU3, Error) << "Failed to import ImgU output buffers"; goto error; } - if (vfStream->active_) - ret = viewfinder_.dev->importBuffers(bufferCount); - else - ret = viewfinder_.dev->allocateBuffers(bufferCount, - &viewfinder_.buffers); + ret = viewfinder_.dev->importBuffers(bufferCount); if (ret < 0) { - LOG(IPU3, Error) << "Failed to allocate ImgU viewfinder buffers"; + LOG(IPU3, Error) << "Failed to import ImgU viewfinder buffers"; goto error; }