Show a patch.

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

{
    "id": 25617,
    "url": "https://patchwork.libcamera.org/api/patches/25617/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25617/",
    "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": "<20251220172703.321681-1-johannes.goede@oss.qualcomm.com>",
    "date": "2025-12-20T17:27:03",
    "name": "ipa: simple: agc: Make sure activeState.agc expo/again are always initialized",
    "commit_ref": "03fc5f6c940fd59efbd445b462606d5a728930f5",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "199828f630bff379196237180c03718e0c4362dd",
    "submitter": {
        "id": 242,
        "url": "https://patchwork.libcamera.org/api/people/242/?format=api",
        "name": "Hans de Goede",
        "email": "johannes.goede@oss.qualcomm.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25617/mbox/",
    "series": [
        {
            "id": 5676,
            "url": "https://patchwork.libcamera.org/api/series/5676/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5676",
            "date": "2025-12-20T17:27:03",
            "name": "ipa: simple: agc: Make sure activeState.agc expo/again are always initialized",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5676/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25617/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25617/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 6BC94C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 20 Dec 2025 17:27:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4B0F761F8B;\n\tSat, 20 Dec 2025 18:27:10 +0100 (CET)",
            "from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com\n\t[205.220.168.131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B518F6142F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Dec 2025 18:27:08 +0100 (CET)",
            "from pps.filterd (m0279862.ppops.net [127.0.0.1])\n\tby mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n\t5BKBP17T3813079 for <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Dec 2025 17:27:06 GMT",
            "from mail-qt1-f200.google.com (mail-qt1-f200.google.com\n\t[209.85.160.200])\n\tby mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4b5mru11se-1\n\t(version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Dec 2025 17:27:06 +0000 (GMT)",
            "by mail-qt1-f200.google.com with SMTP id\n\td75a77b69052e-4ed74ab4172so60688941cf.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Dec 2025 09:27:06 -0800 (PST)",
            "from shalem\n\t(2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl.\n\t[2001:1c00:c32:7800:5bfa:a036:83f0:f9ec])\n\tby smtp.gmail.com with ESMTPSA id\n\t4fb4d7f45d1cf-64b91599844sm5183679a12.25.2025.12.20.09.27.03\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 20 Dec 2025 09:27:03 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=qualcomm.com header.i=@qualcomm.com\n\theader.b=\"pZ3neCsV\"; dkim=pass (2048-bit key;\n\tunprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n\theader.b=\"K3gwAQI8\"; dkim-atps=neutral",
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n\tcc:content-transfer-encoding:date:from:message-id:mime-version\n\t:subject:to; s=qcppdkim1; bh=vDOcA/K0sWgLAjNFkPnv56dWZf7YgCNx8cO\n\tGDj2FkG0=; b=pZ3neCsVR3UJwyotl3zTBlnZb+UmzHPHMMqIqeWy3vawX0D8oXC\n\tP6CVSyI4IdzRp5UPam4UUD+iJOxsU2SPRRLaAKCy/cWLlkbg+8TVzJUuisHQCIDa\n\t4IYxfwYiiO5YG/YE5MWTIVTgBmMzfLd1NdL+ESkiJ/guPC7jiaYyXSCLDhXtP7v5\n\t8z7WZVi23i9pCeVv0aPKYISUL9IVzZR2pRuKhAXOflRVx1KkHYBwbQsKNumnTiCO\n\tnFVCXrpYqVm7+prI502p7fgXlM/GOlo44l+e+7uumcyK9HZGQmN5fTnyYh8JPNuB\n\tYpqPHQqkhpeQMRUbDgIMiPo3i7emBkrxxTw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=oss.qualcomm.com; s=google; t=1766251625; x=1766856425;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=vDOcA/K0sWgLAjNFkPnv56dWZf7YgCNx8cOGDj2FkG0=;\n\tb=K3gwAQI8NSKg4UE1hFVYHa+OXc7i1CAlFkZVWN4tkfTbTija61QO+JDt542ady/TSA\n\tRz7NO4Xq6oIZjja0CCbRK+NMS4FPjZ7XRbkr3qPIoWIM4sMzMDxtYeDBjuR/A8AVatBA\n\t4tSF39RwJbmGo5s/uCyVqXbq7mPhahL9D4oyzhUtWj+qZ6Rv3F1CnVdHLV8ivcM4oqEr\n\tdncS9TDC7hFXyvh/1MKWdcNyocRw4rhmTNdDw3XdN6Jsx0Hy5BfeKug6NSS5OdRLinSz\n\tmCDkRrr7KlFBalWk6tNgYGaZuI6seUkEmMrOe3UmuvTjvM+xBI6rHXcDA4X63igTXLwL\n\tlyUQ=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1766251625; x=1766856425;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=vDOcA/K0sWgLAjNFkPnv56dWZf7YgCNx8cOGDj2FkG0=;\n\tb=AFkC7sl2GIzhpp9N1t1EdtgiTK3owmnijECn0ordnu5YL4eP0Jur1gVHKq1CG3AvGf\n\tIl3htdlMM+iFdT70GrCe8XOmBJEOqs7RJ+BD9FndZCLLmbWXadWFP9X8mYGi5Z1oyk4v\n\t8o5wkoT3AmTtu6bQSOg9bZ97zb5FtoICRIKJF/EzOnR0nIeHS7nSV46uSuvGGIRujV2R\n\tziatzyD6cPI/zHtTpFTokZ4w19UJaDRaGYqkgqNwmnInhBCQc5WAeNzLAbYEnf1zyM82\n\tfMELW7AJ+fHGFUAT2Eyf38wUkoUpfWKS58jXOGMANDzhoGnoTbEdml3AtwQw02QTMOn9\n\tn83g==",
        "X-Gm-Message-State": "AOJu0Yz5458SLPQ7IuvBeLnhzbc6JIqg6QCvHRJO34IJE/V6i7ybSTHq\n\tSh0HfFJuXWriiIsYjvT0qDEoKxptHwrjZbTOoWT7LkSUIhL/fSEiyKlNuojONXsns1JZlEWHPYf\n\tKX+InrWJ0BUl3BtsoDXX3LYcOS7BtklfdkVZ1diNjLTkI+zYlvEnMapkOS05z2eVsoOy2Osgt3u\n\t9WSl8txFPQ",
        "X-Gm-Gg": "AY/fxX7ptpknEK9xVJqrWN9P0xbKp9pxsZs/4ISzbFDNjAbJDTaift4p/96rnYsVW6o\n\tSD/Smg45cuP/rJuCQdDbcgebPUYWUc4+jrJSYuVzu/2kXZj7iQ8ZoQJSF4aPgrBqG4W60F1CErG\n\tf2QAwLelSbOYUx3nH4+h0spRsNpXMhyquAvtj94xkLsEfO1bf2ZtMKtYLlPwDZ7Hfk8jgeyXeMX\n\tdYlGpqd2ksIRpjiqf1Y3sN08xGRi3m0CXd72XVOIZCr0q6B0QIV5RxkizAM7bG6+694p97rs2fZ\n\tZ9svY3CVpRhH0hyLK8DezYUrgF8ykAVFc6lD1shZzDbgJg96TodepxItp7cCTJGptThCrDFxy1N\n\tGNbQSZaZalaV9GNUtX9lDOPv89CcmTApjFCKO7mFDnR59GLrleHAYUzggHX2LTv21pLs6EcpV00\n\t33jGCj/XZojY72wArbMv/GVUUE",
        "X-Received": [
            "by 2002:a05:622a:4a84:b0:4ee:2459:3d6c with SMTP id\n\td75a77b69052e-4f4abdb5dadmr89222471cf.58.1766251625351; \n\tSat, 20 Dec 2025 09:27:05 -0800 (PST)",
            "by 2002:a05:622a:4a84:b0:4ee:2459:3d6c with SMTP id\n\td75a77b69052e-4f4abdb5dadmr89222241cf.58.1766251624884; \n\tSat, 20 Dec 2025 09:27:04 -0800 (PST)"
        ],
        "X-Google-Smtp-Source": "AGHT+IGDq995twtec++D7pubtWy6qs5d/Jo3JOir1IKQzvA+ha/mnYI1hLZQEoWJaZZ6faT/ndHQAA==",
        "From": "Hans de Goede <johannes.goede@oss.qualcomm.com>",
        "To": "libcamera-devel@lists.libcamera.org, Milan Zamazal <mzamazal@redhat.com>",
        "Cc": "Hans de Goede <johannes.goede@oss.qualcomm.com>",
        "Subject": "[PATCH] ipa: simple: agc: Make sure activeState.agc expo/again are\n\talways initialized",
        "Date": "Sat, 20 Dec 2025 18:27:03 +0100",
        "Message-ID": "<20251220172703.321681-1-johannes.goede@oss.qualcomm.com>",
        "X-Mailer": "git-send-email 2.52.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjUxMjIwMDE1MyBTYWx0ZWRfXyLaDhD17gLCH\n\tEJXPIGyRmratlBrTSnSH1dsVRdZwocTx75itj823fnyk6pqmTHh+5M8rXsgk3wY16pHCK5LYt14\n\tOl9hsvoGGYInh9ujet01poVo5l0hH4G9i616Y3+VrDJki2cXqObnW3vMRq4hH225j2qMJ6H3VYy\n\tc1k2PR5Jabkv6YsR9OKx/eQtLtnw0RhH6JIqlbd/m9wu3icAq8id/5lMRaV3hNaDeq72SE8C3wE\n\t6iSc+43eYWGDH0fj5A3GhsPeS2WKv77fr6Nqgf1XTY1qAvAfpi+kxP0pmKGHSS3bmWzduJBnJY3\n\tLwtOsDvBq5UBHXezAO/nhbumzt2Ezygy1DGFP2VK9IlSb3QD3ewI2hOY/TiGns0Pqm/KG+bCmWy\n\tBwuGrUvA4tnWPdsmt0YoaZlW2/PI+P5aR9Ma/pd8ORRg33ye9aUI8aLPugE1lMqJXWs0yznQ1O7\n\t+mSga35Z5f5nBa5SwFA==",
        "X-Authority-Analysis": "v=2.4 cv=VMnQXtPX c=1 sm=1 tr=0 ts=6946dc6a cx=c_pps\n\ta=JbAStetqSzwMeJznSMzCyw==:117 a=xqWC_Br6kY4A:10 a=wP3pNCr1ah4A:10\n\ta=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8\n\ta=16YhMSmgSZaTCJXQ5R4A:9 a=uxP6HrT_eTzRwkO_Te1X:22",
        "X-Proofpoint-ORIG-GUID": "2joDU7hZ61b8i0x9CBB4VtszS-jFd1EB",
        "X-Proofpoint-GUID": "2joDU7hZ61b8i0x9CBB4VtszS-jFd1EB",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n\tengine=ICAP:2.0.293, Aquarius:18.0.1121, Hydra:6.1.9,\n\tFMLib:17.12.100.49\n\tdefinitions=2025-12-20_04,2025-12-19_02,2025-10-01_01",
        "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n\tclxscore=1015 malwarescore=0 phishscore=0 suspectscore=0\n\tlowpriorityscore=0\n\tspamscore=0 adultscore=0 priorityscore=1501 impostorscore=0\n\tbulkscore=0\n\tclassifier=typeunknown authscore=0 authtc= authcc= route=outbound\n\tadjust=0\n\treason=mlx scancount=1 engine=8.22.0-2512120000\n\tdefinitions=main-2512200153",
        "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": "If the first frame of a stream is bad, the IPA will not get called with\nframe == 0, leaving activeState.agc expo/again uninitialized. This causes\nthe agc algorithm to set a very low gain and exposure on the next run\n(where it will hit the if (!stats->valid) {} path) resulting in starting\nwith a black image.\n\nFix this by using a valid flag instead of checking for frame == 0.\n\nThe entire activeState gets cleared to 0 on configure() resetting the new\nvalid flag.\n\nSigned-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>\n---\n src/ipa/simple/algorithms/agc.cpp | 5 +++--\n src/ipa/simple/ipa_context.h      | 1 +\n 2 files changed, 4 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp\nindex 189de770..2f7e040c 100644\n--- a/src/ipa/simple/algorithms/agc.cpp\n+++ b/src/ipa/simple/algorithms/agc.cpp\n@@ -100,7 +100,7 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou\n }\n \n void Agc::process(IPAContext &context,\n-\t\t  const uint32_t frame,\n+\t\t  [[maybe_unused]] const uint32_t frame,\n \t\t  IPAFrameContext &frameContext,\n \t\t  const SwIspStats *stats,\n \t\t  ControlList &metadata)\n@@ -110,13 +110,14 @@ void Agc::process(IPAContext &context,\n \tmetadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n \tmetadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n \n-\tif (frame == 0) {\n+\tif (!context.activeState.agc.valid) {\n \t\t/*\n \t\t * Init active-state from sensor values in case updateExposure()\n \t\t * does not run for the first frame.\n \t\t */\n \t\tcontext.activeState.agc.exposure = frameContext.sensor.exposure;\n \t\tcontext.activeState.agc.again = frameContext.sensor.gain;\n+\t\tcontext.activeState.agc.valid = true;\n \t}\n \n \tif (!stats->valid) {\ndiff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\nindex c3081e30..26b60fb6 100644\n--- a/src/ipa/simple/ipa_context.h\n+++ b/src/ipa/simple/ipa_context.h\n@@ -40,6 +40,7 @@ struct IPAActiveState {\n \tstruct {\n \t\tint32_t exposure;\n \t\tdouble again;\n+\t\tbool valid;\n \t} agc;\n \n \tstruct {\n",
    "prefixes": []
}