Show a patch.

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

{
    "id": 18248,
    "url": "https://patchwork.libcamera.org/api/patches/18248/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18248/",
    "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": "<20230203094424.25243-4-naush@raspberrypi.com>",
    "date": "2023-02-03T09:44:19",
    "name": "[libcamera-devel,v1,3/8] pipeline: raspberrypi: Handle MandatoryStream hints for ISP Output0",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "6997a6ac21e39a5533855b1af96f25f63d29a819",
    "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/18248/mbox/",
    "series": [
        {
            "id": 3739,
            "url": "https://patchwork.libcamera.org/api/series/3739/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3739",
            "date": "2023-02-03T09:44:16",
            "name": "Stream hints",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3739/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18248/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18248/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 EA3A4C3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Feb 2023 09:44:33 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 953A0625F0;\n\tFri,  3 Feb 2023 10:44:33 +0100 (CET)",
            "from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E51F625E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Feb 2023 10:44:29 +0100 (CET)",
            "by mail-wr1-x435.google.com with SMTP id q5so4149665wrv.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Feb 2023 01:44:29 -0800 (PST)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tf17-20020a5d50d1000000b002bfe266d710sm1562503wrt.90.2023.02.03.01.44.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 03 Feb 2023 01:44:28 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675417473;\n\tbh=q0n+bsQd9y0IXZxkCQPhfDQxPM/SW3RNIbYmUmff3aw=;\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=AIzwJsfHjPocDcXpkbDT/t05e6Dqekz84nig4aCDJSNafmP4mmvAoPXYjpCoSAbbe\n\t6lKCXILImQ98VRmRB6WfJYHDWgSbJ1cpAtj1V0DJ+44ITT0NvYunkKO2Ntvb/aKa0P\n\tFIbhESwq5O7cAnDxzeTyhdgYL+iEmOgPmWSYN+0GxM88oEwTCejjbn36O3Q/ukso3U\n\t5GU35yGoQv/7SwR0P72SNn4j/kE+8h6sphryQtUVeKXx7yjTvoQ9X8aE4LEtjGJOp6\n\t6VFFcJFBBeOvNz4iWYtdFo3kL7fot65cjqSRh/DqC8hKFZjShtj98j9jhaXTO0gzGy\n\tf/y6N0VtHoMXQ==",
            "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=n81f6GVEXqXm46yv+qRxoawmXUIHe4ldi9NYE18ruYg=;\n\tb=a6+TTmIwCSkgwpXi8MGi/y5HBLFZqkOQZg8CwuCihfS3ipmO4Scd9lTBpkJjeTJBQ0\n\tMnUnIXxSompSvVJJutoEk9VU76nBcfo9uoUkpzlI/l2tsbHS4Fu3fEZ0d27aK68H33rS\n\tdVf24pEi1paA9E7uWRf7cGSONhYWWrMDVH2nML23iK1EPevH6emoClywrl+PRXTyjxnS\n\te+KLXF3oQnyBcOxYJR6iWOaWQmTcPB/5NYp8LLddkTvSxOfXIEqoPBlxfIfPTurWeSQt\n\ta3nfmTKNkw7u7o8qL0x0DtUMZmbREuRBWIiyj7TxTzuZ1q/jz1wUc08SCEuusBfHdVI+\n\thKkg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"a6+TTmIw\"; 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=n81f6GVEXqXm46yv+qRxoawmXUIHe4ldi9NYE18ruYg=;\n\tb=m6qyePb5D0K8B/AKDQlREAnAwpwoLzM21ELZkUtQLVJhY2/dAbsA9jYbLpI2Dy9Uju\n\tU7aCgfgq1UUHg1YQLFudaYHWj/ZJtRUPFNpAurorArKU8dOmBVJRrA0MJ/uNfnnZWTJS\n\tj6/ppGvsFBihwghzvuk2jfYbLiBIaEBx1DORxYLErNUx2KAJR07HNwxSco8dw4y1oNsH\n\tBT15Isay+7FQF768a1Flq0lwVud0YBMDG6MRG2VK0Plv8SuImtUqcDRY4GEYjZllTMSx\n\t6a9VuYntphJfR6AKr5ijtUh2tJ4/WJSWb46frKihPo1W2KHaIVIcwe9LGLC0ql53Z6rV\n\tZ8qA==",
        "X-Gm-Message-State": "AO0yUKXK0C0YHc1hXlW42bEeNpbFZ69f4eBTBjFyu0OX+ye2z6vMTA+U\n\te1ZcauebEn9FtUouE8fcr++4uEG4MYvXdGYb3+bHWQ==",
        "X-Google-Smtp-Source": "AK7set/qxFvRB9WwmvTdbaoGiJ0RVJv1/yoYj85uq6n5mVkTAacIW82y4DrXAwe94FTYAdaOiE1vhQ==",
        "X-Received": "by 2002:a5d:6512:0:b0:2be:5ca0:a7f9 with SMTP id\n\tx18-20020a5d6512000000b002be5ca0a7f9mr7915543wru.33.1675417469116; \n\tFri, 03 Feb 2023 01:44:29 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  3 Feb 2023 09:44:19 +0000",
        "Message-Id": "<20230203094424.25243-4-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230203094424.25243-1-naush@raspberrypi.com>",
        "References": "<20230203094424.25243-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 3/8] pipeline: raspberrypi: Handle\n\tMandatoryStream hints for ISP Output0",
        "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": "Look for MandatoryStream flag in the hints field of the ISP Output0\nStreamConfiguration structure. If this flag is set, it guarantees that\nthe application will provide buffers for the ISP, do not allocate any\ninternal buffers for the device.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 29 ++++++++++++++-----\n 1 file changed, 22 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 7d786fe839f7..b6ed66a1cf46 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1522,7 +1522,7 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \tRPiCameraData *data = cameraData(camera);\n \tunsigned int minUnicamBuffers = data->config_.minUnicamBuffers;\n \tunsigned int minTotalUnicamBuffers = data->config_.minTotalUnicamBuffers;\n-\tunsigned int numRawBuffers = 0;\n+\tunsigned int numRawBuffers = 0, minIspBuffers = 1;\n \tint ret;\n \n \tfor (Stream *s : camera->streams()) {\n@@ -1546,8 +1546,21 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \t\t\t\t\tminTotalUnicamBuffers = 0;\n \t\t\t\t}\n \t\t\t}\n-\n-\t\t\tbreak;\n+\t\t} else if (s == &data->isp_[Isp::Output0]) {\n+\t\t\t/*\n+\t\t\t * Since the ISP runs synchronous with the IPA and requests,\n+\t\t\t * we only ever need a maximum of one internal buffer. Any\n+\t\t\t * buffers the application wants to hold onto will already\n+\t\t\t * be exported through PipelineHandlerRPi::exportFrameBuffers().\n+\t\t\t *\n+\t\t\t * However, as above, if the application provides a guarantee\n+\t\t\t * that the buffer will always be provided for the ISP Output0\n+\t\t\t * stream in a Request, we don't need any internal buffers\n+\t\t\t * allocated.\n+\t\t\t */\n+\t\t\tif (!data->dropFrameCount_ &&\n+\t\t\t    s->configuration().hints & StreamConfiguration::Hint::MandatoryStream)\n+\t\t\t\tminIspBuffers = 0;\n \t\t}\n \t}\n \n@@ -1583,12 +1596,14 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \t\t\t * so allocate the minimum required to avoid frame drops.\n \t\t\t */\n \t\t\tnumBuffers = data->config_.minTotalUnicamBuffers;\n+\t\t} else if (stream == &data->isp_[Isp::Output0]) {\n+\t\t\t/* Buffer count for this is handled in the earlier loop above. */\n+\t\t\tnumBuffers = minIspBuffers;\n \t\t} else {\n \t\t\t/*\n-\t\t\t * Since the ISP runs synchronous with the IPA and requests,\n-\t\t\t * we only ever need one set of internal buffers. Any buffers\n-\t\t\t * the application wants to hold onto will already be exported\n-\t\t\t * through PipelineHandlerRPi::exportFrameBuffers().\n+\t\t\t * Same reasoning as for ISP Output 0, we only ever need\n+\t\t\t * a maximum of one internal buffer for Output1 (required\n+\t\t\t * for colour denoise) and ISP statistics.\n \t\t\t */\n \t\t\tnumBuffers = 1;\n \t\t}\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "3/8"
    ]
}