{"id":18060,"url":"https://patchwork.libcamera.org/api/1.1/patches/18060/?format=json","web_url":"https://patchwork.libcamera.org/patch/18060/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20221228223003.2265712-5-paul.elder@ideasonboard.com>","date":"2022-12-28T22:29:48","name":"[libcamera-devel,v10,04/19] libcamera: pipeline: raspberrypi: Don't rely on bufferCount","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7436303310b61a26dfff7fb2e385dab70cdd02d9","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18060/mbox/","series":[{"id":3691,"url":"https://patchwork.libcamera.org/api/1.1/series/3691/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3691","date":"2022-12-28T22:29:44","name":"lc-compliance: Add test to queue more requests than hardware depth","version":10,"mbox":"https://patchwork.libcamera.org/series/3691/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18060/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18060/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BED36C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Dec 2022 22:30:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E3D2625E3;\n\tWed, 28 Dec 2022 23:30:26 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 593BB625C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Dec 2022 23:30:22 +0100 (CET)","from pyrite.mediacom.info (unknown\n\t[IPv6:2604:2d80:ad8a:9000:1bf9:855b:22de:3645])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D4AEA109;\n\tWed, 28 Dec 2022 23:30:20 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1672266626;\n\tbh=CAXuEf1hBrJKDEj/grW5ODI+EwoIENTtnlZfVsD3a4o=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=d/A+rnaZMw9xCYLbaTBq/3GPFMZr6fHeRnw+8OSOC7S4FYCC/Z1qBvwffKskc5sXQ\n\tgszczQ0Z8rKEnNCFMJONdrbh52lsgBasbkpF4KZbXrAiYZq8SWinzP96vYOEjF+P0z\n\t3+fBF5epXDmCjRtBZLCKG1rcv55Mn36MotFqG0/9xwXfLrd7lG9TOLCDIm7TWRKSoG\n\t+mKMYwyx2wjQOGMY8Po7t5AhJZPdnIGTwOObv2F6qzYY+yi6SLkLm403vYhvs02ZLM\n\tXUGaBrXIjPAAF8XRzxl0IKrPsz1NC5wQi+b5dH+eAa+JNREE99dz26s5yn1g/1gmc1\n\tL5Y+zFTv+kXOQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1672266621;\n\tbh=CAXuEf1hBrJKDEj/grW5ODI+EwoIENTtnlZfVsD3a4o=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nFltqDLM8/7PXInfu2QC7QHfjXaKIG/p0xa3vbtSU2UETBeei/gY9bOaehrBlKZI/\n\t9JSjoJfHD+0JaMrFG+L1S/YPwJ4dkpFn4+dIbdsgOblnwLuCS/tcAi7M5THhsSjBq5\n\tuB9GQM3KxSOhcaIzqTOuV4YKJnjEaj4AjnBT2Tks="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"nFltqDLM\"; dkim-atps=neutral","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","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v10 04/19] libcamera: pipeline:\n\traspberrypi: Don't rely on bufferCount","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Nícolas F. R. A. Prado <nfraprado@collabora.com>\n\nCurrently the raspberrypi pipeline handler relies on bufferCount to\ndecide on the number of buffers to allocate internally and for the\nnumber of V4L2 buffer slots to reserve.\n\nThere alrady exists a procedure for determining the number of buffers to\nreserve, so to remove reliance onf bufferCount we simply replace the one\ninstance that it is used in, as well as remove populating it in\ngenerateConfiguration().\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v10:\n- completely changed, to leverage the existing buffer count calculations\n  - the refactoring that was in v9's rebase wasn't necessary, i think\n  - this also makes it conflict less with [1] which ought to be coming\n    soon\n[1] https://patchwork.libcamera.org/project/libcamera/list/?series=3663\n\nChanges in v9:\n- rebased\n  - I've decided that the buffer allocation decisions that Nícolas\n    implemented covered the same cases that were added in\n    PipelineHandlerRPi::prepareBuffers(), but in a slightly nicer way,\n    especially considering that bufferCount is to be removed from\n    StreamConfiguration in this series. Comments welcome, of course.\n\nChanges in v8:\n- Reworked buffer allocation handling in the raspberrypi pipeline handler\n- New\n---\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 4641c76f..15055d58 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -572,7 +572,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \tstd::unique_ptr<CameraConfiguration> config =\n \t\tstd::make_unique<RPiCameraConfiguration>(data);\n \tV4L2SubdeviceFormat sensorFormat;\n-\tunsigned int bufferCount;\n \tPixelFormat pixelFormat;\n \tV4L2VideoDevice::Formats fmts;\n \tSize size;\n@@ -593,7 +592,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \t\t\t\t\t\t\t    BayerFormat::Packing::CSI2);\n \t\t\tASSERT(pixelFormat.isValid());\n \t\t\tcolorSpace = ColorSpace::Raw;\n-\t\t\tbufferCount = 2;\n \t\t\trawCount++;\n \t\t\tbreak;\n \n@@ -608,7 +606,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \t\t\tcolorSpace = ColorSpace::Sycc;\n \t\t\t/* Return the largest sensor resolution. */\n \t\t\tsize = sensorSize;\n-\t\t\tbufferCount = 1;\n \t\t\toutCount++;\n \t\t\tbreak;\n \n@@ -629,7 +626,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \t\t\t */\n \t\t\tcolorSpace = ColorSpace::Rec709;\n \t\t\tsize = { 1920, 1080 };\n-\t\t\tbufferCount = 4;\n \t\t\toutCount++;\n \t\t\tbreak;\n \n@@ -638,7 +634,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \t\t\tpixelFormat = formats::ARGB8888;\n \t\t\tcolorSpace = ColorSpace::Sycc;\n \t\t\tsize = { 800, 600 };\n-\t\t\tbufferCount = 4;\n \t\t\toutCount++;\n \t\t\tbreak;\n \n@@ -685,7 +680,6 @@ PipelineHandlerRPi::generateConfiguration(Camera *camera, const StreamRoles &rol\n \t\tcfg.size = size;\n \t\tcfg.pixelFormat = pixelFormat;\n \t\tcfg.colorSpace = colorSpace;\n-\t\tcfg.bufferCount = bufferCount;\n \t\tconfig->addConfiguration(cfg);\n \t}\n \n@@ -1433,7 +1427,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \n \tfor (Stream *s : camera->streams()) {\n \t\tif (isRaw(s->configuration().pixelFormat)) {\n-\t\t\tnumRawBuffers = s->configuration().bufferCount;\n+\t\t\tnumRawBuffers = data->unicam_[Unicam::Image].getBuffers().size();\n \t\t\tbreak;\n \t\t}\n \t}\n","prefixes":["libcamera-devel","v10","04/19"]}