Show a patch.

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

{
    "id": 23387,
    "url": "https://patchwork.libcamera.org/api/patches/23387/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23387/",
    "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": "<20250519092245.269048-3-naush@raspberrypi.com>",
    "date": "2025-05-19T09:20:50",
    "name": "[v1,2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH interface",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "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/23387/mbox/",
    "series": [
        {
            "id": 5182,
            "url": "https://patchwork.libcamera.org/api/series/5182/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5182",
            "date": "2025-05-19T09:20:48",
            "name": "Eliminating startup frames",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5182/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23387/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23387/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 0DE47BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 19 May 2025 09:23:00 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3C95768D7D;\n\tMon, 19 May 2025 11:22:56 +0200 (CEST)",
            "from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com\n\t[IPv6:2a00:1450:4864:20::42c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DA40968B66\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 May 2025 11:22:52 +0200 (CEST)",
            "by mail-wr1-x42c.google.com with SMTP id\n\tffacd0b85a97d-3a362e099cfso400356f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 19 May 2025 02:22:52 -0700 (PDT)",
            "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a366e08747sm8645961f8f.95.2025.05.19.02.22.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 19 May 2025 02:22:51 -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=\"UY41eqT0\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1747646572; x=1748251372;\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=UY41eqT0smcRWRSd3LFzmd89npTGGMe6Q1NjR5O62G9oYKYpP1zEv+HCDNM3pMKMbg\n\t5YnB/uGy/bZQcCx7TkD97Yz3CJjID6+/hpe65VXDeZ0bMA50y3NknEwoqw01UFKZ13fb\n\tPWim7kuzem5yU8vHpBY2l2KOsu3bWwUWSmiTPpqcymSH3UFVtAGjacwulIt5GpAwx3qV\n\tYWaIQ0qc+APajzuGWnI5VP6x0LTOIpbREAKa3ZtHzEVV9s+PPhkQLyh016+kP6HlYAjW\n\tF8cVZTZQTycukYdL93f7q6Lj8UVJ9+Tx6So9WObrh98EP+0zor1PHIdiQDyCbx/5K2cz\n\tqrLg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747646572; x=1748251372;\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=gCI2DPXGepkiOexk4drZeA+0/TbZ+IWY9gJT9uHHPYdI7M0PpfTyXxxys0fePogj05\n\teR0iYesnubYAQm2lDg30BsSeGSfP2eM71R4xVjKQR0ibGf2mzAF+4EH7OyHF6uzMeIVE\n\tHDKjkW/lX2kpY9UF2W3ykPr3MYWM+JokHw3hPvKrFs+MjfODL77chSKQEGHrqWzNqLL9\n\t5Vn2DRXALYykMcrZaRZCeEUGG7P251KVX4sc73jslFy1VgIzIDyVbcGnpg6JKouh6jhS\n\tF1YPkNL+dG1lvQJdPZURTg2kZeEFnitPsjEwoXbpzeC3Smx16qI4E47VbMbN4HdkIPtS\n\tfsCQ==",
        "X-Gm-Message-State": "AOJu0YzFsivEAE6mly7lpYsn24/CqSU9lrg1fh2dWOipwg1bBB1UowbP\n\tvXV+S6YgV9KCTajnEOrbOPlDigKxOjb4n3C0cYXLMwf3j7P8rWPrd/hBOT7pjx8AJXkKeNCQH/y\n\tHcpum",
        "X-Gm-Gg": "ASbGncsVReOcYAiBfqckBRCMkE1XnhOw+8wu1WNWwOffuuaU6ywKR7vHxwkPLzz8vOw\n\tf+evlifehzd0ya0IUFowx9RwtpSDxIkiCHzl7foOHV8Z//lsh17d0T30vBe5U54KVtXuzCHK1Ba\n\tLCGm+anPLC8hTQqTpwD9Gytek2gULOI8ZOxV60sDKjUZO3xBn2KyVEcYHx7HLIIQyOjUC0IEd4d\n\tCGuqbe3qAA9pZRExiTbq9tP7H/lP0LgEByOtnYw/8nfHzp6fYKTTo6tYVy+DteV4R9QVblO47r8\n\tTcrzHHHnwRvFrGF/+RkCwu35olSsF/xJrhWkVBfck85p8DeVWKqkQwjvIdrt7mIHPTerLOw=",
        "X-Google-Smtp-Source": "AGHT+IFNSWXSO7SVzY8UXBRz30mcxBjKr8b4W3bugqa6AxWLA4JYnt75K+Ag4HRSzYyHwvF+C9qkqQ==",
        "X-Received": "by 2002:a5d:64c5:0:b0:3a3:6964:57c8 with SMTP id\n\tffacd0b85a97d-3a369645a0fmr2005956f8f.5.1747646572107; \n\tMon, 19 May 2025 02:22:52 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Naushir Patuck <naush@raspberrypi.com>",
        "Subject": "[PATCH v1 2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH\n\tinterface",
        "Date": "Mon, 19 May 2025 10:20:50 +0100",
        "Message-ID": "<20250519092245.269048-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.43.0",
        "In-Reply-To": "<20250519092245.269048-1-naush@raspberrypi.com>",
        "References": "<20250519092245.269048-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": [
        "v1",
        "2/6"
    ]
}