Show a patch.

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

{
    "id": 19167,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19167/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19167/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20231020084002.30665-7-naush@raspberrypi.com>",
    "date": "2023-10-20T08:40:02",
    "name": "[libcamera-devel,v1,6/6] ipa: rpi: agc: Make AGC controls affect all channels",
    "commit_ref": "02eea043f2a4d976c2c40e5bc382096c3a536632",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "72310917201d7fe61d1efd4162793e0b8f8f1c32",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19167/mbox/",
    "series": [
        {
            "id": 4054,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4054/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4054",
            "date": "2023-10-20T08:39:56",
            "name": "Raspberry Pi: Preliminary PiSP support (round 2)",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4054/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19167/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19167/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 03C89C32B8\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Oct 2023 08:40:37 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A554562988;\n\tFri, 20 Oct 2023 10:40:36 +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 C73396298A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 10:40:31 +0200 (CEST)",
            "by mail-wr1-x435.google.com with SMTP id\n\tffacd0b85a97d-31c5cac3ae2so430733f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 01:40:31 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tr3-20020adff103000000b0032d9337e7d1sm1213356wro.11.2023.10.20.01.40.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 20 Oct 2023 01:40:30 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1697791236;\n\tbh=Yp1iH+nU2dfob3NUfknPBnEJJ6Ut319oQzWEz8fTTzs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=eq1eKlU1RdczhQTyS4WKztfMnnMei3ZIi1aaIcoDW7yWou7wJfnniK7FJhal+LI/l\n\tEN6lothnw1amLJA71ORr1AcEztIWzQPBsMsmv5OTCeQOaSw1gJ0CobaTCcCRqpVcbR\n\ttpKw7KLVdJUMkjG9G+DWyxhM6AMrXWDnkoxJC5Vwx/YIXm1mtZRxH8RxTfkxoU+WMM\n\tNY4beNPMChDeiHlZUMk3gWnwxp6mvGfoFMEOOIa8/zhmG+5vL5uIJkE0tCC2Svdwv1\n\tPvURRlIthcmDWRcyVb/c7h91WBQXY4xhROG/ueyXlHZFKBbkdcIXRek1uJNSJON9vB\n\tYI9ivvD+fnk4g==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1697791231; x=1698396031;\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=ONlW2T4HkI3qwVgetsJja6/efFs+Qrn3bOK1EZjcag4=;\n\tb=PYHCfc+Tsirfckb9ThgE/xo4RfnCldwP8ZClnMJ3E1kipBCBUt+lh4sp3RqFXOcJKY\n\tZqwhtgtvsbJnNMZgjKK9LMpIApKZqgcUQMgGuoavCV4C8zgGCu25wqI3X1W+TVTkNjTm\n\tDywdLSS6rvceH8OXIX58Xqy7TwjYBnU7e/YZLOVwsqDuV65CWGfyx6cctWGKX2Ip1Pp6\n\tFTXSQHGD89pqLllqQRvPsy8oxpwRwsPARMwDlSdITsaTs5/jTmmHGdW0yzux4aSBaXq2\n\tcBQGp6SzT17N/oP/iMmAggALEddW/KI5vByCWWmABBbXel2TSZTKAm9yWfOVOS6O4OjO\n\tYueQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"PYHCfc+T\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1697791231; x=1698396031;\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=ONlW2T4HkI3qwVgetsJja6/efFs+Qrn3bOK1EZjcag4=;\n\tb=kD+0cG41efWxdc3zLzPpGbkZDRx7KNl+C4MkVZeu2G9+K15S3PKEJwvoXLni+9d7Cg\n\tWxHDAwM6FnD7k6Ds95gFlJ3VKCy70wxW9c/FSlEUpP2+uBW376y+RHtlvlpYc7bOdF1g\n\t26wuAgVMs2om7MFKr8wDEOFcGSTaLjIb/QLNEivMHMftVQDzuunAENVnhw9zDMxdJFTq\n\tBhifG9cspy9DwHcuSzuf9duVUTY5GeaeozOtna4XbeAFGZUJqbtZiWqpMJx1KW2QCRQY\n\tm7CFUNesl7oZuKWWHeg31hAJkYclQGTtbpfW40kL+sY/CXqleOf1rpKkIua5un+MBol2\n\tklSA==",
        "X-Gm-Message-State": "AOJu0YxH1MR2w3bX9GKlSZasjmj4YefuzAKQ06Rjy+PTqDxpJvtD5+hh\n\ttoHjEQj+pEOXs8MYEvokgMCxd2PyZC11HwWzraUUsA==",
        "X-Google-Smtp-Source": "AGHT+IEk71pn0N6xWdEq3YobfW2udBMIHXGfWBnxp6rWXskrwR6YlkPsw8O+FqWZU4yeyQ6BvLsINg==",
        "X-Received": "by 2002:a05:6000:ac9:b0:31a:e8e6:8a96 with SMTP id\n\tdi9-20020a0560000ac900b0031ae8e68a96mr797758wrb.67.1697791231193; \n\tFri, 20 Oct 2023 01:40:31 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 20 Oct 2023 09:40:02 +0100",
        "Message-Id": "<20231020084002.30665-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "References": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 6/6] ipa: rpi: agc: Make AGC controls\n\taffect all channels",
        "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>",
        "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: David Plowman <david.plowman@raspberrypi.com>\n\nWe need to be able to do things like enable/disable AGC for all the\nchannels, so most of the AGC controls are updated to be applied to all\nchannels. There are a couple of exceptions, such as setting explicit\nshutter/gain values, which apply only to channel 0.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp        | 14 +++----\n src/ipa/rpi/controller/agc_algorithm.h | 11 +++---\n src/ipa/rpi/controller/rpi/agc.cpp     | 51 +++++++++++++-------------\n src/ipa/rpi/controller/rpi/agc.h       | 13 +++----\n 4 files changed, 42 insertions(+), 47 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 2583c6226f44..a1fec3aa3dd1 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -702,9 +702,9 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t\t}\n \n \t\t\tif (ctrl.second.get<bool>() == false)\n-\t\t\t\tagc->disableAuto(0);\n+\t\t\t\tagc->disableAuto();\n \t\t\telse\n-\t\t\t\tagc->enableAuto(0);\n+\t\t\t\tagc->enableAuto();\n \n \t\t\tlibcameraMetadata_.set(controls::AeEnable, ctrl.second.get<bool>());\n \t\t\tbreak;\n@@ -773,7 +773,7 @@ void IpaBase::applyControls(const ControlList &controls)\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (ConstraintModeTable.count(idx)) {\n-\t\t\t\tagc->setConstraintMode(0, ConstraintModeTable.at(idx));\n+\t\t\t\tagc->setConstraintMode(ConstraintModeTable.at(idx));\n \t\t\t\tlibcameraMetadata_.set(controls::AeConstraintMode, idx);\n \t\t\t} else {\n \t\t\t\tLOG(IPARPI, Error) << \"Constraint mode \" << idx\n@@ -793,7 +793,7 @@ void IpaBase::applyControls(const ControlList &controls)\n \n \t\t\tint32_t idx = ctrl.second.get<int32_t>();\n \t\t\tif (ExposureModeTable.count(idx)) {\n-\t\t\t\tagc->setExposureMode(0, ExposureModeTable.at(idx));\n+\t\t\t\tagc->setExposureMode(ExposureModeTable.at(idx));\n \t\t\t\tlibcameraMetadata_.set(controls::AeExposureMode, idx);\n \t\t\t} else {\n \t\t\t\tLOG(IPARPI, Error) << \"Exposure mode \" << idx\n@@ -836,12 +836,12 @@ void IpaBase::applyControls(const ControlList &controls)\n \n \t\t\tswitch (mode) {\n \t\t\tcase controls::FlickerOff:\n-\t\t\t\tagc->setFlickerPeriod(0, 0us);\n+\t\t\t\tagc->setFlickerPeriod(0us);\n \n \t\t\t\tbreak;\n \n \t\t\tcase controls::FlickerManual:\n-\t\t\t\tagc->setFlickerPeriod(0, flickerState_.manualPeriod);\n+\t\t\t\tagc->setFlickerPeriod(flickerState_.manualPeriod);\n \n \t\t\t\tbreak;\n \n@@ -875,7 +875,7 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t\t * first, and the period updated after, or vice versa.\n \t\t\t */\n \t\t\tif (flickerState_.mode == controls::FlickerManual)\n-\t\t\t\tagc->setFlickerPeriod(0, flickerState_.manualPeriod);\n+\t\t\t\tagc->setFlickerPeriod(flickerState_.manualPeriod);\n \n \t\t\tbreak;\n \t\t}\ndiff --git a/src/ipa/rpi/controller/agc_algorithm.h b/src/ipa/rpi/controller/agc_algorithm.h\nindex b8986560ac88..534e38e2b5b7 100644\n--- a/src/ipa/rpi/controller/agc_algorithm.h\n+++ b/src/ipa/rpi/controller/agc_algorithm.h\n@@ -22,17 +22,16 @@ public:\n \tvirtual unsigned int getConvergenceFrames() const = 0;\n \tvirtual std::vector<double> const &getWeights() const = 0;\n \tvirtual void setEv(unsigned int channel, double ev) = 0;\n-\tvirtual void setFlickerPeriod(unsigned int channel,\n-\t\t\t\t      libcamera::utils::Duration flickerPeriod) = 0;\n+\tvirtual void setFlickerPeriod(libcamera::utils::Duration flickerPeriod) = 0;\n \tvirtual void setFixedShutter(unsigned int channel,\n \t\t\t\t     libcamera::utils::Duration fixedShutter) = 0;\n \tvirtual void setMaxShutter(libcamera::utils::Duration maxShutter) = 0;\n \tvirtual void setFixedAnalogueGain(unsigned int channel, double fixedAnalogueGain) = 0;\n \tvirtual void setMeteringMode(std::string const &meteringModeName) = 0;\n-\tvirtual void setExposureMode(unsigned int channel, std::string const &exposureModeName) = 0;\n-\tvirtual void setConstraintMode(unsigned int channel, std::string const &contraintModeName) = 0;\n-\tvirtual void enableAuto(unsigned int channel) = 0;\n-\tvirtual void disableAuto(unsigned int channel) = 0;\n+\tvirtual void setExposureMode(std::string const &exposureModeName) = 0;\n+\tvirtual void setConstraintMode(std::string const &contraintModeName) = 0;\n+\tvirtual void enableAuto() = 0;\n+\tvirtual void disableAuto() = 0;\n \tvirtual void setActiveChannels(const std::vector<unsigned int> &activeChannels) = 0;\n };\n \ndiff --git a/src/ipa/rpi/controller/rpi/agc.cpp b/src/ipa/rpi/controller/rpi/agc.cpp\nindex 32eb36242268..6549dedd0a07 100644\n--- a/src/ipa/rpi/controller/rpi/agc.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc.cpp\n@@ -74,22 +74,22 @@ int Agc::checkChannel(unsigned int channelIndex) const\n \treturn 0;\n }\n \n-void Agc::disableAuto(unsigned int channelIndex)\n+void Agc::disableAuto()\n {\n-\tif (checkChannel(channelIndex))\n-\t\treturn;\n+\tLOG(RPiAgc, Debug) << \"disableAuto\";\n \n-\tLOG(RPiAgc, Debug) << \"disableAuto for channel \" << channelIndex;\n-\tchannelData_[channelIndex].channel.disableAuto();\n+\t/* All channels are enabled/disabled together. */\n+\tfor (auto &data : channelData_)\n+\t\tdata.channel.disableAuto();\n }\n \n-void Agc::enableAuto(unsigned int channelIndex)\n+void Agc::enableAuto()\n {\n-\tif (checkChannel(channelIndex))\n-\t\treturn;\n+\tLOG(RPiAgc, Debug) << \"enableAuto\";\n \n-\tLOG(RPiAgc, Debug) << \"enableAuto for channel \" << channelIndex;\n-\tchannelData_[channelIndex].channel.enableAuto();\n+\t/* All channels are enabled/disabled together. */\n+\tfor (auto &data : channelData_)\n+\t\tdata.channel.enableAuto();\n }\n \n unsigned int Agc::getConvergenceFrames() const\n@@ -118,14 +118,13 @@ void Agc::setEv(unsigned int channelIndex, double ev)\n \tchannelData_[channelIndex].channel.setEv(ev);\n }\n \n-void Agc::setFlickerPeriod(unsigned int channelIndex, Duration flickerPeriod)\n+void Agc::setFlickerPeriod(Duration flickerPeriod)\n {\n-\tif (checkChannel(channelIndex))\n-\t\treturn;\n+\tLOG(RPiAgc, Debug) << \"setFlickerPeriod \" << flickerPeriod;\n \n-\tLOG(RPiAgc, Debug) << \"setFlickerPeriod \" << flickerPeriod\n-\t\t\t   << \" for channel \" << channelIndex;\n-\tchannelData_[channelIndex].channel.setFlickerPeriod(flickerPeriod);\n+\t/* Flicker period will be the same across all channels. */\n+\tfor (auto &data : channelData_)\n+\t\tdata.channel.setFlickerPeriod(flickerPeriod);\n }\n \n void Agc::setMaxShutter(Duration maxShutter)\n@@ -162,22 +161,22 @@ void Agc::setMeteringMode(std::string const &meteringModeName)\n \t\tdata.channel.setMeteringMode(meteringModeName);\n }\n \n-void Agc::setExposureMode(unsigned int channelIndex, std::string const &exposureModeName)\n+void Agc::setExposureMode(std::string const &exposureModeName)\n {\n-\tif (checkChannel(channelIndex))\n-\t\treturn;\n+\tLOG(RPiAgc, Debug) << \"setExposureMode \" << exposureModeName;\n \n-\tLOG(RPiAgc, Debug) << \"setExposureMode \" << exposureModeName\n-\t\t\t   << \" for channel \" << channelIndex;\n-\tchannelData_[channelIndex].channel.setExposureMode(exposureModeName);\n+\t/* Exposure mode will be the same across all channels. */\n+\tfor (auto &data : channelData_)\n+\t\tdata.channel.setExposureMode(exposureModeName);\n }\n \n-void Agc::setConstraintMode(unsigned int channelIndex, std::string const &constraintModeName)\n+void Agc::setConstraintMode(std::string const &constraintModeName)\n {\n-\tif (checkChannel(channelIndex))\n-\t\treturn;\n+\tLOG(RPiAgc, Debug) << \"setConstraintMode \" << constraintModeName;\n \n-\tchannelData_[channelIndex].channel.setConstraintMode(constraintModeName);\n+\t/* Constraint mode will be the same across all channels. */\n+\tfor (auto &data : channelData_)\n+\t\tdata.channel.setConstraintMode(constraintModeName);\n }\n \n template<typename T>\ndiff --git a/src/ipa/rpi/controller/rpi/agc.h b/src/ipa/rpi/controller/rpi/agc.h\nindex 908904393fbf..7d26bdf6df45 100644\n--- a/src/ipa/rpi/controller/rpi/agc.h\n+++ b/src/ipa/rpi/controller/rpi/agc.h\n@@ -31,20 +31,17 @@ public:\n \tunsigned int getConvergenceFrames() const override;\n \tstd::vector<double> const &getWeights() const override;\n \tvoid setEv(unsigned int channel, double ev) override;\n-\tvoid setFlickerPeriod(unsigned int channelIndex,\n-\t\t\t      libcamera::utils::Duration flickerPeriod) override;\n+\tvoid setFlickerPeriod(libcamera::utils::Duration flickerPeriod) override;\n \tvoid setMaxShutter(libcamera::utils::Duration maxShutter) override;\n \tvoid setFixedShutter(unsigned int channelIndex,\n \t\t\t     libcamera::utils::Duration fixedShutter) override;\n \tvoid setFixedAnalogueGain(unsigned int channelIndex,\n \t\t\t\t  double fixedAnalogueGain) override;\n \tvoid setMeteringMode(std::string const &meteringModeName) override;\n-\tvoid setExposureMode(unsigned int channelIndex,\n-\t\t\t     std::string const &exposureModeName) override;\n-\tvoid setConstraintMode(unsigned int channelIndex,\n-\t\t\t       std::string const &contraintModeName) override;\n-\tvoid enableAuto(unsigned int channelIndex) override;\n-\tvoid disableAuto(unsigned int channelIndex) override;\n+\tvoid setExposureMode(std::string const &exposureModeName) override;\n+\tvoid setConstraintMode(std::string const &contraintModeName) override;\n+\tvoid enableAuto() override;\n+\tvoid disableAuto() override;\n \tvoid switchMode(CameraMode const &cameraMode, Metadata *metadata) override;\n \tvoid prepare(Metadata *imageMetadata) override;\n \tvoid process(StatisticsPtr &stats, Metadata *imageMetadata) override;\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "6/6"
    ]
}