From patchwork Tue Jun 2 01:39:04 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: 3894 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 6665661080 for ; Tue, 2 Jun 2020 03:39:30 +0200 (CEST) X-Halon-ID: d57809e7-a471-11ea-a73e-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id d57809e7-a471-11ea-a73e-0050569116f7; Tue, 02 Jun 2020 03:39:00 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 2 Jun 2020 03:39:04 +0200 Message-Id: <20200602013909.3170593-6-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200602013909.3170593-1-niklas.soderlund@ragnatech.se> References: <20200602013909.3170593-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] libcamera: ipu3: Calculate number of buffers for ImgU 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: , X-List-Received-Date: Tue, 02 Jun 2020 01:39:31 -0000 Decouple the number of buffers to allocate for the ImgU from the number of buffers allocated for the CIO2. Instead of blindly following the CIO2 pick the maximum number of buffers requested for any stream facing applications. This is potentially wasteful, as each stream could allocate just as many buffers as requested by the application instead of the maximum from the set. But this is not more wasteful then whats already used by the pipeline and should be fixed on top after the decoupling of the two processing units. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 0e7555c716b36749..f4759715c6ae7572 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -729,14 +729,16 @@ int PipelineHandlerIPU3::allocateBuffers(Camera *camera) IPU3CameraData *data = cameraData(camera); CIO2Device *cio2 = &data->cio2_; ImgUDevice *imgu = data->imgu_; - unsigned int bufferCount; + unsigned int bufferCount = 0; int ret; ret = cio2->allocateBuffers(); if (ret < 0) return ret; - bufferCount = ret; + bufferCount = std::max(data->outStream_.configuration().bufferCount, bufferCount); + bufferCount = std::max(data->vfStream_.configuration().bufferCount, bufferCount); + bufferCount = std::max(data->rawStream_.configuration().bufferCount, bufferCount); ret = imgu->allocateBuffers(data, bufferCount); if (ret < 0) {