From patchwork Sun Jun 28 00:15:21 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: 8459 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 597A1C2E69 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 0FC3B60AF4; Sun, 28 Jun 2020 02:15:49 +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 6CC90609C5 for ; Sun, 28 Jun 2020 02:15:46 +0200 (CEST) X-Halon-ID: 6e959b43-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 6e959b43-b8d4-11ea-86ee-0050569116f7; Sun, 28 Jun 2020 02:15:11 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sun, 28 Jun 2020 02:15:21 +0200 Message-Id: <20200628001532.2685967-3-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 02/13] libcamera: ipu3: Import instead of allocate statistic buffers 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" Statistics buffers are not yet used by the IPU3 pipeline, they are never queued to the video device or in any other way consumed. The kernel driver will however not allow video streaming to start if buffers are not either allocated or imported on the video device. Instead of allocating the buffers wasting memory that is never used import buffers. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fba45935741e0e4e..405550b1302fb370 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1135,11 +1135,13 @@ int ImgUDevice::allocateBuffers(IPU3CameraData *data, unsigned int bufferCount) } /* - * Use for the stat's internal pool the same number of buffers as for - * the input pool. + * The kernel fails to start if buffers are not either imported or + * allocated for the statisitcs video device. As statistics buffers are + * not yet used by the pipeline import buffers to save memory. + * * \todo To be revised when we'll actually use the stat node. */ - ret = stat_.dev->allocateBuffers(bufferCount, &stat_.buffers); + ret = stat_.dev->importBuffers(bufferCount); if (ret < 0) { LOG(IPU3, Error) << "Failed to allocate ImgU stat buffers"; goto error;