Show a patch.

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

{
    "id": 17909,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17909/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17909/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20221129134534.2933-3-naush@raspberrypi.com>",
    "date": "2022-11-29T13:45:26",
    "name": "[libcamera-devel,v2,02/10] pipeline: raspberrypi: Add a pipeline config structure",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "86f7f6fa1a14b692c73c58ba1180850b6aab8487",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17909/mbox/",
    "series": [
        {
            "id": 3647,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3647/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3647",
            "date": "2022-11-29T13:45:24",
            "name": "Raspberry Pi: Platform configuration and buffer allocation improvements",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3647/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17909/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17909/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 94C55C3286\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 29 Nov 2022 13:45:43 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 564B163348;\n\tTue, 29 Nov 2022 14:45:43 +0100 (CET)",
            "from mail-wm1-x330.google.com (mail-wm1-x330.google.com\n\t[IPv6:2a00:1450:4864:20::330])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E1D3263343\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Nov 2022 14:45:39 +0100 (CET)",
            "by mail-wm1-x330.google.com with SMTP id\n\t83-20020a1c0256000000b003d0683389e1so873842wmc.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 29 Nov 2022 05:45:39 -0800 (PST)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tn8-20020a05600c3b8800b003cfbbd54178sm3565636wms.2.2022.11.29.05.45.38\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 29 Nov 2022 05:45:38 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669729543;\n\tbh=OpGSWEhXix31IAek7o7Hhe3Prmyd2LN6h4IiThhE2Vo=;\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=SU4UpU/vmshwsHLhMzAzjZOU1zgb/VRSnHuSmfTxl8vnVEKYA5hAF1R0s3PhyTvts\n\tgosVjbaE8Fxr2VvV4X7pH5nXztirO1r90De4wuBvD+e6orLZ4UPU92Uz72YUNgrX8y\n\t3b+1b0fFP/HE8YrAFtLRcjh6ECGs8Kqd8syeo3uQEGYB2kIL5dqm/6TCsbZOgVElR3\n\texgnoIx65JqAW2QpUZp+qYBp0ED2x3loAVzpNzi+4ikfoeTP015L3giJ2BDoKU67uu\n\tkq6Ffvg78JtPPRcF0I0bcSc5qwXhbvkrjxvJX9SSBoRqgGxamERhm49Ha63JW6yeUJ\n\tZiIIDj90oHxUg==",
            "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=ciBbWTK2dRMSlcTDs0GHUazmwee/kR44mG6SsNS5Crc=;\n\tb=EEFCo+e+vVBysbgYdj7qNWmSACjXIQmHzDVubVTJXpOS+jj8cagdntetcxzwDZ9Q0f\n\tgLoS8xT0OPicBi8jq1BSHyhFA4kswYg0Ug6OZzjaMN5yxF442ePXFT5rkxo10x9/IW4E\n\tIEVvRu42Oa6x2J5ii9iUm4lGXn9SL6I5MXFEW3Jbu6IOI4h0Q9aS46O+3KWOHFsf4WkA\n\tVOfiR7qYB3sTjcUDuI5gyTNm8eOPWvcIOkzMEKqbFlipe6MiOkE3fcXW1s5amju44NTR\n\tyi2mA/PBgc7GvNqv/aT75tIFllCtxZyOhmadvi3vX4rikpP3TgPF8RAzPEkSNxuQSnq3\n\tDjjw=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"EEFCo+e+\"; 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=ciBbWTK2dRMSlcTDs0GHUazmwee/kR44mG6SsNS5Crc=;\n\tb=v6cKmdtgyXb5d2NhzSiXkMO/nD3SKiyCw95gVV8M6vJEzRTVbXduiea8HffTuL4eVp\n\tiTalxNXXwVd+vX2pCwX8ZI/R7OegzUtBF0GzzpOv090/251Fzq8keZ+gIIEpnA0azt/n\n\tsZ9emrXsWGDE5voi2j0p6ZLVOwGafoqgmzFbRrMSK6cMuPWmiqIN2QvfHhUcvPFDlv4D\n\tXHOa24eyqRsTk5hBB9vcdzLziA2nDlYTb17Br5HNcCwZWF4id13TELAfyfFcLRRC6s9L\n\tC0jZ6wj5eYXXmPleD1ZPuyMbx2rFW8z7rMmPbPRd/isc3y6FJRD58jjTuj6+RLBoxFg4\n\tfuoQ==",
        "X-Gm-Message-State": "ANoB5plamJfn9w2Qfnn1RZ5/Tv/+WIKDlTnKoimPKAjMAVjvbrj5KCP3\n\tRBhfyPY/eYj1bwAyv8pk8yXrLm28AWFAZg==",
        "X-Google-Smtp-Source": "AA0mqf6xtwuC1tt4i6GiM8fxLsP5hzltNsO/jcSYOLQI/ekL6dFzAAl0QPw3lXVsn7UUhWyV+r05AA==",
        "X-Received": "by 2002:a05:600c:6023:b0:3cf:6c05:b4d5 with SMTP id\n\taz35-20020a05600c602300b003cf6c05b4d5mr27475877wmb.120.1669729539136; \n\tTue, 29 Nov 2022 05:45:39 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 29 Nov 2022 13:45:26 +0000",
        "Message-Id": "<20221129134534.2933-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221129134534.2933-1-naush@raspberrypi.com>",
        "References": "<20221129134534.2933-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 02/10] 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>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 51 ++++++++++++++++---\n 1 file changed, 44 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 0e0b71945640..4486d31ea78d 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -294,6 +294,21 @@ 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 steram.\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@@ -346,6 +361,7 @@ private:\n \t}\n \n \tint registerCamera(MediaDevice *unicam, MediaDevice *isp, MediaEntity *sensorEntity);\n+\tint configurePipelineHandler(RPiCameraData *data);\n \tint queueAllBuffers(Camera *camera);\n \tint prepareBuffers(Camera *camera);\n \tvoid mapBuffers(Camera *camera, const RPi::BufferMap &buffers, unsigned int mask);\n@@ -1377,6 +1393,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 = configurePipelineHandler(data.get());\n+\tif (ret) {\n+\t\tLOG(RPI, Error) << \"Unable to configure the pipeline handler!\";\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@@ -1389,6 +1411,18 @@ int PipelineHandlerRPi::registerCamera(MediaDevice *unicam, MediaDevice *isp, Me\n \treturn 0;\n }\n \n+int PipelineHandlerRPi::configurePipelineHandler(RPiCameraData *data)\n+{\n+\tRPiCameraData::Config &config = data->config_;\n+\n+\tconfig = {\n+\t\t.minUnicamBuffers = 2,\n+\t\t.minTotalUnicamBuffers = 4,\n+\t};\n+\n+\treturn 0;\n+}\n+\n int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n {\n \tRPiCameraData *data = cameraData(camera);\n@@ -1439,25 +1473,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 sets of internal\n+\t\t\t * buffers 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",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "02/10"
    ]
}