Show a patch.

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

{
    "id": 23587,
    "url": "https://patchwork.libcamera.org/api/patches/23587/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23587/",
    "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": "<20250617082956.5699-5-david.plowman@raspberrypi.com>",
    "date": "2025-06-17T08:29:52",
    "name": "[4/7] ipa: rpi: Advance the delay context counter even when IPAs don't run",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "de69b4ba9637e2ec0a04879e9db10f3f91f3d166",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23587/mbox/",
    "series": [
        {
            "id": 5225,
            "url": "https://patchwork.libcamera.org/api/series/5225/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5225",
            "date": "2025-06-17T08:29:48",
            "name": "Raspberry Pi AEC/AGC update",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5225/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23587/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23587/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 E17DEBDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Jun 2025 08:30:16 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7C14F68DDC;\n\tTue, 17 Jun 2025 10:30:12 +0200 (CEST)",
            "from mail-wr1-x433.google.com (mail-wr1-x433.google.com\n\t[IPv6:2a00:1450:4864:20::433])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8166968DC1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jun 2025 10:30:04 +0200 (CEST)",
            "by mail-wr1-x433.google.com with SMTP id\n\tffacd0b85a97d-3a365a6804eso3920855f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Jun 2025 01:30:04 -0700 (PDT)",
            "from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4532e259108sm166062955e9.32.2025.06.17.01.30.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 17 Jun 2025 01:30:03 -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=\"CJNbhO5k\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1750149004; x=1750753804;\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=zGffA9MI6iLQV7MMBALDScxf8HvhkdQ9UfVj+SjJCKA=;\n\tb=CJNbhO5kcS5Uazs80BPPNfBKSdWMYsGLguLqA0T3AMQpw6PI55cUlF7Ob0L/ZuKJaS\n\twCqbMaIXj05kA3m58VSqHwV00AcYkymmYzdHr9PXBC7MnPJlLGyuWS0T2/8XOej0a5X3\n\tFe6swBYWSSkANHqZdb++/pwBa5K8fEH34b9jLFST/oWIqoZqPaUNO2HxiSWznVCcyqCV\n\toobJJ+aUnBYsqzpn1F6alsJE31JE+s91SKBe9y/L1zF7WM/QA9dVZ65b8gNdkAA+dwXc\n\tPFegVx/oyBKxBDnkRiiZxZSlC8riTU+s5RFh8IX+WK3MeqOiW8pyEoFwxig7wB7Okb0l\n\thdGw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1750149004; x=1750753804;\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=zGffA9MI6iLQV7MMBALDScxf8HvhkdQ9UfVj+SjJCKA=;\n\tb=dzPl0dqV1Kn0AaH0RJU3wr4YwAPDFQM/zX/gL4VrOecq+xlXwlxqMQLXv4ZKXjWKes\n\tH3/nM+4KlWxHmBfYd+NUpmPmtl+/rjfYmGhZepJ50TJlsdwtPPtfPAY6GuLOIKEP73Fl\n\t7MjcChQilWhtsPO6Xx5Bx0mK97g/o2QFNvcUJd/xEOJowLv29LjGm6fVttYiInBjiSOE\n\tht4bnPJ5F9RjVaVCB+cY7/bdz5jSNCpdIGNlHn9TKkCvDML5tRU2uAhCq3lGPjbhpj6T\n\tsyhKLyKXHJ/IFMk1HGvbpRBZAWcqmJAH5nr8AANJIdr1jbxufvu14Bk0uuP5sHCxVHcn\n\tJUdA==",
        "X-Gm-Message-State": "AOJu0Yy163CYqGYwAVb1yzFosAW56q5FjoVrZe6bnql6VWjVDj+c5O16\n\tKgNeBf0D2t015xLx/T5L74mT9bO0ZjuKPSqIXr/cb4gcruKssmOhPJk/PFyHDZXWXZSy5jaMYKE\n\tiQ4u3",
        "X-Gm-Gg": "ASbGncsQ3y0X8gDEkoGqRYTPhVa3rnEDgVtAa9K2JQaHUIOjMuU9Dxl6IQ5zkpD+ey6\n\t+dUDvAQ9YHB/7VQrlm6vFGu0aQYPTEqY6uUgg60Xt/tIihT1nfcsgNbo+eN+YOThaBNmfIL5gbh\n\tug7Lj9L7keTfoSCgfkDenftwy+aShba1hLBVaVIuxE2HgxPWOc9PCWdS1Jb4mXcj2jVOu88c2ad\n\tFaP650norbdTC1oqLaEcG2Rizv7ofedw22YfFnVrsn6RGI/CYG/PtGMYCmAG/GGNt2dwAgUFdza\n\tCtYsv1rNyPOPCfQd0UIXzECaVW0LXB9Zfh1qZbj00K64F7zK5E03RpBLrwAGGgJQV41KpZnZXfu\n\tgwKmaBjN/22ph+GJ2hw==",
        "X-Google-Smtp-Source": "AGHT+IF5mf3OfIarWoHXUuHBJcmJitTNaoeR9yUHmqRUMJR4A2HRENz/bccDV00mPU3EMlDj6VottA==",
        "X-Received": "by 2002:a05:6000:2088:b0:3a5:67d5:a400 with SMTP id\n\tffacd0b85a97d-3a5723a3650mr10718931f8f.33.1750149003712; \n\tTue, 17 Jun 2025 01:30:03 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "David Plowman <david.plowman@raspberrypi.com>",
        "Subject": "[PATCH 4/7] ipa: rpi: Advance the delay context counter even when\n\tIPAs don't run",
        "Date": "Tue, 17 Jun 2025 09:29:52 +0100",
        "Message-Id": "<20250617082956.5699-5-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.39.5",
        "In-Reply-To": "<20250617082956.5699-1-david.plowman@raspberrypi.com>",
        "References": "<20250617082956.5699-1-david.plowman@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": "The delay context counter must be advanced even when we decide not to\nrun prepare/process. Otherwise, when we skip them at higher\nframerates, the current IPA context counter will catch up and\noverwrite the delay context.\n\nIt's safe to advance the counter because the metadata is always copied\nforward a slot when we decide not to run the IPAs.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 05699228..7af4ea5e 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -491,10 +491,11 @@ void IpaBase::prepareIsp(const PrepareParams &params)\n void IpaBase::processStats(const ProcessParams &params)\n {\n \tunsigned int ipaContext = params.ipaContext % rpiMetadata_.size();\n+\tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n \n-\tif (processPending_ && frameCount_ >= mistrustCount_) {\n-\t\tRPiController::Metadata &rpiMetadata = rpiMetadata_[ipaContext];\n+\tDuration offset(0s);\n \n+\tif (processPending_ && frameCount_ >= mistrustCount_) {\n \t\tauto it = buffers_.find(params.buffers.stats);\n \t\tif (it == buffers_.end()) {\n \t\t\tLOG(IPARPI, Error) << \"Could not find stats buffer!\";\n@@ -510,7 +511,6 @@ void IpaBase::processStats(const ProcessParams &params)\n \t\tcontroller_.process(statistics, &rpiMetadata);\n \n \t\t/* Send any sync algorithm outputs back to the pipeline handler */\n-\t\tDuration offset(0s);\n \t\tstruct SyncStatus syncStatus;\n \t\tif (rpiMetadata.get(\"sync.status\", syncStatus) == 0) {\n \t\t\tif (minFrameDuration_ != maxFrameDuration_)\n@@ -522,14 +522,14 @@ void IpaBase::processStats(const ProcessParams &params)\n \t\t\tif (syncStatus.timerKnown)\n \t\t\t\tlibcameraMetadata_.set(controls::rpi::SyncTimer, syncStatus.timerValue);\n \t\t}\n+\t}\n \n-\t\tstruct AgcStatus agcStatus;\n-\t\tif (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n-\t\t\tControlList ctrls(sensorCtrls_);\n-\t\t\tapplyAGC(&agcStatus, ctrls, offset);\n-\t\t\tsetDelayedControls.emit(ctrls, ipaContext);\n-\t\t\tsetCameraTimeoutValue();\n-\t\t}\n+\tstruct AgcStatus agcStatus;\n+\tif (rpiMetadata.get(\"agc.status\", agcStatus) == 0) {\n+\t\tControlList ctrls(sensorCtrls_);\n+\t\tapplyAGC(&agcStatus, ctrls, offset);\n+\t\tsetDelayedControls.emit(ctrls, ipaContext);\n+\t\tsetCameraTimeoutValue();\n \t}\n \n \t/*\n",
    "prefixes": [
        "4/7"
    ]
}