{"id":11522,"url":"https://patchwork.libcamera.org/api/1.1/patches/11522/?format=json","web_url":"https://patchwork.libcamera.org/patch/11522/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210308223939.2088-2-david.plowman@raspberrypi.com>","date":"2021-03-08T22:39:37","name":"[libcamera-devel,v2,1/3] ipa: raspberrypi: Make CamHelpers return the frame delay for vblanking","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"4a8d1df8e03654aa894880f094dcc1b25690bf9b","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11522/mbox/","series":[{"id":1772,"url":"https://patchwork.libcamera.org/api/1.1/series/1772/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1772","date":"2021-03-08T22:39:36","name":"Raspberry Pi support for new sensors","version":2,"mbox":"https://patchwork.libcamera.org/series/1772/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11522/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11522/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 65F15BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Mar 2021 22:39:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 21E2768A92;\n\tMon,  8 Mar 2021 23:39:48 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 329B168A92\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Mar 2021 23:39:46 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id j2so13132801wrx.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 08 Mar 2021 14:39:46 -0800 (PST)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tf17sm19811322wru.31.2021.03.08.14.39.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 08 Mar 2021 14:39:45 -0800 (PST)"],"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=\"X6/6KZFl\"; 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=6cpGSK6jVuNXhIB+3pAc3OxbV7hDqDDnMJI2a0EMvhA=;\n\tb=X6/6KZFlLZojPbFlT+nkiMttNwc0Oq3GiLzAc6FUZH7nPUIAWIspO0eujzlRlviEV4\n\tQWJBXkAvn8ENdZW7bBDv47ByFpSJ22kUFlctpTBF+9UBH4gt21X+ya7n4md3BCn2+JsI\n\t7zcxm+xgi75sBSQA35rgTNpizVHUYDCGNPnHwJ/hDDj6Cw6lYqSBV00xNJ/Ym0LrC6Qe\n\tUwnrejU1poATNh3P450qTjXkwRVSO6h9EKDXEHVwKuIqrLfAvNeQSez4MWidUGWGtTiv\n\tpydhF9Na/eNiRiYyy6DHhiZw1FkBEkviGCB8Xr1RBIuBttoo8o2C2WW9ux0c4qs4h+4f\n\tx2DA==","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=6cpGSK6jVuNXhIB+3pAc3OxbV7hDqDDnMJI2a0EMvhA=;\n\tb=LttiFN9tuAXoX195xmkp4owCRwDABqYpp4IgumcFoGmu74UFNcr5T/hTWhrTEuhkeL\n\tZs/arWnY+C+pdAQtSrlhIHQqrSEBbcyBbtgeFtz6Gtv4gqqLKaKpncpNPIY4LKXnVqeB\n\thfpvvoW8fq+GwiwKtTDwDBSk4rnq21Jl2mpdZNgcFUUvT5u8O2kdN/1DJFPMdvtC6Q7K\n\t8GMOj7iGuZusuW6kTtalffTIZoFfPwrNe9aObvNtmugj/lNBghbxtZe0dDzodZjrAxkS\n\tScEWRvaPwJKUAXv8M8GqjyByBMUBMTknDnYhSsaHGN0FeL6H/Bee96NNbjVtSO8yFXPg\n\tYr+Q==","X-Gm-Message-State":"AOAM531oQLd2mPTdTp7goyTY2elIkyHN/upDE1G2YDNcn8w5FHbR6q83\n\t9kAnZohjcbwYg3086n0CBQjFHvzsntVtBg==","X-Google-Smtp-Source":"ABdhPJzQvn1Mla0NAasRRN1r3IbKR3QnLeUjQj4w3MS8FoYievxT3hPM6tkEMquRTuztwIByfOQk9A==","X-Received":"by 2002:adf:c186:: with SMTP id\n\tx6mr25583284wre.253.1615243185665; \n\tMon, 08 Mar 2021 14:39:45 -0800 (PST)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Mar 2021 22:39:37 +0000","Message-Id":"<20210308223939.2088-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20210308223939.2088-1-david.plowman@raspberrypi.com>","References":"<20210308223939.2088-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 1/3] ipa: raspberrypi: Make CamHelpers\n\treturn the frame delay for vblanking","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":"For some sensors (e.g. imx477) we need to update the vblanking on the\nframe before the exposure. For this reason the GetDelays method must\nalso return the number of frame delays for the vblanking control.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/cam_helper.cpp        |  4 +++-\n src/ipa/raspberrypi/cam_helper.hpp        | 11 ++++++-----\n src/ipa/raspberrypi/cam_helper_imx477.cpp |  7 +++++--\n src/ipa/raspberrypi/cam_helper_ov5647.cpp |  7 +++++--\n src/ipa/raspberrypi/raspberrypi.cpp       |  6 +++---\n 5 files changed, 22 insertions(+), 13 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/cam_helper.cpp b/src/ipa/raspberrypi/cam_helper.cpp\nindex 2837fcce..0ae0baa0 100644\n--- a/src/ipa/raspberrypi/cam_helper.cpp\n+++ b/src/ipa/raspberrypi/cam_helper.cpp\n@@ -95,7 +95,8 @@ void CamHelper::SetCameraMode(const CameraMode &mode)\n \tinitialized_ = true;\n }\n \n-void CamHelper::GetDelays(int &exposure_delay, int &gain_delay) const\n+void CamHelper::GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t\t  int &vblank_delay) const\n {\n \t/*\n \t * These values are correct for many sensors. Other sensors will\n@@ -103,6 +104,7 @@ void CamHelper::GetDelays(int &exposure_delay, int &gain_delay) const\n \t */\n \texposure_delay = 2;\n \tgain_delay = 1;\n+\tvblank_delay = 2;\n }\n \n bool CamHelper::SensorEmbeddedDataPresent() const\ndiff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp\nindex 14d70112..1b2d6eec 100644\n--- a/src/ipa/raspberrypi/cam_helper.hpp\n+++ b/src/ipa/raspberrypi/cam_helper.hpp\n@@ -28,10 +28,10 @@ namespace RPiController {\n // exposure time, and to convert between the sensor's gain codes and actual\n // gains.\n //\n-// A method to return the number of frames of delay between updating exposure\n-// and analogue gain and the changes taking effect. For many sensors these\n-// take the values 2 and 1 respectively, but sensors that are different will\n-// need to over-ride the default method provided.\n+// A method to return the number of frames of delay between updating exposure,\n+// analogue gain and vblanking, and for the changes to take effect. For many\n+// sensors these take the values 2, 1 and 2 respectively, but sensors that are\n+// different will need to over-ride the default method provided.\n //\n // A method to query if the sensor outputs embedded data that can be parsed.\n //\n@@ -72,7 +72,8 @@ public:\n \t\t\t\t      double maxFrameDuration) const;\n \tvirtual uint32_t GainCode(double gain) const = 0;\n \tvirtual double Gain(uint32_t gain_code) const = 0;\n-\tvirtual void GetDelays(int &exposure_delay, int &gain_delay) const;\n+\tvirtual void GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t\t       int &vblank_delay) const;\n \tvirtual bool SensorEmbeddedDataPresent() const;\n \tvirtual unsigned int HideFramesStartup() const;\n \tvirtual unsigned int HideFramesModeSwitch() const;\ndiff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp\nindex 419f8e77..73a5ca7d 100644\n--- a/src/ipa/raspberrypi/cam_helper_imx477.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp\n@@ -37,7 +37,8 @@ public:\n \tCamHelperImx477();\n \tuint32_t GainCode(double gain) const override;\n \tdouble Gain(uint32_t gain_code) const override;\n-\tvoid GetDelays(int &exposure_delay, int &gain_delay) const override;\n+\tvoid GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t       int &vblank_delay) const override;\n \tbool SensorEmbeddedDataPresent() const override;\n \n private:\n@@ -63,10 +64,12 @@ double CamHelperImx477::Gain(uint32_t gain_code) const\n \treturn 1024.0 / (1024 - gain_code);\n }\n \n-void CamHelperImx477::GetDelays(int &exposure_delay, int &gain_delay) const\n+void CamHelperImx477::GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t\t\tint &vblank_delay) const\n {\n \texposure_delay = 2;\n \tgain_delay = 2;\n+\tvblank_delay = 3;\n }\n \n bool CamHelperImx477::SensorEmbeddedDataPresent() const\ndiff --git a/src/ipa/raspberrypi/cam_helper_ov5647.cpp b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\nindex 75486e90..12be6bf9 100644\n--- a/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n+++ b/src/ipa/raspberrypi/cam_helper_ov5647.cpp\n@@ -17,7 +17,8 @@ public:\n \tCamHelperOv5647();\n \tuint32_t GainCode(double gain) const override;\n \tdouble Gain(uint32_t gain_code) const override;\n-\tvoid GetDelays(int &exposure_delay, int &gain_delay) const override;\n+\tvoid GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t       int &vblank_delay) const override;\n \tunsigned int HideFramesStartup() const override;\n \tunsigned int HideFramesModeSwitch() const override;\n \tunsigned int MistrustFramesStartup() const override;\n@@ -51,7 +52,8 @@ double CamHelperOv5647::Gain(uint32_t gain_code) const\n \treturn static_cast<double>(gain_code) / 16.0;\n }\n \n-void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay) const\n+void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay,\n+\t\t\t\tint &vblank_delay) const\n {\n \t/*\n \t * We run this sensor in a mode where the gain delay is bumped up to\n@@ -59,6 +61,7 @@ void CamHelperOv5647::GetDelays(int &exposure_delay, int &gain_delay) const\n \t */\n \texposure_delay = 2;\n \tgain_delay = 2;\n+\tvblank_delay = 2;\n }\n \n unsigned int CamHelperOv5647::HideFramesStartup() const\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 6348d071..741bff4c 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -342,14 +342,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\t * Pass out the sensor config to the pipeline handler in order\n \t\t * to setup the staggered writer class.\n \t\t */\n-\t\tint gainDelay, exposureDelay, sensorMetadata;\n-\t\thelper_->GetDelays(exposureDelay, gainDelay);\n+\t\tint gainDelay, exposureDelay, vblankDelay, sensorMetadata;\n+\t\thelper_->GetDelays(exposureDelay, gainDelay, vblankDelay);\n \t\tsensorMetadata = helper_->SensorEmbeddedDataPresent();\n \n \t\tresult->params |= ipa::RPi::ConfigSensorParams;\n \t\tresult->sensorConfig.gainDelay = gainDelay;\n \t\tresult->sensorConfig.exposureDelay = exposureDelay;\n-\t\tresult->sensorConfig.vblank = exposureDelay;\n+\t\tresult->sensorConfig.vblank = vblankDelay;\n \t\tresult->sensorConfig.sensorMetadata = sensorMetadata;\n \t}\n \n","prefixes":["libcamera-devel","v2","1/3"]}