Show a patch.

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

{
    "id": 12905,
    "url": "https://patchwork.libcamera.org/api/patches/12905/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12905/",
    "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": "<20210712100209.447893-5-naush@raspberrypi.com>",
    "date": "2021-07-12T10:02:05",
    "name": "[libcamera-devel,v7,4/8] ipa: raspberrypi: Add frame_length to DeviceStatus",
    "commit_ref": "2d6a9b3592fe4ce8a68e5ed125395708cb5bd0fa",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "47ff37995df5d199551f13a276d3278831fb8b17",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12905/mbox/",
    "series": [
        {
            "id": 2227,
            "url": "https://patchwork.libcamera.org/api/series/2227/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2227",
            "date": "2021-07-12T10:02:01",
            "name": "ipa: raspberrypi: Allow long exposure modes for imx477.",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/2227/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12905/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12905/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 85CCAC3227\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Jul 2021 10:02:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2F10168534;\n\tMon, 12 Jul 2021 12:02:22 +0200 (CEST)",
            "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E829E6852D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 12:02:18 +0200 (CEST)",
            "by mail-wm1-x334.google.com with SMTP id g12so3169231wme.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Jul 2021 03:02:18 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:3395:5e50:10bb:f8fd])\n\tby smtp.gmail.com with ESMTPSA id\n\tb16sm14249941wrs.51.2021.07.12.03.02.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 12 Jul 2021 03:02:17 -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=\"GHW5hz66\"; 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=G4TAVStL/tcP2DlEiFfnCm1cY6C6U0CxrcKv4TvSmvM=;\n\tb=GHW5hz66BguI7elgDMW5df9egaybCzUdlm0NXABwk1QZsdaDgXkn6KOoEd6dQ3jMyr\n\t4adeVLrkwhbfzAa/m28Xtq+Y+iddrLd4tvXVu+1kFT6ZHayvs/74bsedHpkpCYIONqN8\n\tb41RHbWiSo3bS8VHqUjnicfXDLazV/tzqxOOdrEf9LgQzj0h0EIgvoek5PswQC0JU0f5\n\tjU+dSdpJKD/OEqklUB2EgipzBscgGQmdTM1FVi53cfvxDIXT4Q5otiDuzz+WClEdg6v9\n\t1JZcY3ofpExK1X91Qe61WdE+Y4ZVh1w7C5SkRIQ5pk89Tl11VGzzvlirZIT/kyw2gx7f\n\tZPFQ==",
        "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=G4TAVStL/tcP2DlEiFfnCm1cY6C6U0CxrcKv4TvSmvM=;\n\tb=UCOaKarGipXgVkPtkZ1DCmZDWOYY6weENL8Ky/HgXyAP3XpHhV2l2VMr6GjpKdXK5x\n\t/HNAS7WyqfVGTu2FcOM1gle6tqnPt9hGTxgp+R78si2+Ak7yG//gjrThFYCASZyrinZf\n\tQ9//DfzIQixzAmlHiS0sUTPujH4NwYmDeEy7JCwBYkr9YcE4r49q1usefVnDoaepsjqi\n\t4FEvMyJZBL8syCkx8QGl2r1YkUYoLDy716Dc3T1tdZbdHxpRuxj2jHrLsmbMqtUWI3qF\n\t4KwagOhDedhPB8Ff3jBfUgGWtywdgTqhCU7NF+DEC0G/30AAwgiNIQuXz976U0UwFBDE\n\tt40Q==",
        "X-Gm-Message-State": "AOAM533xUgAwEKzhSCXYzmUm7Uka0+b/+hTTR+wFaGWpRA4amcgox9zQ\n\tyG4WehJTwseh0m2umkXnoYcbQ8UnN5J+7g==",
        "X-Google-Smtp-Source": "ABdhPJz+4X8tWCqELlQUI+WtqR11r7cI8m9HLgHTd3jfP5eI+qWgVmM6gT9Qt9DZuwg4pDYReKGIVA==",
        "X-Received": "by 2002:a1c:63d6:: with SMTP id\n\tx205mr5594407wmb.42.1626084138394; \n\tMon, 12 Jul 2021 03:02:18 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 12 Jul 2021 11:02:05 +0100",
        "Message-Id": "<20210712100209.447893-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210712100209.447893-1-naush@raspberrypi.com>",
        "References": "<20210712100209.447893-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 4/8] ipa: raspberrypi: Add frame_length\n\tto DeviceStatus",
        "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": "Store the frame length into the DeviceStatus struct. The value is extracted\nfrom embedded data when available, or calculated from the VBLANK value passed\nfrom DelayedControls otherwise.\n\nUpdate imx477 and imx219 CamHelper classes to extract the frame length from the\nembedded data buffer.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp               | 1 +\n src/ipa/raspberrypi/cam_helper_imx219.cpp        | 6 +++++-\n src/ipa/raspberrypi/cam_helper_imx477.cpp        | 6 +++++-\n src/ipa/raspberrypi/controller/device_status.cpp | 1 +\n src/ipa/raspberrypi/controller/device_status.h   | 7 +++++--\n src/ipa/raspberrypi/raspberrypi.cpp              | 2 ++\n 6 files changed, 19 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 1ec3f03e1aa3..3c6afce7572b 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -187,6 +187,7 @@ void CamHelper::parseEmbeddedData(Span<const uint8_t> buffer,\n \n \tdeviceStatus.shutter_speed = parsedDeviceStatus.shutter_speed;\n \tdeviceStatus.analogue_gain = parsedDeviceStatus.analogue_gain;\n+\tdeviceStatus.frame_length = parsedDeviceStatus.frame_length;\n \n \tLOG(IPARPI, Debug) << \"Metadata updated - \" << deviceStatus;\n \ndiff --git a/src/ipa/raspberrypi/cam_helper_imx219.cpp b/src/ipa/raspberrypi/cam_helper_imx219.cpp\nindex 4d68e01fce71..a3caab714602 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx219.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx219.cpp\n@@ -30,7 +30,10 @@ using namespace RPiController;\n constexpr uint32_t gainReg = 0x157;\n constexpr uint32_t expHiReg = 0x15a;\n constexpr uint32_t expLoReg = 0x15b;\n-constexpr std::initializer_list<uint32_t> registerList [[maybe_unused]] = { expHiReg, expLoReg, gainReg };\n+constexpr uint32_t frameLengthHiReg = 0x160;\n+constexpr uint32_t frameLengthLoReg = 0x161;\n+constexpr std::initializer_list<uint32_t> registerList [[maybe_unused]]\n+\t= { expHiReg, expLoReg, gainReg, frameLengthHiReg, frameLengthLoReg };\n \n class CamHelperImx219 : public CamHelper\n {\n@@ -93,6 +96,7 @@ void CamHelperImx219::PopulateMetadata(const MdParser::RegisterMap &registers,\n \n \tdeviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n \tdeviceStatus.analogue_gain = Gain(registers.at(gainReg));\n+\tdeviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n \n \tmetadata.Set(\"device.status\", deviceStatus);\n }\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\nindex efd1a5893db8..91d05d9226ff 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n@@ -23,7 +23,10 @@ constexpr uint32_t expHiReg = 0x0202;\n constexpr uint32_t expLoReg = 0x0203;\n constexpr uint32_t gainHiReg = 0x0204;\n constexpr uint32_t gainLoReg = 0x0205;\n-constexpr std::initializer_list<uint32_t> registerList = { expHiReg, expLoReg, gainHiReg, gainLoReg };\n+constexpr uint32_t frameLengthHiReg = 0x0340;\n+constexpr uint32_t frameLengthLoReg = 0x0341;\n+constexpr std::initializer_list<uint32_t> registerList =\n+\t{ expHiReg, expLoReg, gainHiReg, gainLoReg, frameLengthHiReg, frameLengthLoReg  };\n \n class CamHelperImx477 : public CamHelper\n {\n@@ -81,6 +84,7 @@ void CamHelperImx477::PopulateMetadata(const MdParser::RegisterMap &registers,\n \n \tdeviceStatus.shutter_speed = Exposure(registers.at(expHiReg) * 256 + registers.at(expLoReg));\n \tdeviceStatus.analogue_gain = Gain(registers.at(gainHiReg) * 256 + registers.at(gainLoReg));\n+\tdeviceStatus.frame_length = registers.at(frameLengthHiReg) * 256 + registers.at(frameLengthLoReg);\n \n \tmetadata.Set(\"device.status\", deviceStatus);\n }\ndiff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp\nindex 7b8218ca67d5..f052ea8b7bed 100644\n--- a/src/ipa/raspberrypi/controller/device_status.cpp\n+++ b/src/ipa/raspberrypi/controller/device_status.cpp\n@@ -11,6 +11,7 @@ using namespace libcamera; /* for the Duration operator<< overload */\n std::ostream &operator<<(std::ostream &out, const DeviceStatus &d)\n {\n \tout << \"Exposure: \" << d.shutter_speed\n+\t    << \" Frame length: \" << d.frame_length\n \t    << \" Gain: \" << d.analogue_gain\n \t    << \" Aperture: \" << d.aperture\n \t    << \" Lens: \" << d.lens_position\ndiff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h\nindex ec4bbe738b35..c4a5d9c8e8c7 100644\n--- a/src/ipa/raspberrypi/controller/device_status.h\n+++ b/src/ipa/raspberrypi/controller/device_status.h\n@@ -17,8 +17,9 @@\n \n struct DeviceStatus {\n \tDeviceStatus()\n-\t\t: shutter_speed(std::chrono::seconds(0)), analogue_gain(0.0),\n-\t\t  lens_position(0.0), aperture(0.0), flash_intensity(0.0)\n+\t\t: shutter_speed(std::chrono::seconds(0)), frame_length(0),\n+\t\t  analogue_gain(0.0), lens_position(0.0), aperture(0.0),\n+\t\t  flash_intensity(0.0)\n \t{\n \t}\n \n@@ -26,6 +27,8 @@ struct DeviceStatus {\n \n \t/* time shutter is open */\n \tlibcamera::utils::Duration shutter_speed;\n+\t/* frame length given in number of lines */\n+\tuint32_t frame_length;\n \tdouble analogue_gain;\n \t/* 1.0/distance-in-metres, or 0 if unknown */\n \tdouble lens_position;\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex f51c970befb5..db103a885b7a 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -1015,9 +1015,11 @@ void IPARPi::fillDeviceStatus(const ControlList &sensorControls)\n \n \tint32_t exposureLines = sensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n \tint32_t gainCode = sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>();\n+\tint32_t vblank = sensorControls.get(V4L2_CID_VBLANK).get<int32_t>();\n \n \tdeviceStatus.shutter_speed = helper_->Exposure(exposureLines);\n \tdeviceStatus.analogue_gain = helper_->Gain(gainCode);\n+\tdeviceStatus.frame_length = mode_.height + vblank;\n \n \tLOG(IPARPI, Debug) << \"Metadata - \" << deviceStatus;\n \n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "4/8"
    ]
}