From patchwork Sun Jun 28 00:15:22 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: 8460 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 B353CC2E6A for ; Sun, 28 Jun 2020 00:15:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8EDC660AFD; Sun, 28 Jun 2020 02:15:50 +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 0F8E0609C8 for ; Sun, 28 Jun 2020 02:15:47 +0200 (CEST) X-Halon-ID: 6eec9ef4-b8d4-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 6eec9ef4-b8d4-11ea-86ee-0050569116f7; Sun, 28 Jun 2020 02:15:12 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sun, 28 Jun 2020 02:15:22 +0200 Message-Id: <20200628001532.2685967-4-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200628001532.2685967-1-niklas.soderlund@ragnatech.se> References: <20200628001532.2685967-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 sinks of the ImgU that where not active still needed to have buffers allocated to allow streaming to start. This is no longer true, it's enough that the sinks have imported buffers to allow streaming to start. As we already need to import buffers for stream 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: Jacopo Mondi Reviewed-by: Laurent Pinchart --- * Changes since v1 - Add comment - Update commit message --- src/libcamera/pipeline/ipu3/ipu3.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 405550b1302fb370..f35672f4761659f4 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) { @@ -1148,27 +1144,19 @@ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount) } /* - * 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. + * Import buffers for all outputs, regardless of whether the + * corresponding stream is active or inactive, as the driver needs + * buffers to be requested on the V4L2 devices in order to operate. */ - 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; }