Show a patch.

GET /api/patches/23275/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 23275,
    "url": "https://patchwork.libcamera.org/api/patches/23275/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23275/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20250428090413.38234-4-s.pueschel@pengutronix.de>",
    "date": "2025-04-28T09:02:28",
    "name": "[v11,03/19] libcamera: pipeline: rpi: Don't rely on bufferCount",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "824285560d90f88533e7bbd3c63e8453ec01fd53",
    "submitter": {
        "id": 225,
        "url": "https://patchwork.libcamera.org/api/people/225/?format=api",
        "name": "Sven Püschel",
        "email": "s.pueschel@pengutronix.de"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23275/mbox/",
    "series": [
        {
            "id": 5148,
            "url": "https://patchwork.libcamera.org/api/series/5148/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5148",
            "date": "2025-04-28T09:02:25",
            "name": "lc-compliance: Add test to queue more requests than hardware depth",
            "version": 11,
            "mbox": "https://patchwork.libcamera.org/series/5148/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23275/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23275/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 B24B7C327D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Apr 2025 09:05:15 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E80B068AD5;\n\tMon, 28 Apr 2025 11:05:14 +0200 (CEST)",
            "from metis.whiteo.stw.pengutronix.de\n\t(metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8484268AD4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Apr 2025 11:05:06 +0200 (CEST)",
            "from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77]\n\thelo=peter.guest.stw.pengutronix.de)\n\tby metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92)\n\t(envelope-from <s.pueschel@pengutronix.de>)\n\tid 1u9KQE-0001au-4G; Mon, 28 Apr 2025 11:05:06 +0200"
        ],
        "From": "=?utf-8?q?Sven_P=C3=BCschel?= <s.pueschel@pengutronix.de>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>, =?utf-8?q?Sven_P=C3=BCschel?=\n\t<s.pueschel@pengutronix.de>",
        "Subject": "[PATCH v11 03/19] libcamera: pipeline: rpi: Don't rely on\n\tbufferCount",
        "Date": "Mon, 28 Apr 2025 11:02:28 +0200",
        "Message-ID": "<20250428090413.38234-4-s.pueschel@pengutronix.de>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250428090413.38234-1-s.pueschel@pengutronix.de>",
        "References": "<20250428090413.38234-1-s.pueschel@pengutronix.de>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-SA-Exim-Connect-IP": "2a0a:edc0:0:900:1d::77",
        "X-SA-Exim-Mail-From": "s.pueschel@pengutronix.de",
        "X-SA-Exim-Scanned": "No (on metis.whiteo.stw.pengutronix.de);\n\tSAEximRunCond expanded to false",
        "X-PTX-Original-Recipient": "libcamera-devel@lists.libcamera.org",
        "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>",
        "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 already exists a procedure for determining the number of buffers\nto reserve, so to remove reliance on bufferCount we simply replace the\none instance 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>\nSigned-off-by: Sven Püschel <s.pueschel@pengutronix.de>\n\n---\nChanges in v11:\n- adapted pisp.cpp similar to vc4.cpp\n- corrected spelling errors in commit description\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/rpi/common/pipeline_base.cpp | 6 ------\n src/libcamera/pipeline/rpi/pisp/pisp.cpp            | 2 +-\n src/libcamera/pipeline/rpi/vc4/vc4.cpp              | 2 +-\n 3 files changed, 2 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex dc1e0a2e..bcc74052 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -388,7 +388,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\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@@ -407,7 +406,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\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\tbreak;\n \n \t\tcase StreamRole::StillCapture:\n@@ -421,7 +419,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\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\tbreak;\n \n \t\tcase StreamRole::VideoRecording:\n@@ -441,7 +438,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\n \t\t\t */\n \t\t\tcolorSpace = ColorSpace::Rec709;\n \t\t\tsize = { 1920, 1080 };\n-\t\t\tbufferCount = 4;\n \t\t\tbreak;\n \n \t\tcase StreamRole::Viewfinder:\n@@ -449,7 +445,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\n \t\t\tpixelFormat = formats::XRGB8888;\n \t\t\tcolorSpace = ColorSpace::Sycc;\n \t\t\tsize = { 800, 600 };\n-\t\t\tbufferCount = 4;\n \t\t\tbreak;\n \n \t\tdefault:\n@@ -494,7 +489,6 @@ PipelineHandlerBase::generateConfiguration(Camera *camera, Span<const StreamRole\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 \ndiff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\nindex 91e7f4c9..0f607a64 100644\n--- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n+++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n@@ -965,7 +965,7 @@ int PipelineHandlerPiSP::prepareBuffers(Camera *camera)\n \n \tfor (Stream *s : camera->streams()) {\n \t\tif (PipelineHandlerBase::isRaw(s->configuration().pixelFormat)) {\n-\t\t\tnumRawBuffers = s->configuration().bufferCount;\n+\t\t\tnumRawBuffers = data->cfe_[Cfe::Output0].getBuffers().size();\n \t\t\tbreak;\n \t\t}\n \t}\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex fe910bdf..97e7a6ff 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -224,7 +224,7 @@ int PipelineHandlerVc4::prepareBuffers(Camera *camera)\n \n \tfor (Stream *s : camera->streams()) {\n \t\tif (BayerFormat::fromPixelFormat(s->configuration().pixelFormat).isValid()) {\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": [
        "v11",
        "03/19"
    ]
}