Show a patch.

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

{
    "id": 17969,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17969/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17969/",
    "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": "<20221209090050.19441-6-naush@raspberrypi.com>",
    "date": "2022-12-09T09:00:43",
    "name": "[libcamera-devel,v4,05/12] pipeline: raspberrypi: Handle MandatoryRequestBuffer hints for Unicam Image",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "e4078b48eee132e2e47aa0cb238ec8971a138687",
    "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/17969/mbox/",
    "series": [
        {
            "id": 3663,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3663/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3663",
            "date": "2022-12-09T09:00:38",
            "name": "Raspberry Pi: Platform configuration and buffer allocation improvements",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3663/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17969/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17969/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 38ADEBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  9 Dec 2022 09:01:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C4BB463365;\n\tFri,  9 Dec 2022 10:01:37 +0100 (CET)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EC7D063351\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  9 Dec 2022 10:01:32 +0100 (CET)",
            "by mail-wm1-x32e.google.com with SMTP id\n\tm4-20020a05600c3b0400b003d1cb516ce0so5261441wms.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 09 Dec 2022 01:01:32 -0800 (PST)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 09 Dec 2022 01:01:31 -0800 (PST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1670576497;\n\tbh=TT8f77VfTo8ZsU6VKEbwskQdfs0h8NsHNAVP1IObN3A=;\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=Gtu68EU+I8O+RCi5ZJVeTH4vhzxIfFM5dfB12/BNndHJxkWQHfp67iRFBQjUoS67j\n\twDIKDEDhG0//ws8N9d4BbcFAwKBX/W/oQPJ5svbOoC/4uMDLVhboa8vwmDMzujBvYV\n\tiI6ke1xx9CpHofx8QIQ2ZWGszbJXmg5hmuPHJxDCckjrVHGH6ivAZgubQUxVpsH/hf\n\t8p4+14Mbac9uKDXPIyCFxOA78I4Hek8OslPgnWSoYIhzueuEdsqrAfxhS7dNKKKwv8\n\tuxthOwiUVPfeteaG9asujN7nxt7/zCUtPmLJmoYVfbljwLbC+RLxB3LejnAi35cHYS\n\tYBsidFVGYPz4Q==",
            "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=piRa1vTJhlTRtSSbS36pBvVbQZnm13Bd6mtMgWMjARU=;\n\tb=jnN0rIhH2Z8heL/iBwOqcHiaondBsziGzzjN1wJI4KgC8DHiGxOlGpfwaP9QDd2701\n\tMb6ubibkKdCmj261Y8/iOhQHGHXOzpC/+9U/yaXkEtBaTsQUo83MYWBHB2s0NU2Xgw4V\n\twxOIttbgCd5c1g4JoQLMIuEHGE4FwxTdmWVQnfclYpIecpB7+fT1ivmh7b1erGnYOMq5\n\t8RzqnEGMEfpIaB/f+npdvMu9KjD+IqLc1RLlAigl22j5wHuko+7rYXxN2aqcz+5kcpTs\n\tgpjp5boR6O6B9FutqIc85vEDlCfEFSZVxtKoMVvlY5l6X+Ue9w6y0ItnLGpzArJdaL3b\n\tHMpA=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"jnN0rIhH\"; 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=piRa1vTJhlTRtSSbS36pBvVbQZnm13Bd6mtMgWMjARU=;\n\tb=t+uBqBHlQiex2kljRGYoQpFiNwFJGM3ocV58fx+hxv9SKWFAOcIiUAhHUQbpHghPfS\n\t3zq4cxe/QwLsvjJII13GIHCDcysmX2COY1Y0oyERgYpOkQuqCZ1YCXRrADdLbo/zov6+\n\tjQ26cRvnmQBwGlylMkBcoM0TO6G9GE5Nabh6S76+qpVjzU8B86FYCa5TQFvMSfzPd/Ny\n\tI41EE5jWe/TB4mq6Pf3x11ZEvmnCCglN/lHqnGAJk5IevjnK2CYe+bKG5TDej+SOD5vQ\n\tuWfzGj3iL7ygIanwHCBYOsdvi1EpZVKzn9auRr9O52doF8JWcrLqUNcRm7F7MU1vIg5t\n\tfCDw==",
        "X-Gm-Message-State": "ANoB5pljSp6VhWNuCF4kCLEf8Gq0GU0f2Akv8XF8Adkxo+lkSeh7c29Y\n\tsz5U0S+jvvVl5CTAXNKQ3Yt2g0k+hCsxrPcT",
        "X-Google-Smtp-Source": "AA0mqf6sVZLMIbxle3FItyBdI6o/1WnZcfUze/UowsAko0aTuFLLhiu/ZhAmh8lAgCCwUsXO//M0Xg==",
        "X-Received": "by 2002:a05:600c:3b9c:b0:3d1:e710:98ec with SMTP id\n\tn28-20020a05600c3b9c00b003d1e71098ecmr5003710wms.21.1670576492195; \n\tFri, 09 Dec 2022 01:01:32 -0800 (PST)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  9 Dec 2022 09:00:43 +0000",
        "Message-Id": "<20221209090050.19441-6-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221209090050.19441-1-naush@raspberrypi.com>",
        "References": "<20221209090050.19441-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 05/12] pipeline: raspberrypi: Handle\n\tMandatoryRequestBuffer hints for Unicam Image",
        "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 MandatoryRequestBuffer flag in the hints field of the Unicam Image\nStreamConfiguration structure. If this flag is set, it guarantees that the\napplication will provide buffers for Unicam Image, so override the\nminUnicamBuffers and minTotalUnicamBuffers config parameters in the following\nway:\n\n- If startup drop frames are required, allocate at least 1 internal buffer.\n- If no startup drop frames are required, do not allocate any internal buffers.\n\nAll other buffer allocations remain unchanged.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n .../pipeline/raspberrypi/raspberrypi.cpp      | 36 ++++++++++++++-----\n 1 file changed, 28 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex c5a489fc7581..8be46962e825 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1447,12 +1447,33 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera)\n int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n {\n \tRPiCameraData *data = cameraData(camera);\n-\tunsigned int numRawBuffers = 0;\n+\tunsigned int minUnicamBuffers = data->config_.minUnicamBuffers,\n+\t\t     minTotalUnicamBuffers = data->config_.minTotalUnicamBuffers,\n+\t\t     numRawBuffers = 0;\n \tint ret;\n \n \tfor (Stream *s : camera->streams()) {\n-\t\tif (isRaw(s->configuration().pixelFormat)) {\n+\t\tif (s == &data->unicam_[Unicam::Image]) {\n \t\t\tnumRawBuffers = s->configuration().bufferCount;\n+\t\t\t/*\n+\t\t\t * If the application provides a guarantees that Unicam\n+\t\t\t * image buffers will always be provided for the RAW stream\n+\t\t\t * in a Request, we need:\n+\t\t\t * - at least 1 internal Unicam buffer to handle startup frame drops,\n+\t\t\t * - no internal Unicam buffers if there are no startup frame drops.\n+\t\t\t */\n+\t\t\tif (s->configuration().hints &\n+\t\t\t    StreamConfiguration::Hint::MandatoryRequestBuffer) {\n+\t\t\t\tif (data->dropFrameCount_) {\n+\t\t\t\t\tminUnicamBuffers = std::max(1u, minUnicamBuffers);\n+\t\t\t\t\tminTotalUnicamBuffers =\n+\t\t\t\t\t\tstd::max(minUnicamBuffers, minTotalUnicamBuffers);\n+\t\t\t\t} else {\n+\t\t\t\t\tminUnicamBuffers = 0;\n+\t\t\t\t\tminTotalUnicamBuffers = 0;\n+\t\t\t\t}\n+\t\t\t}\n+\n \t\t\tbreak;\n \t\t}\n \t}\n@@ -1464,7 +1485,6 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\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\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@@ -1472,8 +1492,8 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\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>(data->config_.minUnicamBuffers,\n-\t\t\t\t\t\t   minBuffers - numRawBuffers);\n+\t\t\tnumBuffers = std::max<int>(minUnicamBuffers,\n+\t\t\t\t\t\t   minTotalUnicamBuffers - 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@@ -1481,15 +1501,15 @@ int PipelineHandlerRPi::prepareBuffers(Camera *camera)\n \t\t\t * available.\n \t\t\t */\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+\t\t\t\t     std::max<int>(minUnicamBuffers,\n+\t\t\t\t\t\t   minTotalUnicamBuffers - numRawBuffers);\n \n \t\t} else if (stream == &data->unicam_[Unicam::Embedded]) {\n \t\t\t/*\n \t\t\t * Embedded data buffers are (currently) for internal use,\n \t\t\t * so allocate the minimum required to avoid frame drops.\n \t\t\t */\n-\t\t\tnumBuffers = minBuffers;\n+\t\t\tnumBuffers = data->config_.minTotalUnicamBuffers;\n \t\t} else {\n \t\t\t/*\n \t\t\t * Since the ISP runs synchronous with the IPA and requests,\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "05/12"
    ]
}