Show a patch.

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

{
    "id": 18203,
    "url": "https://patchwork.libcamera.org/api/patches/18203/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18203/",
    "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": "<20230127154322.29019-4-naush@raspberrypi.com>",
    "date": "2023-01-27T15:43:10",
    "name": "[libcamera-devel,v6,03/15] pipeline: raspberrypi: Add a pipeline config structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "8bc3e95ad819a7638e1d2f77c333b0c2dae2c2fc",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18203/mbox/",
    "series": [
        {
            "id": 3728,
            "url": "https://patchwork.libcamera.org/api/series/3728/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3728",
            "date": "2023-01-27T15:43:07",
            "name": "[libcamera-devel,v6,01/15] libcamera: stream: Add stream hints to StreamConfiguration",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/3728/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18203/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18203/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 A8A57C3242\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Jan 2023 15:43:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C1F90625F5;\n\tFri, 27 Jan 2023 16:43:41 +0100 (CET)",
            "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F87E625E4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jan 2023 16:43:38 +0100 (CET)",
            "by mail-wm1-x334.google.com with SMTP id\n\tm5-20020a05600c4f4500b003db03b2559eso3769627wmq.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Jan 2023 07:43:38 -0800 (PST)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\th18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.36\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Jan 2023 07:43:36 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1674834221;\n\tbh=fjUZ2Y6M5SIvy8YqXeyirbL4bFJ8DM4NFQmHEKWK8To=;\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=X7E46+VC9ppAYPqYf3jxlELbXC/Os02fJVl8IW5t4s7RQbV8+L09dgWDdOy1Sa0Vw\n\tXL5GClOn/Kwwt8F9ufxsIsvXUrVchWU6/ahVZAK0IdLFjVbXp5PH97tG1+12Hj7EYz\n\tZ6AS0UotHemf7iqAuuD9DFdIOhztye564DWjDRLv1ZmUTl/vV8eJ3Ague00ghy8pCR\n\tK2HdgSY3BaHC3isFr3c+YdL+XFGfoaZVtQC7Sh/hYfouFtH4kd6mkR04/rhfCVmuHG\n\tzmuvuzIWlIU3ILyst7zLiZmR1VphRfG1m70FKuuwAuhgNtB1mGzHwP1YGO2liAeqbh\n\t09rwS6ZUt6m+A==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=u6mC/hSCt4w6JopK/0knsJmp2imtUWG/I8MNT7rGc+E=;\n\tb=EGTO0cRcPUjRMRyx4hgo5vTiZUsf7lhz0HBtXYRvDsYZW63t8WA8UTsANzT+p5K94o\n\tR9t5TEVKe8PJ4jyaJ28qh15l2h71roVueMHl/fh7FkF7VrwHOx4UJkw7kpzByruTb49p\n\tu0Xh30ltEqp6lN7ZwDS0BB+/gWHu7gTvXDy8gfaWXFF8xo3F0Nk2qzCej1QqOTeki225\n\tYfcTQDJuLzZ//imjmQHuKwM/FNdGsozFVjhbhIYOHLOpW+xzkbng1SQLV4qoMQq0JdOK\n\to88IGvV+wvM2GdO6zpT/IAkiwbE5550MUNkKMheXeMFKwG3CKysCH8pBFOpu9PwMhAw6\n\tUReg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"EGTO0cRc\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=u6mC/hSCt4w6JopK/0knsJmp2imtUWG/I8MNT7rGc+E=;\n\tb=xT+lHiTM8LvQKQCKL/MSgGoNkCATw2y2BwTt7ic1ohaoEnOwGLXEZEA9tMFBw8WpkW\n\t/+Hxv/CYBj68z61/Tvn3AR6DytnZE+kOaNozndXi4HPfjzVks3WbwCx3sHOIESlZXdJ4\n\t8lR568Zfp59d3kxkSmGoBOaIcdMrw9AxYWrdKRXRiAnA6VDhA98kE+sTo1nSSr3/lwFE\n\tJDhYUQbS2MVQVUAYF/jEUyQaPlzHDAhXFEnHZm9y4eG7fRaFNOGwHlIfTd7tI4aNa7nd\n\t1LD8UMp/ucuA3HP/o1gtiZawP4IHYJ003iMwc5tx55mnYq/g2/Kv2Qo9fDLpJc9EUiit\n\tJbFg==",
        "X-Gm-Message-State": "AFqh2kpn3hhkWQJgDe3eV9lJ6mMsuPFNtZGPhx1KTrmXTOyai4zVSohd\n\tc/D0gDIKbN21ChP7mtpsUSxY6DKItQT9lP2p7dM=",
        "X-Google-Smtp-Source": "AMrXdXtBgoJbWPIeUcATjnIW2zj23eZa5z6rSLhmXQ8VguqDxyvGZjbP4pFZRNOyjfV3SdX8r/8+Cg==",
        "X-Received": "by 2002:a05:600c:1d8e:b0:3d1:fcb4:4074 with SMTP id\n\tp14-20020a05600c1d8e00b003d1fcb44074mr41551146wms.22.1674834217306; \n\tFri, 27 Jan 2023 07:43:37 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 27 Jan 2023 15:43:10 +0000",
        "Message-Id": "<20230127154322.29019-4-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230127154322.29019-1-naush@raspberrypi.com>",
        "References": "<20230127154322.29019-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v6 03/15] pipeline: raspberrypi: Add a\n\tpipeline config structure",
        "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": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add a configuration structure to store platform specific parameters used by\nthe pipeline handler. Currently, these only store Unicam buffer counts,\nreplacing the hardcoded static values in the source code.\n\nIn subsequent commits, more parameters will be added to the configuration\nstructure, and parameters will be read in through a config file.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 53 ++++++++++++++++---\n 1 file changed, 46 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 8569df17976a..9e959782d310 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -199,6 +199,7 @@ public:\n \n \tint loadIPA(ipa::RPi::IPAInitResult *result);\n \tint configureIPA(const CameraConfiguration *config, ipa::RPi::IPAConfigResult *result);\n+\tint loadPipelineConfiguration();\n \n \tvoid enumerateVideoDevices(MediaLink *link);\n \n@@ -295,6 +296,25 @@ public:\n \t/* Have internal buffers been allocated? */\n \tbool buffersAllocated_;\n \n+\tstruct Config {\n+\t\t/*\n+\t\t * The minimum number of internal buffers to be allocated for\n+\t\t * the Unicam Image stream.\n+\t\t */\n+\t\tunsigned int minUnicamBuffers;\n+\t\t/*\n+\t\t * The minimum total (internal + external) buffer count used for\n+\t\t * the Unicam Image stream.\n+\t\t *\n+\t\t * Note that:\n+\t\t * minTotalUnicamBuffers must be >= 1, and\n+\t\t * minTotalUnicamBuffers >= minUnicamBuffers\n+\t\t */\n+\t\tunsigned int minTotalUnicamBuffers;\n+\t};\n+\n+\tConfig config_;\n+\n private:\n \tvoid checkRequestCompleted();\n \tvoid fillRequestMetadata(const ControlList &bufferControls,\n@@ -1378,6 +1398,12 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \tstreams.insert(&data->isp_[Isp::Output0]);\n \tstreams.insert(&data->isp_[Isp::Output1]);\n \n+\tint ret = data->loadPipelineConfiguration();\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Unable to load pipeline configuration\";\n+\t\treturn ret;\n+\t}\n+\n \t/* Create and register the camera. */\n \tconst std::string &id = data->sensor_->id();\n \tstd::shared_ptr<Camera> camera =\n@@ -1440,25 +1466,28 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \tfor (auto const stream : data->streams_) {\n \t\tunsigned int numBuffers;\n \t\t/*\n-\t\t * For Unicam, allocate a minimum of 4 buffers as we want\n-\t\t * to avoid any frame drops.\n+\t\t * For Unicam, allocate a minimum number of buffers for internal\n+\t\t * use as we want to avoid any frame drops.\n \t\t */\n-\t\tconstexpr unsigned int minBuffers = 4;\n+\t\tconst unsigned int minBuffers = data->config_.minTotalUnicamBuffers;\n \t\tif (stream == &data->unicam_[Unicam::Image]) {\n \t\t\t/*\n \t\t\t * If an application has configured a RAW stream, allocate\n \t\t\t * additional buffers to make up the minimum, but ensure\n-\t\t\t * we have at least 2 sets of internal buffers to use to\n-\t\t\t * minimise frame drops.\n+\t\t\t * we have at least minUnicamBuffers of internal buffers\n+\t\t\t * to use to minimise frame drops.\n \t\t\t */\n-\t\t\tnumBuffers = std::max<int>(2, minBuffers - numRawBuffers);\n+\t\t\tnumBuffers = std::max<int>(data->config_.minUnicamBuffers,\n+\t\t\t\t\t\t   minBuffers - numRawBuffers);\n \t\t} else if (stream == &data->isp_[Isp::Input]) {\n \t\t\t/*\n \t\t\t * ISP input buffers are imported from Unicam, so follow\n \t\t\t * similar logic as above to count all the RAW buffers\n \t\t\t * available.\n \t\t\t */\n-\t\t\tnumBuffers = numRawBuffers + std::max<int>(2, minBuffers - numRawBuffers);\n+\t\t\tnumBuffers = numRawBuffers +\n+\t\t\t\t     std::max<int>(data->config_.minUnicamBuffers,\n+\t\t\t\t\t\t   minBuffers - numRawBuffers);\n \n \t\t} else if (stream == &data->unicam_[Unicam::Embedded]) {\n \t\t\t/*\n@@ -1631,6 +1660,16 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config, ipa::RPi::IPA\n \treturn 0;\n }\n \n+int RPiCameraData::loadPipelineConfiguration()\n+{\n+\tconfig_ = {\n+\t\t.minUnicamBuffers = 2,\n+\t\t.minTotalUnicamBuffers = 4,\n+\t};\n+\n+\treturn 0;\n+}\n+\n /*\n  * enumerateVideoDevices() iterates over the Media Controller topology, starting\n  * at the sensor and finishing at Unicam. For each sensor, RPiCameraData stores\n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "03/15"
    ]
}