Show a patch.

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

{
    "id": 12122,
    "url": "https://patchwork.libcamera.org/api/patches/12122/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12122/",
    "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": "<20210427130844.11357-5-david.plowman@raspberrypi.com>",
    "date": "2021-04-27T13:08:44",
    "name": "[libcamera-devel,v4,4/4] ipa: raspberrypi: Update sensor's V4L2_CID_NOTIFY_GAIN_RED/BLUE controls when present",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f7427bcb2aa01f896a2e0da4dfe08b4a51cb0b50",
    "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/12122/mbox/",
    "series": [
        {
            "id": 1982,
            "url": "https://patchwork.libcamera.org/api/series/1982/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1982",
            "date": "2021-04-27T13:08:40",
            "name": "Raspberry Pi: handle sensors more flexibly",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1982/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12122/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12122/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 17FAABDE3B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 27 Apr 2021 13:08:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C582B688BC;\n\tTue, 27 Apr 2021 15:08:57 +0200 (CEST)",
            "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 52B89688B9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 15:08:52 +0200 (CEST)",
            "by mail-wm1-x329.google.com with SMTP id i129so4829548wma.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 27 Apr 2021 06:08:52 -0700 (PDT)",
            "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tr11sm3899327wrx.22.2021.04.27.06.08.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 27 Apr 2021 06:08:51 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"iKk8ke3W\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=SRcCNs41XyRBojY2uLGpAnfWWyGX6MGdxtj3SoKY7bA=;\n\tb=iKk8ke3W+gjuSdq7H1CVyIfROkXOgLIddT5vKbJI/V3lCg8a4s+FdX7O7aBCdXeqRc\n\t/3WfXAk7kHb61tzXjnvYT/h5e4oTfG6DjJjAHb8Kiag9y4PtYIAjOiDoRQ5/FCorHje7\n\t82R94jWVskviwGqxkAN1osg+9IgftrbKgakb1kr0k+8yVvHs/WCwJoMIjqBVfJCu4DFD\n\tZCY7TdkFeHMon9ytzdi/a8sP9Q/I7BgIGXthFohkzJ74o3tweNecDdDBkyRY8dSybADt\n\tZdM77JD/Ev4wffuTVIUVeppTyC2v4Qefa/BuHgXnD+YsPx86lhvaB4dp4Vvv5K39SiFg\n\tQgKQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=SRcCNs41XyRBojY2uLGpAnfWWyGX6MGdxtj3SoKY7bA=;\n\tb=GSlYSnSJyPOusYAR3+WL4MZp0Lr+1qbUIuYsJmBWeEzDC2fCm1fjkQAmXXRbggOzk9\n\tCQzKWHN69jGCP6YMQVZxZu7GJyQ54yXcNzldGqq05V6iKpCy+JtOdOJdTE2HakeLwMD3\n\tsU3v0OWzT3NTn+5LiMbRSUCyCUKexaFy7BGBkB/LFdSx2e6Ze5rfZqd7Em6JAh/uK7Oj\n\thY4wx+dLMqtQ7riWoIIjndDSzh8Jb3/S5I2q0GDGqKYHJ1/hqf5tAo3WLE/rlukx7+Rw\n\tlRdw0LGHI7dGyL1yf1aGJ1D1s1dee0gUs3fU8Xj2ocMAMg/HJvNqtYhPPFIyjbDY3ka0\n\tz1ag==",
        "X-Gm-Message-State": "AOAM530Ud2jG5/Ky3N6t/93VQvyBzS9NOyTortd07YhVirhJ3PNPaRUE\n\ttgqlt6dvvw0/WCf5uXgcOeF4ipC8dHwALg==",
        "X-Google-Smtp-Source": "ABdhPJy7DuZivxA2vMi8SNqnuqT8YrSLM3YU4YkP9FYXJpQoXNd2NGpUCoRnYrgQb4BCF9r500OWmA==",
        "X-Received": "by 2002:a05:600c:4148:: with SMTP id\n\th8mr4252934wmm.19.1619528931901; \n\tTue, 27 Apr 2021 06:08:51 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 27 Apr 2021 14:08:44 +0100",
        "Message-Id": "<20210427130844.11357-5-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20210427130844.11357-1-david.plowman@raspberrypi.com>",
        "References": "<20210427130844.11357-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 4/4] ipa: raspberrypi: Update sensor's\n\tV4L2_CID_NOTIFY_GAIN_RED/BLUE controls when present",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "If the sensor exposes V4L2_CID_NOTIFY_GAIN_RED and\nV4L2_CID_NOTIFY_GAIN_BLUE controls, we pass it the colour gains.\n\nWe want these to be applied as soon as possible so we add a new\nsetSensorControls signal to the IPA which passes these back to the\npipeline handler without using the DelayedControls mechanism.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.mojom            |  1 +\n src/ipa/raspberrypi/raspberrypi.cpp                | 13 +++++++++++++\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 ++++++++++\n 3 files changed, 24 insertions(+)",
    "diff": "diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 42321bee..24015263 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -118,6 +118,7 @@ interface IPARPiEventInterface {\n \tstatsMetadataComplete(uint32 bufferId, libcamera.ControlList controls);\n \trunIsp(uint32 bufferId);\n \tembeddedComplete(uint32 bufferId);\n+\tsetSensorControls(libcamera.ControlList controls);\n \tsetIspControls(libcamera.ControlList controls);\n \tsetDelayedControls(libcamera.ControlList controls);\n };\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex dad6395f..f7d1aa0a 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -1036,6 +1036,19 @@ void IPARPi::processStats(unsigned int bufferId)\n \n \t\tsetDelayedControls.emit(ctrls);\n \t}\n+\n+\tstruct AwbStatus awbStatus;\n+\tif (rpiMetadata_.Get(\"awb.status\", awbStatus) == 0 &&\n+\t    sensorCtrls_.find(V4L2_CID_NOTIFY_GAIN_RED) != sensorCtrls_.end() &&\n+\t    sensorCtrls_.find(V4L2_CID_NOTIFY_GAIN_BLUE) != sensorCtrls_.end()) {\n+\t\tControlList ctrls(sensorCtrls_);\n+\t\tctrls.set(V4L2_CID_NOTIFY_GAIN_RED,\n+\t\t\t  static_cast<int32_t>(helper_->ColourGainCode(awbStatus.gain_r)));\n+\t\tctrls.set(V4L2_CID_NOTIFY_GAIN_BLUE,\n+\t\t\t  static_cast<int32_t>(helper_->ColourGainCode(awbStatus.gain_b)));\n+\n+\t\tsetSensorControls.emit(ctrls);\n+\t}\n }\n \n void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 2a917455..054171d8 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -152,6 +152,7 @@ public:\n \tvoid statsMetadataComplete(uint32_t bufferId, const ControlList &controls);\n \tvoid runIsp(uint32_t bufferId);\n \tvoid embeddedComplete(uint32_t bufferId);\n+\tvoid setSensorControls(const ControlList &controls);\n \tvoid setIspControls(const ControlList &controls);\n \tvoid setDelayedControls(const ControlList &controls);\n \n@@ -1219,6 +1220,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n \tipa_->statsMetadataComplete.connect(this, &RPiCameraData::statsMetadataComplete);\n \tipa_->runIsp.connect(this, &RPiCameraData::runIsp);\n \tipa_->embeddedComplete.connect(this, &RPiCameraData::embeddedComplete);\n+\tipa_->setSensorControls.connect(this, &RPiCameraData::setSensorControls);\n \tipa_->setIspControls.connect(this, &RPiCameraData::setIspControls);\n \tipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls);\n \n@@ -1361,6 +1363,14 @@ void RPiCameraData::embeddedComplete(uint32_t bufferId)\n \thandleState();\n }\n \n+void RPiCameraData::setSensorControls(const ControlList &controls)\n+{\n+\tControlList ctrls = controls;\n+\n+\tunicam_[Unicam::Image].dev()->setControls(&ctrls);\n+\thandleState();\n+}\n+\n void RPiCameraData::setIspControls(const ControlList &controls)\n {\n \tControlList ctrls = controls;\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "4/4"
    ]
}