Show a patch.

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

{
    "id": 18063,
    "url": "https://patchwork.libcamera.org/api/patches/18063/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18063/",
    "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": "<20221228223003.2265712-8-paul.elder@ideasonboard.com>",
    "date": "2022-12-28T22:29:51",
    "name": "[libcamera-devel,v10,07/19] libcamera: pipeline: rkisp1: Don't rely on bufferCount",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "490b80dd3349672b96189dd60123d17c8dac8d0c",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18063/mbox/",
    "series": [
        {
            "id": 3691,
            "url": "https://patchwork.libcamera.org/api/series/3691/?format=api",
            "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/18063/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18063/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 23D08C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Dec 2022 22:30:30 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7281E625C8;\n\tWed, 28 Dec 2022 23:30:29 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F2C8E625DD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Dec 2022 23:30:25 +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 BAFD76D0;\n\tWed, 28 Dec 2022 23:30:24 +0100 (CET)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1672266629;\n\tbh=n57lT7DNtJle+qcAg9+E5WWWv74y0tC+ehajux5sFhA=;\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=xUbPY7iRePqJCRTQx7IVe23Wdo/iqSW1hncOHigt0TDmoXCJugpm90FRYhGoD0BqK\n\t7YiBj5Q/VbR8ZcJm3q56ienJyAim62CGzbqPgM/3mPWHL6OpNOoDAiRa2WPRyLMoIY\n\t0wJE8emqvp+FXu7CY7dxWDQ1IPiWOGOEZXvFv5i5vbbLkW8W6b4cl1TOTYbU99Gldr\n\tA00Q6R+3j75OF4nOpm7uVAEStuff7d/zdaHhiMZlbjyi0xaeFrivmwv88WQeKR4rc6\n\tZo/ZD90h9PM9J8kcb7Nkha9/EZH9zTLLIojnPEIQkDXic/yYio99a0IPGen7HQtK39\n\t+o68gAAodRXTA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1672266625;\n\tbh=n57lT7DNtJle+qcAg9+E5WWWv74y0tC+ehajux5sFhA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hcdvECQXLKrYs5Njvm+Z9zr8B4HdzauO9bvV5JVSfNY9l8rOzNYALEP01BUDZme+b\n\tLMD1oXBW7PBiq/m7xki8to+mnbaTcR3FGOQaFsc7RPb2Owcm08AHWyLfjY5mFNDjCh\n\tQE91A8cUhIPvLaEuontL3o4PInMKth+GHwJz+YEA="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hcdvECQX\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 28 Dec 2022 16:29:51 -0600",
        "Message-Id": "<20221228223003.2265712-8-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 07/19] libcamera: pipeline: rkisp1:\n\tDon'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 rkisp1 pipeline handler relies on bufferCount to decide on\nthe number of parameter and statistics buffers to allocate internally\nand for the number of V4L2 buffer slots to reserve. Instead, the number\nof internal buffers should be the minimum required by the pipeline to\nkeep the requests flowing, in order to avoid wasting memory, while the\nnumber of V4L2 buffer slots should be greater than the expected number\nof requests queued by the application, in order to avoid thrashing\ndmabuf mappings, which would degrade performance.\n\nStop relying on bufferCount for these numbers and instead set them to\nappropriate, and independent, constants.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\n---\nChanges in v9:\n- rebased\n\nChanges in v8:\n- New\n---\n src/libcamera/pipeline/rkisp1/rkisp1.cpp      | 19 ++++++++++++-------\n src/libcamera/pipeline/rkisp1/rkisp1_path.cpp |  3 +--\n src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  2 ++\n 3 files changed, 15 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 5994b974..27d70c6e 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -200,6 +200,16 @@ private:\n \tCamera *activeCamera_;\n \n \tconst MediaPad *ispSink_;\n+\n+\t/*\n+\t * This many internal buffers (or rather parameter and statistics buffer\n+\t * pairs) ensures that the pipeline runs smoothly, without frame drops.\n+\t * This number considers:\n+\t * - three buffers queued to the driver, which is also the minimum\n+\t *   required to start streaming\n+\t * - one buffer being processed on the IPA\n+\t */\n+\tstatic constexpr unsigned int kRkISP1InternalBufferCount = 4;\n };\n \n RkISP1Frames::RkISP1Frames(PipelineHandler *pipe)\n@@ -836,17 +846,12 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n \tunsigned int ipaBufferId = 1;\n \tint ret;\n \n-\tunsigned int maxCount = std::max({\n-\t\tdata->mainPathStream_.configuration().bufferCount,\n-\t\tdata->selfPathStream_.configuration().bufferCount,\n-\t});\n-\n \tif (!isRaw_) {\n-\t\tret = param_->allocateBuffers(maxCount, &paramBuffers_);\n+\t\tret = param_->allocateBuffers(kRkISP1InternalBufferCount, &paramBuffers_);\n \t\tif (ret < 0)\n \t\t\tgoto error;\n \n-\t\tret = stat_->allocateBuffers(maxCount, &statBuffers_);\n+\t\tret = stat_->allocateBuffers(kRkISP1InternalBufferCount, &statBuffers_);\n \t\tif (ret < 0)\n \t\t\tgoto error;\n \t}\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\nindex 5079b268..a168e0ad 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n@@ -370,8 +370,7 @@ int RkISP1Path::start()\n \tif (running_)\n \t\treturn -EBUSY;\n \n-\t/* \\todo Make buffer count user configurable. */\n-\tret = video_->importBuffers(RKISP1_BUFFER_COUNT);\n+\tret = video_->importBuffers(kRkISP1BufferSlotCount);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\nindex bdf3f95b..5b53783c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n@@ -76,6 +76,8 @@ private:\n \tstd::unique_ptr<V4L2Subdevice> resizer_;\n \tstd::unique_ptr<V4L2VideoDevice> video_;\n \tMediaLink *link_;\n+\n+\tstatic constexpr unsigned int kRkISP1BufferSlotCount = 16;\n };\n \n class RkISP1MainPath : public RkISP1Path\n",
    "prefixes": [
        "libcamera-devel",
        "v10",
        "07/19"
    ]
}