Show a patch.

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

{
    "id": 23343,
    "url": "https://patchwork.libcamera.org/api/patches/23343/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23343/",
    "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": "<20250507082753.2306743-3-naush@raspberrypi.com>",
    "date": "2025-05-07T07:52:09",
    "name": "[RFC,2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d8413c0c9edf628fad57ceff5e8fd3664bcfd92f",
    "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/23343/mbox/",
    "series": [
        {
            "id": 5164,
            "url": "https://patchwork.libcamera.org/api/series/5164/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5164",
            "date": "2025-05-07T07:52:07",
            "name": "Eliminating startup frames",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5164/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23343/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23343/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 92DEAC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 May 2025 08:28:10 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BDBB668B30;\n\tWed,  7 May 2025 10:28:08 +0200 (CEST)",
            "from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1573268B2F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 May 2025 10:27:59 +0200 (CEST)",
            "by mail-wm1-x32c.google.com with SMTP id\n\t5b1f17b1804b1-43ceeb85ab2so6124365e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 May 2025 01:27:59 -0700 (PDT)",
            "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-441d440fff6sm22182575e9.25.2025.05.07.01.27.57\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 07 May 2025 01:27:58 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"gLOn5J1f\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1746606478; x=1747211278;\n\tdarn=lists.libcamera.org; \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=fnaMAqT31Sn1HyYeUSz/LRhNsF9NQEXQj8bpQHhMNn0=;\n\tb=gLOn5J1fthRI2lpvsaWKenLBHcmUtBoLoMkAAp61xt95xnt45YVorb/M+5j6LJhmtO\n\t+HHPVZxtuJFPJQy+bYMFb4+SPGs9TGUSiRvpZu1n6aRhyNljXhGIssN4621hSodjikDF\n\tBuTQSYgMs2tlL+R3igOGPjD21XNQa/6qiwR/8mEYENGg6Q0E1D+iVVK5qpJOM8+NjFHz\n\tGZiOSVJlmhoFa/WUJoWkX6azDOMpYhVL6V6DW86ILWgvW7QNmcqy0xDzgXu3nkqPzXbE\n\tHB58mZiV2p2oBbT+xxWaavy9HMg5c7Vo8V5EKQ8ks8sV4HghCPBnMH/teaMh6Iv5UshQ\n\tqAWg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1746606478; x=1747211278;\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=fnaMAqT31Sn1HyYeUSz/LRhNsF9NQEXQj8bpQHhMNn0=;\n\tb=vUX/eXctppgSJdjFZYAFz8lipTcWhq8bXXXeHSpp2pGwbVFT1LOwyZjAxm7NuXmoAX\n\tT1LTiybAS+LZ87R91qPuO8VbEMH/N5Kbf5a7iQ42cqaAWtC8Koo2RBcHDoh2F6wC1Y8O\n\tpZJCxangL9KIeYjqy2ImM4G2n9WR03GuR6FVWRSXa+/0dvKIDp9j9fgCVOnA1vWErwCA\n\t4ZAjbvH9Wq2OuZaIZu6LtPPCrVRc74UgtsQzbCQDFuuaD3wzCgBQnrDWKDPjpXyAn93V\n\tTGwplPcl+014PLMY8+TKAJfeGoYfA4uN0DDUEJtXzbtLz8PhtItLFglTnvpeP4KWE9W9\n\tP5lg==",
        "X-Gm-Message-State": "AOJu0Ywx54ZSM0Z5Y1xfChVEmFXJS+02UfiJGjIlf7HsmL0JHCcoRXVI\n\t0IO0Ki9TRINwibwvoueBdzNu8nA8h+YsVPIKzEmj6qfVHw0mVo6j7UMr/WP3SfCnp1yAVWEi6TY\n\tL",
        "X-Gm-Gg": "ASbGncuRC4qfcyCY3xKDrMyJBajVsq0Z6IBhTZmyefBJeIy/zTFuzEh2eYBWMgHF7mm\n\tw7ueyCgtbr5B3hZ7jLL4wgJU/ulfCC75dkGl8PZLQMULH2Cw929kVreHICR3S8QJj5ij5TidBt1\n\tHiT02TqKYIv0ngmO2MVo69t1F51sirQW3lU8Nq6k4OrnNCN5tPRMA0gd2yWI4t5Uyelu7UmAlg1\n\tD42veTj2C5QSpfvAFK8Wgtb9TPaAifLXDGa7D5hlraznlgNh4/pdyFInAthsOUbg0gksgc5i2Ny\n\t+S6QfwlyWFtWTvbNC+uwQ80cuGoIJ8Npv3VNdI3MQ67PVaXsnz4zOHYvW2MI",
        "X-Google-Smtp-Source": "AGHT+IHi1q/l/kinKA98ZH8w+3vOHua7qQcRiDkumRVPaE0luc9b38F00rrDALa47ysEezWZQIyhRA==",
        "X-Received": "by 2002:a05:600c:1c8c:b0:441:b397:e324 with SMTP id\n\t5b1f17b1804b1-441d44ed543mr5482525e9.9.1746606478460; \n\tWed, 07 May 2025 01:27:58 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Naushir Patuck <naush@raspberrypi.com>",
        "Subject": "[RFC PATCH 2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH\n\tinterface",
        "Date": "Wed,  7 May 2025 08:52:09 +0100",
        "Message-ID": "<20250507082753.2306743-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20250507082753.2306743-1-naush@raspberrypi.com>",
        "References": "<20250507082753.2306743-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Replace the dropFrameCount parameter returned from ipa::start() to the\npipeline handler by startupFrameCount and invalidFrameCount. The former\ncounts the number of frames required for AWB/AGC to converge, and the\nlatter counts the number of invalid frames produced by the sensor when\nstarting up.\n\nIn the pipeline handler, use the sum of these 2 values to replicate the\nexisting dropFrameCount behaviour.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom            |  3 ++-\n src/ipa/rpi/common/ipa_base.cpp                    | 14 ++++++++------\n .../pipeline/rpi/common/pipeline_base.cpp          |  4 ++--\n 3 files changed, 12 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex e30c70bde08b..12b083e9d04b 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -52,7 +52,8 @@ struct ConfigResult {\n \n struct StartResult {\n \tlibcamera.ControlList controls;\n-\tint32 dropFrameCount;\n+\tint32 startupFrameCount;\n+\tint32 invalidFrameCount;\n };\n \n struct PrepareParams {\ndiff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex e0a93daa9db2..c15f8a7bf71e 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -324,6 +324,7 @@ void IpaBase::start(const ControlList &controls, StartResult *result)\n \t * \"mistrusted\", which depends on whether this is a startup from cold,\n \t * or merely a mode switch in a running system.\n \t */\n+\tunsigned int agcConvergenceFrames = 0, awbConvergenceFrames = 0;\n \tframeCount_ = 0;\n \tif (firstStart_) {\n \t\tdropFrameCount_ = helper_->hideFramesStartup();\n@@ -336,7 +337,6 @@ void IpaBase::start(const ControlList &controls, StartResult *result)\n \t\t * (mistrustCount_) that they won't see. But if zero (i.e.\n \t\t * no convergence necessary), no frames need to be dropped.\n \t\t */\n-\t\tunsigned int agcConvergenceFrames = 0;\n \t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\tcontroller_.getAlgorithm(\"agc\"));\n \t\tif (agc) {\n@@ -345,7 +345,6 @@ void IpaBase::start(const ControlList &controls, StartResult *result)\n \t\t\t\tagcConvergenceFrames += mistrustCount_;\n \t\t}\n \n-\t\tunsigned int awbConvergenceFrames = 0;\n \t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\tcontroller_.getAlgorithm(\"awb\"));\n \t\tif (awb) {\n@@ -353,15 +352,18 @@ void IpaBase::start(const ControlList &controls, StartResult *result)\n \t\t\tif (awbConvergenceFrames)\n \t\t\t\tawbConvergenceFrames += mistrustCount_;\n \t\t}\n-\n-\t\tdropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });\n-\t\tLOG(IPARPI, Debug) << \"Drop \" << dropFrameCount_ << \" frames on startup\";\n \t} else {\n \t\tdropFrameCount_ = helper_->hideFramesModeSwitch();\n \t\tmistrustCount_ = helper_->mistrustFramesModeSwitch();\n \t}\n \n-\tresult->dropFrameCount = dropFrameCount_;\n+\tresult->startupFrameCount = std::max({ agcConvergenceFrames, awbConvergenceFrames });\n+\tresult->invalidFrameCount = dropFrameCount_;\n+\n+\tdropFrameCount_ = std::max({ dropFrameCount_, agcConvergenceFrames, awbConvergenceFrames });\n+\n+\tLOG(IPARPI, Debug) << \"Startup frames: \" << result->startupFrameCount\n+\t\t\t   << \" Invalid frames: \" << result->invalidFrameCount;\n \n \tfirstStart_ = false;\n \tlastRunTimestamp_ = 0;\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 1f13e5230fae..5956485953a2 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -660,8 +660,8 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)\n \t\tdata->setSensorControls(result.controls);\n \n \t/* Configure the number of dropped frames required on startup. */\n-\tdata->dropFrameCount_ = data->config_.disableStartupFrameDrops\n-\t\t\t      ? 0 : result.dropFrameCount;\n+\tdata->dropFrameCount_ = data->config_.disableStartupFrameDrops ?\n+\t\t\t0 : result.startupFrameCount + result.invalidFrameCount;\n \n \tfor (auto const stream : data->streams_)\n \t\tstream->resetBuffers();\n",
    "prefixes": [
        "RFC",
        "2/6"
    ]
}