Show a patch.

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

{
    "id": 14018,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/14018/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/14018/",
    "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": "<20211001103325.1077590-4-paul.elder@ideasonboard.com>",
    "date": "2021-10-01T10:33:21",
    "name": "[libcamera-devel,v2,3/7] libcamera: pipeline: raspberrypi: Support the new AE controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "188337c56e629d982d2cca5cdd0f0af3bba360ea",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/users/17/?format=api",
        "username": "epaul",
        "first_name": "Paul",
        "last_name": "Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/14018/mbox/",
    "series": [
        {
            "id": 2589,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2589/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2589",
            "date": "2021-10-01T10:33:18",
            "name": "The Great AE Changes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/2589/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/14018/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/14018/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 D9A14BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  1 Oct 2021 10:33:44 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A513B691B8;\n\tFri,  1 Oct 2021 12:33:44 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B337C691AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  1 Oct 2021 12:33:42 +0200 (CEST)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C37F596;\n\tFri,  1 Oct 2021 12:33:41 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rcT5H5DO\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1633084422;\n\tbh=FZZ3rKzhl/HjczljP766ilE3qTZbgXGbn4dkW1CfJuw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rcT5H5DOhhTePLH16K5BQtlpfEiiDU1KcVPrUAyXZKlMlcWoCxinHIudxyWW6V1gd\n\tL9LMaWR7ReM7TMxTYtVQP6K0khPBWqAX33+Zj8MoMb2srsbKRSRNYbrBgDkMQsJJ27\n\thwPHTli46+S4EQml69FUozsHpHSnV1WY74SRaUmU=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  1 Oct 2021 19:33:21 +0900",
        "Message-Id": "<20211001103325.1077590-4-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20211001103325.1077590-1-paul.elder@ideasonboard.com>",
        "References": "<20211001103325.1077590-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 3/7] libcamera: pipeline: raspberrypi:\n\tSupport the new AE controls",
        "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": "Add support for the new AE controls in the raspberrypi pipeline handler,\nand in the IPA.\n\nBug: https://bugs.libcamera.org/show_bug.cgi?id=42\nBug: https://bugs.libcamera.org/show_bug.cgi?id=43\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v2:\n- fix the rebase error where some uvc stuff was in rasberrypi\n- i haven't yet taken in the comments to move the new Pause/Resume\n  functions\n\nInitial versoin:\nThis is very hacky. I wasn't sure what the best way was to plumb it into\nthe raspberrypi IPA as it was a bit hairy...\n---\n include/libcamera/ipa/raspberrypi.h        |  3 +-\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 18 +++++++++-\n src/ipa/raspberrypi/controller/rpi/agc.hpp |  5 +++\n src/ipa/raspberrypi/raspberrypi.cpp        | 42 +++++++++++++++++-----\n 4 files changed, 58 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 521eaecd..363ea038 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -28,8 +28,9 @@ namespace RPi {\n  * unsupported control is encountered.\n  */\n static const ControlInfoMap Controls({\n-\t\t{ &controls::AeEnable, ControlInfo(false, true) },\n+\t\t{ &controls::ExposureTimeMode, ControlInfo(controls::ExposureTimeModeValues) },\n \t\t{ &controls::ExposureTime, ControlInfo(0, 999999) },\n+\t\t{ &controls::AnalogueGainMode, ControlInfo(controls::AnalogueGainModeValues) },\n \t\t{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },\n \t\t{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },\n \t\t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex 289c1fce..b45ea454 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -203,14 +203,30 @@ bool Agc::IsPaused() const\n }\n \n void Agc::Pause()\n+{\n+}\n+\n+void Agc::Resume()\n+{\n+}\n+\n+void Agc::PauseExposure()\n {\n \tfixed_shutter_ = status_.shutter_time;\n+}\n+\n+void Agc::PauseGain()\n+{\n \tfixed_analogue_gain_ = status_.analogue_gain;\n }\n \n-void Agc::Resume()\n+void Agc::ResumeExposure()\n {\n \tfixed_shutter_ = 0s;\n+}\n+\n+void Agc::ResumeGain()\n+{\n \tfixed_analogue_gain_ = 0;\n }\n \ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp\nindex 82063636..7ca3ca2f 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n@@ -92,6 +92,11 @@ public:\n \tvoid Prepare(Metadata *image_metadata) override;\n \tvoid Process(StatisticsPtr &stats, Metadata *image_metadata) override;\n \n+\tvoid PauseExposure();\n+\tvoid PauseGain();\n+\tvoid ResumeExposure();\n+\tvoid ResumeGain();\n+\n private:\n \tvoid updateLockStatus(DeviceStatus const &device_status);\n \tAgcConfig config_;\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 047123ab..99935515 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -53,6 +53,8 @@\n #include \"sharpen_algorithm.hpp\"\n #include \"sharpen_status.h\"\n \n+#include \"controller/rpi/agc.hpp\"\n+\n namespace libcamera {\n \n using namespace std::literals::chrono_literals;\n@@ -478,7 +480,10 @@ void IPARPi::reportMetadata()\n \n \tAgcStatus *agcStatus = rpiMetadata_.GetLocked<AgcStatus>(\"agc.status\");\n \tif (agcStatus) {\n-\t\tlibcameraMetadata_.set(controls::AeLocked, agcStatus->locked);\n+\t\tlibcameraMetadata_.set(controls::AeState,\n+\t\t\t\t       agcStatus->locked ?\n+\t\t\t\t       controls::AeStateConverged :\n+\t\t\t\t       controls::AeStateSearching);\n \t\tlibcameraMetadata_.set(controls::DigitalGain, agcStatus->digital_gain);\n \t}\n \n@@ -623,20 +628,22 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\t\t  << \" = \" << ctrl.second.toString();\n \n \t\tswitch (ctrl.first) {\n-\t\tcase controls::AE_ENABLE: {\n-\t\t\tRPiController::Algorithm *agc = controller_.GetAlgorithm(\"agc\");\n+\t\tcase controls::EXPOSURE_TIME_MODE: {\n+\t\t\tRPiController::Algorithm *algo = controller_.GetAlgorithm(\"agc\");\n+\t\t\tRPiController::Agc *agc = reinterpret_cast<RPiController::Agc *>(algo);\n \t\t\tif (!agc) {\n \t\t\t\tLOG(IPARPI, Warning)\n-\t\t\t\t\t<< \"Could not set AE_ENABLE - no AGC algorithm\";\n+\t\t\t\t\t<< \"Could not set EXPOSURE_TIME_MODE - no AGC algorithm\";\n \t\t\t\tbreak;\n \t\t\t}\n \n-\t\t\tif (ctrl.second.get<bool>() == false)\n-\t\t\t\tagc->Pause();\n+\t\t\tif (ctrl.second.get<int32_t>() == controls::ExposureTimeModeDisabled)\n+\t\t\t\tagc->PauseExposure();\n \t\t\telse\n-\t\t\t\tagc->Resume();\n+\t\t\t\tagc->ResumeExposure();\n \n-\t\t\tlibcameraMetadata_.set(controls::AeEnable, ctrl.second.get<bool>());\n+\t\t\tlibcameraMetadata_.set(controls::ExposureTimeMode,\n+\t\t\t\t\t       ctrl.second.get<int32_t>());\n \t\t\tbreak;\n \t\t}\n \n@@ -656,6 +663,25 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n+\t\tcase controls::ANALOGUE_GAIN_MODE: {\n+\t\t\tRPiController::Algorithm *algo = controller_.GetAlgorithm(\"agc\");\n+\t\t\tRPiController::Agc *agc = reinterpret_cast<RPiController::Agc *>(algo);\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set ANALOGUE_GAIN_MODE - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (ctrl.second.get<int32_t>() == controls::AnalogueGainModeDisabled)\n+\t\t\t\tagc->PauseGain();\n+\t\t\telse\n+\t\t\t\tagc->ResumeGain();\n+\n+\t\t\tlibcameraMetadata_.set(controls::AnalogueGainMode,\n+\t\t\t\t\t       ctrl.second.get<int32_t>());\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tcase controls::ANALOGUE_GAIN: {\n \t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\t\t\tcontroller_.GetAlgorithm(\"agc\"));\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "3/7"
    ]
}