Show a patch.

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

{
    "id": 16216,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16216/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16216/",
    "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": "<20220613142853.98484-9-jeanmichel.hautbois@ideasonboard.com>",
    "date": "2022-06-13T14:28:51",
    "name": "[libcamera-devel,08/10] ipa: raspberrypi: Introduce AfTrigger control",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "d88280910afdad72dce4ca79a932f88bc1e87fe5",
    "submitter": {
        "id": 75,
        "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api",
        "name": "Jean-Michel Hautbois",
        "email": "jeanmichel.hautbois@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16216/mbox/",
    "series": [
        {
            "id": 3174,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3174/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3174",
            "date": "2022-06-13T14:28:43",
            "name": "ipa: raspberrypi: Introduce an autofocus algorithm",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3174/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16216/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16216/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 31D5BC3279\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jun 2022 14:29:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D70D86564F;\n\tMon, 13 Jun 2022 16:29:09 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B2A9365636\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jun 2022 16:29:01 +0200 (CEST)",
            "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:a1c7:c28c:7720:9b30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 60FCC87B;\n\tMon, 13 Jun 2022 16:29:01 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1655130549;\n\tbh=3d3YCVuSR1T5JIzEhU3hNZBepDk383+F08oRIFv/9+g=;\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=2FNkTBfI4EEgf5Mp2zfMMbh4Qa7Y4PFe9MLAa8jol7RK1XWPrdlPnL1FgdY2S5Swe\n\tDcyt78n+Xzm5EBp237gSISN7X63NnyxTWLjrryd0W6176CM0LS/6Xm/3c+o+ovwaUJ\n\tlLRyX12FOM8Vz2mbRxtq+YW4gnebs/UExD6zTgWtbY04LP/hEuvd6hyw/i9V34EqKq\n\tVLBCK55Zqyt5vtmgQBfkk73KSgKxcR0BR/SWH8LiTVkbgvT7lBQGFP/764FPrkr5bw\n\t13Qxyowg2qCSWTKlqJVlCbH2Fxt/w5j0uqMkVPTrd2WnyJ16lfmLh88ZQXZn9tFbw7\n\thjIFVVey8FnbA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1655130541;\n\tbh=3d3YCVuSR1T5JIzEhU3hNZBepDk383+F08oRIFv/9+g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=t4m203rmCcGT7h8puhZ6aoRQmAFbEt/GOqwi7Y9bGseanGFqjAvojgjlpYTwUGRRy\n\tabOI4ADKn9WQENst+L4CriDrdva3/rYVFlWz8at2d/gExaRxMdvsDKHjVcl8qPt6Af\n\tX1os7yrCl5bI/RgeeK5tuJUrM9bvIDXp50Q5LBn8="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"t4m203rm\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 13 Jun 2022 16:28:51 +0200",
        "Message-Id": "<20220613142853.98484-9-jeanmichel.hautbois@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>",
        "References": "<20220613142853.98484-1-jeanmichel.hautbois@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 08/10] ipa: raspberrypi: Introduce\n\tAfTrigger control",
        "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": "Jean-Michel Hautbois via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "When the algorithm is in auto mode, it will start a new scan, and either\nend in the AfStateFocused ot AfStateFailed state. The user may decide to\ntrigger a new scan, passing the AfTrigger control down to the pipeline\nhandler.\n\nImplement a simple trigger operation in the IPA and call it from the\npipeline handler when the control is passed.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.h             |  1 +\n src/ipa/raspberrypi/controller/af_algorithm.hpp |  2 +-\n src/ipa/raspberrypi/controller/iob/af.cpp       | 12 ++++++++++--\n src/ipa/raspberrypi/controller/iob/af.h         |  2 +-\n src/ipa/raspberrypi/raspberrypi.cpp             | 14 ++++++++++++++\n 5 files changed, 27 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex a7a15904..17c7de72 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -50,6 +50,7 @@ static const ControlInfoMap Controls({\n \t\t{ &controls::AfState, ControlInfo(controls::AfStateValues) },\n \t\t{ &controls::AfPause, ControlInfo(controls::AfPauseValues) },\n \t\t{ &controls::AfPauseState, ControlInfo(controls::AfPauseStateValues) },\n+\t\t{ &controls::AfTrigger, ControlInfo(controls::AfTriggerValues) },\n \t}, controls::controls);\n \n } /* namespace RPi */\ndiff --git a/src/ipa/raspberrypi/controller/af_algorithm.hpp b/src/ipa/raspberrypi/controller/af_algorithm.hpp\nindex ac34e3b6..925b2d03 100644\n--- a/src/ipa/raspberrypi/controller/af_algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/af_algorithm.hpp\n@@ -19,7 +19,7 @@ public:\n \t// An af algorithm must provide the following:\n \tvirtual void SetMode(const uint32_t &mode) = 0;\n \t// start a cycle (in auto mode)\n-\tvirtual void Trigger() = 0;\n+\tvirtual void Trigger(const uint32_t &trigger) = 0;\n \t// cancel a cycle (in auto mode)\n \tvirtual void Cancel() = 0;\n \t// pause the continuous mode\ndiff --git a/src/ipa/raspberrypi/controller/iob/af.cpp b/src/ipa/raspberrypi/controller/iob/af.cpp\nindex 2efc12f5..1d9bc2bc 100644\n--- a/src/ipa/raspberrypi/controller/iob/af.cpp\n+++ b/src/ipa/raspberrypi/controller/iob/af.cpp\n@@ -59,8 +59,16 @@ void Af::SetMode(const uint32_t &mode)\n \t}\n }\n \n-void Af::Trigger()\n-{\n+void Af::Trigger(const uint32_t &trigger)\n+{\n+\tLOG(IoBAf, Debug) << \"Trigger called in mode \" << mode_\n+\t\t\t  << \" with \" << trigger;\n+\tif (mode_ == libcamera::controls::AfModeAuto) {\n+\t\tif (trigger == libcamera::controls::AfTriggerStart)\n+\t\t\tafReset();\n+\t\telse\n+\t\t\tstatus_.state = libcamera::controls::AfStateIdle;\n+\t}\n }\n \n void Af::Pause(const uint32_t &pause)\ndiff --git a/src/ipa/raspberrypi/controller/iob/af.h b/src/ipa/raspberrypi/controller/iob/af.h\nindex c4ab3574..12d7bbbd 100644\n--- a/src/ipa/raspberrypi/controller/iob/af.h\n+++ b/src/ipa/raspberrypi/controller/iob/af.h\n@@ -24,7 +24,7 @@ public:\n \tvoid Prepare(Metadata *image_metadata) override;\n \tvoid Process(StatisticsPtr &stats, Metadata *image_metadata) override;\n \tvoid SetMode(const uint32_t &mode) override;\n-\tvoid Trigger() override;\n+\tvoid Trigger(const uint32_t &trigger) override;\n \tvoid Cancel() override;\n \tvoid Pause(const uint32_t &pause) override;\n \tvoid SetWindows(const libcamera::Rectangle &afWindows) override;\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 8c6f213f..673a2e79 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -986,6 +986,20 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n+\t\tcase controls::AF_TRIGGER: {\n+\t\t\tRPiController::AfAlgorithm *af = dynamic_cast<RPiController::AfAlgorithm *>(\n+\t\t\t\tcontroller_.GetAlgorithm(\"iob.af\"));\n+\t\t\tif (!af) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AF_MODE - no AF algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\taf->Trigger(ctrl.second.get<int32_t>());\n+\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tdefault:\n \t\t\tLOG(IPARPI, Warning)\n \t\t\t\t<< \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n",
    "prefixes": [
        "libcamera-devel",
        "08/10"
    ]
}