Patch Detail
Show a patch.
GET /api/patches/23417/?format=api
{ "id": 23417, "url": "https://patchwork.libcamera.org/api/patches/23417/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23417/", "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": "<20250522075244.1198110-3-naush@raspberrypi.com>", "date": "2025-05-22T07:48:18", "name": "[v2,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/23417/mbox/", "series": [ { "id": 5188, "url": "https://patchwork.libcamera.org/api/series/5188/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5188", "date": "2025-05-22T07:48:16", "name": "Eliminating startup frames", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5188/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23417/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23417/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 6A660C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 May 2025 07:53:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1D89668D93;\n\tThu, 22 May 2025 09:52:55 +0200 (CEST)", "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 43BF168D8E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 09:52:49 +0200 (CEST)", "by mail-wr1-x435.google.com with SMTP id\n\tffacd0b85a97d-3a368259589so801171f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 May 2025 00:52:49 -0700 (PDT)", "from NAUSH-P-DELL.pitowers.org ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-3a3ca066eb7sm4191516f8f.2.2025.05.22.00.52.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 22 May 2025 00:52:48 -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=\"d0/+eHyb\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1747900368; x=1748505168;\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=5BhPQUO12kezx2EizAFy/txyAFMDEYzTcgAZJffzSAU=;\n\tb=d0/+eHyb7NYm4btTlpE0PDKnc6RLDFuQ/cSaq3JeZeiobkwY+OHNNO647+CktKvHxA\n\t4lWV0SWEN/gGTdZD/vcW6KNYAYHNvTq/IP6+HjpDVrWnEPCu29mCncg08YS/vrsj89Ja\n\tgOPM0BnLe5TyXNz2tcS9MMzPfOOqB0+HlpEgIIYbrNbkPF13YyqkSKScYQZoaEAYWwJ4\n\tFCruqQDZe4PKxP1K6NiXKUiZ4FIA7DzsAZFwP27St/ryQj+iMAybTRddYKc0DJLm8RtY\n\tUixd1KIa5vz2mJwU6dcFHh+VWvbnBvqTJgjObE3LF5O3OgheZVJTZfOSTeoPpoJ0a0an\n\tu+7w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1747900368; x=1748505168;\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=5BhPQUO12kezx2EizAFy/txyAFMDEYzTcgAZJffzSAU=;\n\tb=HfY3y7UzAUuAQ5imlcJcSIYQwpuxxiQtuIVYnuy3IbopVxL2nn1+yruPxbS7S1fYNi\n\thzaPn3cGY6Pbm+1Qw/XQio3Z0NXmVyM0GmFFaUmyue893uh+Aql0/pSqxLUDO29BkDYR\n\tF3fn0kLbum+bbH/jzHGtItRZSR7CDWwTwhR8NE1SYarbM1qTKiy1z5Zg2iFHp19SsBPn\n\tf8KR0bnZE0h3aOMdy/lNo4GRQv/eHMrl+CVPb91ROCvZhjvRsVLgZ3Lb09qdSU+5xjkT\n\tE1KenSFktWuPNH7wXQPOWiOotJm1RP8g3V5E2EC+B6QpCIKyer5bZgfoW2Cj7Pqb8v0S\n\tnmbQ==", "X-Gm-Message-State": "AOJu0YyLQ4sbkcXXUiL5NXZroQ3skRylWVJUAkCrmq2rjSWhXbop+V6h\n\tAkoIUKx/Tc4kzaj3HmRTFUyll0zvix/fI/qu1YNFfVQIudA6ivi49XBiYD50e0XfTfXpblb9Vdg\n\tU9n4f", "X-Gm-Gg": "ASbGncsJCRfcAi/8ZSlbMp5RE74jdT25ocAuZlRhkxJpLUmrfRNV2lAGe47YrQanqgk\n\tbGn4xHKn3yFgOE+L4WzHxf47S0+N5HvJ69nHY6uPQOIgzy8ffYkMLSsRI3Hdkeo2B3DXrMb06vh\n\tlO/R6xKLM+mJMmWmSxzmSTEHNkNBF2Zdt9bvAYCrYLp/aCxfLuDiFiSCz6N8LJ/MahXtw5YafO2\n\tjmgq2UbrpnTDSjh1GpvOo+a+0rcUZN8zCjxZY50bHFFgNC1jwutb9VTC6o8Yrc0R0iSTSkkCqCZ\n\tedYcub1V/gAQjnhpMoOppP09kOLNno0RcGmXFxGkPd8aVjN2c4AZ3bRPmhRcNFGtHDwWwT0=", "X-Google-Smtp-Source": "AGHT+IE7j5Gt+ezuR+wam29k5eGH3PX6+R4nD2usHMrtfU0D4LVqTd/c/7vGrQ5Uv9TSPNzP35xWhw==", "X-Received": "by 2002:adf:f10e:0:b0:3a3:5c8e:2d8d with SMTP id\n\tffacd0b85a97d-3a35c8e2da0mr7072466f8f.0.1747900368488; \n\tThu, 22 May 2025 00:52:48 -0700 (PDT)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Naushir Patuck <naush@raspberrypi.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>", "Subject": "[PATCH v2 2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH\n\tinterface", "Date": "Thu, 22 May 2025 08:48:18 +0100", "Message-ID": "<20250522075244.1198110-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250522075244.1198110-1-naush@raspberrypi.com>", "References": "<20250522075244.1198110-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>\nReviewed-by: David Plowman <david.plowman@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": [ "v2", "2/6" ] }