Show a patch.

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

{
    "id": 12848,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12848/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12848/",
    "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": "<20210707094815.1500917-5-naush@raspberrypi.com>",
    "date": "2021-07-07T09:48:11",
    "name": "[libcamera-devel,v4,4/8] ipa: raspberrypi: Add frame_length to DeviceStatus",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "61818aa812c29e01ec42b7e6cb3650aa1133844f",
    "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/12848/mbox/",
    "series": [
        {
            "id": 2214,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2214/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2214",
            "date": "2021-07-07T09:48:07",
            "name": "Raspberry Pi: Enable imx477 long exposure modes",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/2214/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12848/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12848/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 87853C3225\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Jul 2021 09:48:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 48C7D6852D;\n\tWed,  7 Jul 2021 11:48:24 +0200 (CEST)",
            "from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E67586852D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Jul 2021 11:48:20 +0200 (CEST)",
            "by mail-wm1-x32d.google.com with SMTP id\n\tt14-20020a05600c198eb029020c8aac53d4so10125035wmq.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Jul 2021 02:48:20 -0700 (PDT)",
            "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:f800:302e:bf7e:a06b])\n\tby smtp.gmail.com with ESMTPSA id\n\tr16sm23377836wrx.63.2021.07.07.02.48.19\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 07 Jul 2021 02:48:19 -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=\"cNdFcpBH\"; 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=SL2VE/oHSC2fXzf+qdGiYlkTgGyRfJpTg5+hSXVd9yw=;\n\tb=cNdFcpBHmVetCB12j/5L362wCfyprrY6fU8jt7dBpCTuuR0BbKXTvQe1kGif+sAIz1\n\tS3r1h8hgCTxRqyOwkP+8aNyvlAxew36Q8l/lpgORDJAxTL2mj2YeTpZEAFoZUXrhWDQL\n\tqIh58i5Z0U4+NKCgFqnCll5UMxeihjTMfom1XVheX9O5e53rAZ6J73jFociY718uYowb\n\tEj6FQIsc5AVzvRaWsoO1GfOJ8NfKCIscKQLo/CnvXYVDFC5+BQPDyqK0uoF5Xk/pWr2D\n\tIisiKstYaD9LCiAOY35VfQ9vreW13sOg2CkzlaSWCSva/hP0obUslagsBSgMl/NflNuz\n\tTmmg==",
        "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=SL2VE/oHSC2fXzf+qdGiYlkTgGyRfJpTg5+hSXVd9yw=;\n\tb=EdJ/5vIZPw6ZA9JCnJ+eaXs6VxdrU5lMULXwTCHW5bgbYl4xy5sndEpBjNsOqj6tQs\n\tCDvRqBIs+q40Inj9JDPQLIAAprfTvlv/jYF/6ZB6PDX5DveeSvqJmTWcXnIQHT7veDuE\n\thBTAuJ5y9cjOrkRKlc2xM8M6BDgY5C9XcA2qjOW7DzTL66R+TNJpxvFtbSsacjvAmNWj\n\tblFxAl0K3IXgsIJCzr/qTZlyrKIyMet1gqIhTM0PnlshZH2DAqiXGVYantSsuZEokg8C\n\tAFSpNl2dusQBM4vHcS0PtUvSTUdz2hgV6A9FlA3RpnCjE02Czmufy4DOeGp6OohpCPU1\n\tGCoQ==",
        "X-Gm-Message-State": "AOAM532rP5yUnicF2jewOEHO3i1KMYHTOQ864ytR74MUC42TKXSkGvG3\n\tpWOwmwZ40XHUMWnCVC5jwJrCAt/+SaKecg==",
        "X-Google-Smtp-Source": "ABdhPJzC9N6BS42xjCoyeXdA+JvWP6bn9k+3iknBDPGfVC5Rgd7bPOeo/eX7ypB+1hfs7In7lGFg4g==",
        "X-Received": "by 2002:a1c:25c6:: with SMTP id\n\tl189mr5988142wml.49.1625651300392; \n\tWed, 07 Jul 2021 02:48:20 -0700 (PDT)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  7 Jul 2021 10:48:11 +0100",
        "Message-Id": "<20210707094815.1500917-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210707094815.1500917-1-naush@raspberrypi.com>",
        "References": "<20210707094815.1500917-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 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": "Update the IPA to fill frame length into the DeviceStatus struct from the\nVBLANK Control value passed from DelayedControls.\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>\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.h | 5 ++++-\n src/ipa/raspberrypi/raspberrypi.cpp            | 2 ++\n 5 files changed, 17 insertions(+), 3 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.h b/src/ipa/raspberrypi/controller/device_status.h\nindex e2511d19b96d..916471ab258b 100644\n--- a/src/ipa/raspberrypi/controller/device_status.h\n+++ b/src/ipa/raspberrypi/controller/device_status.h\n@@ -17,7 +17,7 @@\n \n struct DeviceStatus {\n \tDeviceStatus()\n-\t\t: shutter_speed(std::chrono::seconds(0)), analogue_gain(0.0),\n+\t\t: shutter_speed(std::chrono::seconds(0)), frame_length(0), analogue_gain(0.0),\n \t\t  lens_position(0.0), aperture(0.0), flash_intensity(0.0)\n \t{\n \t}\n@@ -28,6 +28,7 @@ struct DeviceStatus {\n \n \t\tout << \"Exposure: \" << d.shutter_speed\n \t\t    << \" Gain: \" << d.analogue_gain\n+\t\t    << \" Frame Length: \" << d.frame_length\n \t\t    << \" Aperture: \" << d.aperture\n \t\t    << \" Lens: \" << d.lens_position\n \t\t    << \" Flash: \" << d.flash_intensity;\n@@ -37,6 +38,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",
        "v4",
        "4/8"
    ]
}