{"id":12795,"url":"https://patchwork.libcamera.org/api/patches/12795/?format=json","web_url":"https://patchwork.libcamera.org/patch/12795/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210702150940.226941-5-naush@raspberrypi.com>","date":"2021-07-02T15:09:36","name":"[libcamera-devel,v3,4/8] ipa: raspberrypi: Add frame_length to DeviceStatus","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f4ad78bdd73969213db75293d5e37b1910ec4878","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12795/mbox/","series":[{"id":2203,"url":"https://patchwork.libcamera.org/api/series/2203/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2203","date":"2021-07-02T15:09:32","name":"Raspberry Pi: Enable imx477 long exposure modes","version":3,"mbox":"https://patchwork.libcamera.org/series/2203/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12795/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12795/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 0DCB6BD794\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Jul 2021 15:09:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9F87E6850B;\n\tFri,  2 Jul 2021 17:09:55 +0200 (CEST)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B5FF3684F2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Jul 2021 17:09:53 +0200 (CEST)","by mail-wm1-x32c.google.com with SMTP id\n\to33-20020a05600c5121b02901e360c98c08so9299734wms.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 02 Jul 2021 08:09:53 -0700 (PDT)","from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tn4sm3619335wrw.21.2021.07.02.08.09.52\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 02 Jul 2021 08:09:52 -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=\"KQ7LlMbc\"; 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=XfILxhoSVcN7GeqHzwYfdA28qNC+FX05/kS6vxLb0B8=;\n\tb=KQ7LlMbcqyp4n6s8GYToi68D1N0ZoOA9fi0J/M0wIBbzaEdw5xBks7NRZdxlrgT81k\n\tf+aVnB2ZlulCB0eAtU8f9PKP2nXpQWMhMr0uqoX43uzO0mwladPmwdtbmLIVgPq3Al0q\n\t3I+aN8zwsGU3WkJc+wLKCcsTM2WTbEDgQxC5tHkhEJkRj706bwKU3aa5oJoT38C6bXPb\n\t5pQh8NqEYVZhKv0pQ61Vfnna0+ujIt3MD17ZcWJjYZ1abFoEHyK+wQkbskC1jIIUEknz\n\t9SvFVBAZHlDknNoE8Prnq8U8k3e07ycK0+wT3HkV4ujiQmi9Ra2tKI0iwdcOKAvCPRcL\n\tpdWw==","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=XfILxhoSVcN7GeqHzwYfdA28qNC+FX05/kS6vxLb0B8=;\n\tb=FFocBUM/HXFqlozjOz+v1hPOYZxnEY1rEcppD8XS6qMhr2uH4o76x8jvwsqPeff8Bo\n\tQZOIFI+yXBS1QjoUNSU8IPxipwU0mbehRH+/3un2j3lx0WgiLZ3335D4ysHClssF1V6M\n\tOPInnq2uAOMGYesZ7z8paCADhm2LFEV5b7q+UuwUh5tIyng0aXwzU69UbWH8DBPKnUfr\n\tnNJdwVqXHpt2YjyLXHHh4ujJVqm2F8VzTcI9dDXApbX1EgZ4FBDikkoboIZMHMVmjUga\n\tTw/brYqjXzbZKRiu3xe4pImxtfmACy97whJx+oF6K2Y7j2Z9EwhVsfZ5xRWfGVom3lII\n\tn7mA==","X-Gm-Message-State":"AOAM533Pc615B4TrU6r68QLPCr/DepKRd+t0ayeLMMCQWLW1Lya946BP\n\tJaJUqyQGA/a65MZbJTWOPqoaF3f+jrv2Nw==","X-Google-Smtp-Source":"ABdhPJy4N20Zl0zYTxbtZtwW6oQPYKV7Q/xT9Leayk+pg4hI+FZOZuJYDQ94YRqsFiKlnp4hg/0ftQ==","X-Received":"by 2002:a1c:2985:: with SMTP id\n\tp127mr6096325wmp.165.1625238593179; \n\tFri, 02 Jul 2021 08:09:53 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Jul 2021 16:09:36 +0100","Message-Id":"<20210702150940.226941-5-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210702150940.226941-1-naush@raspberrypi.com>","References":"<20210702150940.226941-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 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>\n---\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 4 files changed, 16 insertions(+), 3 deletions(-)","diff":"diff --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 4098fde6f322..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 [[maybe_unused]] = { 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","v3","4/8"]}