Patch Detail
Show a patch.
GET /api/patches/23476/?format=api
{ "id": 23476, "url": "https://patchwork.libcamera.org/api/patches/23476/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23476/", "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": "<20250606105651.1624640-3-naush@raspberrypi.com>", "date": "2025-06-06T10:55:20", "name": "[v3,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/23476/mbox/", "series": [ { "id": 5209, "url": "https://patchwork.libcamera.org/api/series/5209/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5209", "date": "2025-06-06T10:55:18", "name": "Eliminating startup frames", "version": 3, "mbox": "https://patchwork.libcamera.org/series/5209/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23476/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23476/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 04090C31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 6 Jun 2025 10:57:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A76F68DC6;\n\tFri, 6 Jun 2025 12:57:01 +0200 (CEST)", "from mail-wm1-x336.google.com (mail-wm1-x336.google.com\n\t[IPv6:2a00:1450:4864:20::336])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5934E68DBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 6 Jun 2025 12:56:57 +0200 (CEST)", "by mail-wm1-x336.google.com with SMTP id\n\t5b1f17b1804b1-43f106a3591so1790395e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 06 Jun 2025 03:56:57 -0700 (PDT)", "from NAUSH-P-DELL.tail9c427.ts.net ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-452137277afsm20092455e9.30.2025.06.06.03.56.54\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 06 Jun 2025 03:56:55 -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=\"fXuU0BU3\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1749207416; x=1749812216;\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=9YoGPuC/dIaxXZXl2DZZumzaSc1VCEyQJUBMyUKq20s=;\n\tb=fXuU0BU34b9bjPk6fBmKqjIUHTjRxJstf/AUHKhwyj4z/2YAgu0Psdz0y7oSqFw++y\n\t+4APilJXFF/3JWgt4MCKHHXh2a+n7tXQlKDctnOquGHsNl84rUzprvP5RZ61Yw/Hd1fw\n\tk7EZM0S7UnaDqY///rEl4YmzPZ6wltbp2Vot03BJyxX4u743IkVcdkvO4oj0Pvj/YO22\n\tPzzQ+xn0zF8xIv/WvS83XNIYa4raxlTOMw1fhpc2ERZoFW69jA+MZLV9pMkkiXLeYDqh\n\tE5djwLRevIXrUWTUtstjyAgNbVOdB87UZAVbDHG1eR7q0hu6IMU/bK7VvTgoQYyn98R7\n\tmN+Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1749207416; x=1749812216;\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=9YoGPuC/dIaxXZXl2DZZumzaSc1VCEyQJUBMyUKq20s=;\n\tb=SmpYQd2zbyKHCMdi03DYVAZfsxG7JLDRMp8g8DsvjqvS7g2sIM6dUtZsRypAPuJqm4\n\tO9SgVqQ9aLKH/HlR71FiOwushsGqY4QMRmri/5WhLsK9AbgMBc6OsjIQWITOSBVF1rXn\n\tdK0AhLLraZmFmbmhbhz1sJSOXnvVUx0dlI9LfUAJk34rZaPiQea0eUvP+gJlwYsa6T1K\n\t99gkNz1wyuCvkT7WJCkHMwKb4oDsHKOpZsgwzbNGGA9DjiYreTGOE/I1CL4pvxNBzVdp\n\tCMT0ndwTkG9/rkuzKBrR1kpSCHHr7WHUnudbu2zwaZQwU/xgQ+HV3whRUfugU8fef2GV\n\tHVNg==", "X-Gm-Message-State": "AOJu0Yylm/oPqcgl6HmkXERoYhkx4oVvjE7stmkp2omcRzyNbJPRAlBD\n\tfApbD/wBAqRow3yYs38nCOstG3iLcgNUUFu8Je+SlSiGfLSOlMjtyjTXS2jfnXRGTUrYGLja5jl\n\tsuVzB", "X-Gm-Gg": "ASbGncu6Hu9sANwxwyr26KRzEWvf6QZwPvKKX2swyvTCOOF7SwmDzcqGs41eE8yBOfW\n\taYttRBgmz9xR7ygaXFLRxrr7EVo0ZN0LZSuiKKaAdJtwXwV+VpjbNiTELmwrwj0nKlSb7XZpcvo\n\tp5z50gdQgW66HQHqdKVrZPmoCkdQrzpzUNpr7YuJ0+rgffPZhmJRfc3qmeysX2XWkV1luJCCiGJ\n\ts35GjJEhgdsrzJLtaRvB6TR470Th3LTIhwFUiKdAb61pcJmVuDbfV//j+5IuNFu2c6mURmFTYj6\n\ttwSk68V3p/8cE/caFpF0HuGXOWSMHHfOOgI+Ul9e2AKUmqcm/75l7WF+XPG8IlvJVQweTjh31zx\n\tl2R+sFsGwhKk=", "X-Google-Smtp-Source": "AGHT+IEpXLfhuab/ICILNtr15MYjv+xfN20emM1EFQdW9A4464JlkWjthQhnrICZxTvte+MYWbwbwg==", "X-Received": "by 2002:a05:600c:3f16:b0:442:7c40:fd81 with SMTP id\n\t5b1f17b1804b1-4529abc8230mr7846405e9.5.1749207416442; \n\tFri, 06 Jun 2025 03:56:56 -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>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>", "Subject": "[PATCH v3 2/6] ipa: rpi: Replace dropFrameCount in the IPA -> PH\n\tinterface", "Date": "Fri, 6 Jun 2025 11:55:20 +0100", "Message-ID": "<20250606105651.1624640-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250606105651.1624640-1-naush@raspberrypi.com>", "References": "<20250606105651.1624640-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>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.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 e0f8b7e782f4..eee81e064e0d 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": [ "v3", "2/6" ] }