Show a patch.

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

{
    "id": 24485,
    "url": "https://patchwork.libcamera.org/api/patches/24485/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24485/",
    "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": "<20250927203947.126092-1-robert.mader@collabora.com>",
    "date": "2025-09-27T20:39:47",
    "name": "[v2] pipeline: simple: Allow buffer counts from 1 to 32",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "28ee67185fae07ae04bd0189c87a2869f0133d86",
    "submitter": {
        "id": 140,
        "url": "https://patchwork.libcamera.org/api/people/140/?format=api",
        "name": "Robert Mader",
        "email": "robert.mader@collabora.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24485/mbox/",
    "series": [
        {
            "id": 5463,
            "url": "https://patchwork.libcamera.org/api/series/5463/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5463",
            "date": "2025-09-27T20:39:47",
            "name": "[v2] pipeline: simple: Allow buffer counts from 1 to 32",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/5463/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24485/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24485/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 F15D7C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 27 Sep 2025 20:40:47 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D76316B5F3;\n\tSat, 27 Sep 2025 22:40:46 +0200 (CEST)",
            "from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com\n\t[136.143.188.112])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 940916B5A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 27 Sep 2025 22:40:44 +0200 (CEST)",
            "by mx.zohomail.com with SMTPS id 1759005637285361.7375955440649;\n\tSat, 27 Sep 2025 13:40:37 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"PiOsmKEB\"; \n\tdkim-atps=neutral",
        "ARC-Seal": "i=1; a=rsa-sha256; t=1759005640; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=K44NtfGzJc/cZ5PQCVsV+7kiYTdkG4IMSIae0mTVKhdVqD9yfVz9n6mP2UHXUT++J9u+nszVBCUl63WgSYftJcP6VDufc9DWNwSZyPx5gOtl9COmUOZPeDIUKeXH9h07WmJHeyHeJUDUbhAglsr43YQxXfyqHmMk4M3agXQ1eGc=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1759005640;\n\th=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To;\n\tbh=Xd+5SdlrLyJIUZ2ddfMseF7JvcudweLFTJIaFhy96AM=; \n\tb=Vi72wiG2VaTYGI7kABTS4hBkYJ5dptHNYqRTF9NZEFb1yoW2gV8d6TgeFKp8v2rd2qkHAhD2uf19Fy7mxbizLeHVH9XLZp/ECQJUYzKAz6FfI3MEqWgurMUL6ou4JKzcnwkngpbG6kVAlJT8QoY1blPE1cYRxINAiI0T2RznKnE=",
        "ARC-Authentication-Results": "i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1759005640;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To;\n\tbh=Xd+5SdlrLyJIUZ2ddfMseF7JvcudweLFTJIaFhy96AM=;\n\tb=PiOsmKEB3kxJ8+orHqxNSLLik5xCUwgNAdGfkxnez/Di2Huuiv764zxUzk2D5ygB\n\tqVUjWjTuv3h4ciz52gGPIMdppEPtrOh2qz2iF3Mze2d5p4hM3ReYtcqpFKsEwoEk9WF\n\tdXP0FvJheGjWO91R6tV64Z+cDj12BnTo8mzNRvzY=",
        "From": "Robert Mader <robert.mader@collabora.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Robert Mader <robert.mader@collabora.com>",
        "Subject": "[PATCH v2] pipeline: simple: Allow buffer counts from 1 to 32",
        "Date": "Sat, 27 Sep 2025 22:39:47 +0200",
        "Message-ID": "<20250927203947.126092-1-robert.mader@collabora.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "While a default value of 4 buffers appears to be a good default that is\nused by other pipelines as well, allowing both higher and lower values\ncan be desirable, notably for:\n1. Video encoding, e.g. encoding multiple buffers in parallel.\n2. Clients requesting a single buffer - e.g. in multi-stream scenarios.\n\nThus allow up to 32 buffers - following the default from vb2 core - while\nkeeping the default to the previous 4.\n\nWhile on it:\n1. mark the config as adjusted when appropriate.\n2. increase the number of internal buffer used by the swISP to 4 as well.\n   This has been shipped downstream in postmarketOS for a while and, in\n   some cases, seems to improve stability on no-so-great drivers.\n\nSigned-off-by: Robert Mader <robert.mader@collabora.com>\n\n---\n\nChanges since v1 with title \"pipeline: simple: Allow buffer counts from 1 to 16 for swISP\"\n1: Cover all cases, not just the swISP one.\n2: Increase maximum to 32 to match vb2 core.\n3: Change constant naming to better match similar ones.\n4: Bump kNumInternalBuffers to 4.\n---\n src/libcamera/pipeline/simple/simple.cpp | 21 ++++++++++++++++++---\n 1 file changed, 18 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp\nindex c816cffc9..23585692c 100644\n--- a/src/libcamera/pipeline/simple/simple.cpp\n+++ b/src/libcamera/pipeline/simple/simple.cpp\n@@ -378,6 +378,9 @@ public:\n \tconst Transform &combinedTransform() const { return combinedTransform_; }\n \n private:\n+\tstatic constexpr unsigned int kNumBuffersDefault = 4;\n+\tstatic constexpr unsigned int kNumBuffersMax = 32;\n+\n \t/*\n \t * The SimpleCameraData instance is guaranteed to be valid as long as\n \t * the corresponding Camera instance is valid. In order to borrow a\n@@ -417,7 +420,7 @@ protected:\n \tint queueRequestDevice(Camera *camera, Request *request) override;\n \n private:\n-\tstatic constexpr unsigned int kNumInternalBuffers = 3;\n+\tstatic constexpr unsigned int kNumInternalBuffers = 4;\n \n \tstruct EntityData {\n \t\tstd::unique_ptr<V4L2VideoDevice> video;\n@@ -1239,7 +1242,7 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t\t    cfg.size != pipeConfig_->captureSize)\n \t\t\tneedConversion_ = true;\n \n-\t\t/* Set the stride, frameSize and bufferCount. */\n+\t\t/* Set the stride and frameSize. */\n \t\tif (needConversion_) {\n \t\t\tstd::tie(cfg.stride, cfg.frameSize) =\n \t\t\t\tdata_->converter_\n@@ -1262,7 +1265,19 @@ CameraConfiguration::Status SimpleCameraConfiguration::validate()\n \t\t\tcfg.frameSize = format.planes[0].size;\n \t\t}\n \n-\t\tcfg.bufferCount = 4;\n+\t\tif (cfg.bufferCount == 0) {\n+\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t<< \" to \" << kNumBuffersDefault;\n+\t\t\tcfg.bufferCount = kNumBuffersDefault;\n+\t\t\tstatus = Adjusted;\n+\t\t} else if (cfg.bufferCount > kNumBuffersMax) {\n+\t\t\tLOG(SimplePipeline, Debug)\n+\t\t\t\t<< \"Adjusting bufferCount from \" << cfg.bufferCount\n+\t\t\t\t<< \" to \" << kNumBuffersMax;\n+\t\t\tcfg.bufferCount = kNumBuffersMax;\n+\t\t\tstatus = Adjusted;\n+\t\t}\n \t}\n \n \treturn status;\n",
    "prefixes": [
        "v2"
    ]
}