From patchwork Wed Dec 28 22:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 18060 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 BED36C3220 for ; Wed, 28 Dec 2022 22:30:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E3D2625E3; Wed, 28 Dec 2022 23:30:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672266626; bh=CAXuEf1hBrJKDEj/grW5ODI+EwoIENTtnlZfVsD3a4o=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=d/A+rnaZMw9xCYLbaTBq/3GPFMZr6fHeRnw+8OSOC7S4FYCC/Z1qBvwffKskc5sXQ gszczQ0Z8rKEnNCFMJONdrbh52lsgBasbkpF4KZbXrAiYZq8SWinzP96vYOEjF+P0z 3+fBF5epXDmCjRtBZLCKG1rcv55Mn36MotFqG0/9xwXfLrd7lG9TOLCDIm7TWRKSoG +mKMYwyx2wjQOGMY8Po7t5AhJZPdnIGTwOObv2F6qzYY+yi6SLkLm403vYhvs02ZLM XUGaBrXIjPAAF8XRzxl0IKrPsz1NC5wQi+b5dH+eAa+JNREE99dz26s5yn1g/1gmc1 L5Y+zFTv+kXOQ== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 593BB625C8 for ; Wed, 28 Dec 2022 23:30:22 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nFltqDLM"; dkim-atps=neutral Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad8a:9000:1bf9:855b:22de:3645]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D4AEA109; Wed, 28 Dec 2022 23:30:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1672266621; bh=CAXuEf1hBrJKDEj/grW5ODI+EwoIENTtnlZfVsD3a4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFltqDLM8/7PXInfu2QC7QHfjXaKIG/p0xa3vbtSU2UETBeei/gY9bOaehrBlKZI/ 9JSjoJfHD+0JaMrFG+L1S/YPwJ4dkpFn4+dIbdsgOblnwLuCS/tcAi7M5THhsSjBq5 uB9GQM3KxSOhcaIzqTOuV4YKJnjEaj4AjnBT2Tks= To: libcamera-devel@lists.libcamera.org Date: Wed, 28 Dec 2022 16:29:48 -0600 Message-Id: <20221228223003.2265712-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221228223003.2265712-1-paul.elder@ideasonboard.com> References: <20221228223003.2265712-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v10 04/19] libcamera: pipeline: raspberrypi: Don't rely on bufferCount 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-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Nícolas F. R. A. Prado Currently the raspberrypi pipeline handler relies on bufferCount to decide on the number of buffers to allocate internally and for the number of V4L2 buffer slots to reserve. There alrady exists a procedure for determining the number of buffers to reserve, so to remove reliance onf bufferCount we simply replace the one instance that it is used in, as well as remove populating it in generateConfiguration(). Signed-off-by: Nícolas F. R. A. Prado Signed-off-by: Paul Elder --- Changes in v10: - completely changed, to leverage the existing buffer count calculations - the refactoring that was in v9's rebase wasn't necessary, i think - this also makes it conflict less with [1] which ought to be coming soon [1] https://patchwork.libcamera.org/project/libcamera/list/?series=3663 Changes in v9: - rebased - I've decided that the buffer allocation decisions that Nícolas implemented covered the same cases that were added in PipelineHandlerRPi::prepareBuffers(), but in a slightly nicer way, especially considering that bufferCount is to be removed from StreamConfiguration in this series. Comments welcome, of course. Changes in v8: - Reworked buffer allocation handling in the raspberrypi pipeline handler - New --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 4641c76f..15055d58 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -572,7 +572,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol std::unique_ptr config = std::make_unique(data); V4L2SubdeviceFormat sensorFormat; - unsigned int bufferCount; PixelFormat pixelFormat; V4L2VideoDevice::Formats fmts; Size size; @@ -593,7 +592,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol BayerFormat::Packing::CSI2); ASSERT(pixelFormat.isValid()); colorSpace = ColorSpace::Raw; - bufferCount = 2; rawCount++; break; @@ -608,7 +606,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol colorSpace = ColorSpace::Sycc; /* Return the largest sensor resolution. */ size = sensorSize; - bufferCount = 1; outCount++; break; @@ -629,7 +626,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol */ colorSpace = ColorSpace::Rec709; size = { 1920, 1080 }; - bufferCount = 4; outCount++; break; @@ -638,7 +634,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol pixelFormat = formats::ARGB8888; colorSpace = ColorSpace::Sycc; size = { 800, 600 }; - bufferCount = 4; outCount++; break; @@ -685,7 +680,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol cfg.size = size; cfg.pixelFormat = pixelFormat; cfg.colorSpace = colorSpace; - cfg.bufferCount = bufferCount; config->addConfiguration(cfg); } @@ -1433,7 +1427,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera) for (Stream *s : camera->streams()) { if (isRaw(s->configuration().pixelFormat)) { - numRawBuffers = s->configuration().bufferCount; + numRawBuffers = data->unicam_[Unicam::Image].getBuffers().size(); break; } }