From patchwork Thu Jul 1 11:34:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12756 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A8230C3222 for ; Thu, 1 Jul 2021 11:34:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 65A7B684F7; Thu, 1 Jul 2021 13:34:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZYgoJ0P6"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B2A4D60289 for ; Thu, 1 Jul 2021 13:34:47 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id u8so7755231wrq.8 for ; Thu, 01 Jul 2021 04:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d/qzJ12HXMrt3litZ/q3bNli735+KJm88bJeUyFLX2k=; b=ZYgoJ0P6QDiBTL+SLgyePiJnuGTJJk8dTLLQcOHksuLuy3d063m1r8CazDfC0UMyhx v4kgElNcoih1dPFV/fYRtwUvTl/oeV4di0C8Ystp3+AH1/f2VrMRy/M6lCnALaGACq9c XYzNSWysJHimGulNYnhCFqTJnE4jqJCvMLibRJ7pXXJm84+rPsG+odTisJ81h3K1+VPp rjKK8xO2WS9LgoYSHjkFoZpvv/jKIQnEnn52oC3+cg76i1W+QTjRCytW+lKOwDWuDduu 7I6IIWKBrt8fbK4CVSGdOcUyKSWAz48XSFrOqQjM02drxVOqbtiBdNYDKeS3P+DxzfT5 /FMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d/qzJ12HXMrt3litZ/q3bNli735+KJm88bJeUyFLX2k=; b=KG0wd7HCnH5kVTbcNEOSAGKxQiTUUjKueq2lQoUgAsh3P64iUbbUPzelqX2vTjC1pB bf/kEz6+e4ROt5/DulsiBjtfGk991ARYbsOOwjLbAeDZqFg2cXwBd1OwuV6Wp8GY1ul7 qW86RF6hj4/1kaB8CYskt0I64C7Z4RMndxOSK8i0pkZYC9DHHk8cl9qG1/UMjJp/Eqc5 iucJDHSUoWxpHvR6jjzZHNuNuZHzPfjaVIdH5vJtNcKVN3i2JGQz28Wp9A13nYZdvFbo MxRoHrnftCpNwyBbBpU2rydH5yILl20XNGkHsqYwvY+vQCWaIM4Uk2/Y9kWC4eXTfA5a 8X/g== X-Gm-Message-State: AOAM532dpXKBK2rxXqHejsIPxNOe+g5lnvX+PRB+aIQ9smLu36qECUV8 YZAVChsq3JQjjLtfHMN6o2Af+LnamBZJVg== X-Google-Smtp-Source: ABdhPJydDGlEqPPNmFAt6WgPWEWSVAa4vW1YJXe+cOHBOZ+3erw6GPkPN6u1818vDOL7LLpP53+hpQ== X-Received: by 2002:adf:f74c:: with SMTP id z12mr46159338wrp.18.1625139287314; Thu, 01 Jul 2021 04:34:47 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id f6sm8076495wrs.13.2021.07.01.04.34.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 04:34:46 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jul 2021 12:34:39 +0100 Message-Id: <20210701113442.111718-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701113442.111718-1-naush@raspberrypi.com> References: <20210701113442.111718-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/4] ipa: raspberrypi: Allow long exposure modes for imx477. X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Update the imx477 CamHelper to use long exposure modes if needed. This is done by overloading the CamHelper::GetVBlanking function to return a frame length (and vblank value) computed using a scaling factor when the value would be larger than what the sensor register could otherwise hold. CamHelperImx477::Prepare is also overloaded to ensure that the "device.status" metadata returns the right value if the long exposure scaling factor is used. The scaling factor is unfortunately not returned back in metadata. With the current imx477 driver, we can achieve a maximum exposure time of approx 127 seconds since the HBLANK control is read-only. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/raspberrypi/cam_helper_imx477.cpp | 69 +++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp index 4098fde6f322..139cc7dbd39a 100644 --- a/src/ipa/raspberrypi/cam_helper_imx477.cpp +++ b/src/ipa/raspberrypi/cam_helper_imx477.cpp @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -14,6 +15,7 @@ #include "md_parser.hpp" using namespace RPiController; +using libcamera::utils::Duration; /* * We care about two gain registers and a pair of exposure registers. Their @@ -31,6 +33,9 @@ public: CamHelperImx477(); uint32_t GainCode(double gain) const override; double Gain(uint32_t gain_code) const override; + void Prepare(libcamera::Span buffer, Metadata &metadata) override; + uint32_t GetVBlanking(Duration &exposure, Duration minFrameDuration, + Duration maxFrameDuration) const override; void GetDelays(int &exposure_delay, int &gain_delay, int &vblank_delay) const override; bool SensorEmbeddedDataPresent() const override; @@ -41,6 +46,10 @@ private: * in units of lines. */ static constexpr int frameIntegrationDiff = 22; + /* Maximum frame length allowable for long exposure calculations. */ + static constexpr int frameLengthMax = 0xffdc; + /* Largest long exposure scale factor given as a left shift on the frame length. */ + static constexpr int longExposureShiftMax = 7; void PopulateMetadata(const MdParser::RegisterMap ®isters, Metadata &metadata) const override; @@ -61,6 +70,66 @@ double CamHelperImx477::Gain(uint32_t gain_code) const return 1024.0 / (1024 - gain_code); } +void CamHelperImx477::Prepare(libcamera::Span buffer, Metadata &metadata) +{ + DeviceStatus deviceStatus, parsedStatus; + + /* Get the device status provided by DelayedControls */ + if (metadata.Get("device.status", deviceStatus) != 0) + return; + + /* Get the device status provided by the embedded data buffer. */ + CamHelper::parseEmbeddedData(buffer, metadata); + metadata.Get("device.status", parsedStatus); + + /* + * If the ratio of DelayedControls to embedded data shutter speed is > 1 + * and is a factor of 2^N, then we can assume this is a long exposure mode + * frame. Since embedded data does not provide any hints of long exposure + * modes, make sure we use the DelayedControls values in the metadata. + * Otherwise, just go with the embedded data values. + */ + unsigned long ratio = std::lround(deviceStatus.shutter_speed / parsedStatus.shutter_speed); + bool replace = (ratio > 1) && ((ratio & (~ratio + 1)) == ratio); + + if (replace) + metadata.Set("device.status", deviceStatus); +} + +uint32_t CamHelperImx477::GetVBlanking(Duration &exposure, + Duration minFrameDuration, + Duration maxFrameDuration) const +{ + uint32_t frameLength, exposureLines; + unsigned int shift = 0; + + frameLength = mode_.height + CamHelper::GetVBlanking(exposure, minFrameDuration, + maxFrameDuration); + /* + * Check if the frame length calculated needs to be setup for long + * exposure mode. This will require us to use a long exposure scale + * factor provided by a shift operation in the sensor. + */ + while (frameLength > frameLengthMax) { + if (++shift > longExposureShiftMax) { + shift = longExposureShiftMax; + frameLength = frameLengthMax; + break; + } + frameLength >>= 1; + } + + if (shift) { + /* Account for any rounding in the scaled frame length value. */ + frameLength <<= shift; + exposureLines = CamHelper::ExposureLines(exposure); + exposureLines = std::min(exposureLines, frameLength - frameIntegrationDiff); + exposure = CamHelper::Exposure(exposureLines); + } + + return frameLength - mode_.height; +} + void CamHelperImx477::GetDelays(int &exposure_delay, int &gain_delay, int &vblank_delay) const { From patchwork Thu Jul 1 11:34:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12757 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 12F8BC3220 for ; Thu, 1 Jul 2021 11:34:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C253D684FA; Thu, 1 Jul 2021 13:34:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Q9RMvj6J"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 79B3E684D7 for ; Thu, 1 Jul 2021 13:34:48 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id p8so7814556wrr.1 for ; Thu, 01 Jul 2021 04:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/YpVJmsa5egcjdYPoaMhnVTpbUvYaQTLQzwcDmDF1BE=; b=Q9RMvj6JZTKIdCEh5OcMrpW+3Cgsn04MbUMFSWUwLeJMShacMc0ihO/eyI/LVeGcmd 4NGt6azVUApbNHOVZE71hEQOPv6pMfvsHf8gmBRi+nDS0MLGmlhsbehh9uw6HhVdIhrh IlOgrRob/NbCPW3E+2wrC9zdUDmWIid7Cuvep53iJd/443PSRoRPE6W23PLo8bdqu47D xqfnI0qHR1JTPcHRNMnPJMuTUbRe/stFy0QUSB1yPG/lRA5AO2SsYoph1KloSllXbQmH qwmeUy3xabKST/luqH9KRAJm6GoOg+ykPxaA2UZjPenlJnd1ZKCGZkc493Aocd7GaTfn UOzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/YpVJmsa5egcjdYPoaMhnVTpbUvYaQTLQzwcDmDF1BE=; b=kA7nsEuKj+dNOdhWRDXleDeJIE4y3bUmSRAz+PLG4pz3NdYBMwZAS5IIUB1P4Hf7Ia MjMOnvuaxkNuiB7JZ56V1mmvoT/9Iw3Vl8Zfb1zH6j6qL3uJ1eTZ98Jff7k6UMG2VtGH N7Tkw+KxD/rc+0oSQmRqYDhSPIl7udKkTbZFIU9aUIwRi392DtY9jWxUxNNKl72rgw3x oQdj0+jZp7uMQrNt1IItPy5XdEEvyFUPDDtsM1/ZPiKmS3ziC/0XAKXZ5+rHl4fqj64y RJwSI+v98M8oAFlbSxHZCfmGD38B9PdFUSFNHP8nVZpdZus5WRmO+Nw4rwsgHQO27aHV yngg== X-Gm-Message-State: AOAM531GrHmI+cQjkxWTuRHhOyYFktieswN7U5A3CDRmjzZqtQaNsQ7G q6RMgPqN5/T58N8M32kW10+iHQE+bmjsRA== X-Google-Smtp-Source: ABdhPJxDD8nmRHN8drwdkmamR9lWyS5iN2L2uk65pY0e8vFZhZ1vHgU2sLBZtgB00r1OidvQW6i7Dg== X-Received: by 2002:adf:8b9c:: with SMTP id o28mr6969395wra.33.1625139288032; Thu, 01 Jul 2021 04:34:48 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id f6sm8076495wrs.13.2021.07.01.04.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 04:34:47 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jul 2021 12:34:40 +0100 Message-Id: <20210701113442.111718-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701113442.111718-1-naush@raspberrypi.com> References: <20210701113442.111718-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/4] pipeline: raspberrypi: Use priority write for vblank when writing sensor ctrls X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When directly writing controls to the sensor device, ensure that VBLANK is written ahead of and before the EXPOSURE control. This is the same priority write mechanism used in DelayedControls. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- .../pipeline/raspberrypi/raspberrypi.cpp | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 082eb1ee1c23..53a30cff1864 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -154,6 +154,7 @@ public: void embeddedComplete(uint32_t bufferId); void setIspControls(const ControlList &controls); void setDelayedControls(const ControlList &controls); + void setSensorControls(ControlList &controls); /* bufferComplete signal handlers. */ void unicamBufferDequeue(FrameBuffer *buffer); @@ -828,7 +829,7 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) /* Apply any gain/exposure settings that the IPA may have passed back. */ if (!startConfig.controls.empty()) - data->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls); + data->setSensorControls(startConfig.controls); /* Configure the number of dropped frames required on startup. */ data->dropFrameCount_ = startConfig.dropFrameCount; @@ -1294,22 +1295,20 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) return -EPIPE; } - if (!controls.empty()) - unicam_[Unicam::Image].dev()->setControls(&controls); - /* * Configure the H/V flip controls based on the combination of * the sensor and user transform. */ if (supportsFlips_) { - ControlList ctrls(unicam_[Unicam::Image].dev()->controls()); - ctrls.set(V4L2_CID_HFLIP, - static_cast(!!(rpiConfig->combinedTransform_ & Transform::HFlip))); - ctrls.set(V4L2_CID_VFLIP, - static_cast(!!(rpiConfig->combinedTransform_ & Transform::VFlip))); - unicam_[Unicam::Image].dev()->setControls(&ctrls); + controls.set(V4L2_CID_HFLIP, + static_cast(!!(rpiConfig->combinedTransform_ & Transform::HFlip))); + controls.set(V4L2_CID_VFLIP, + static_cast(!!(rpiConfig->combinedTransform_ & Transform::VFlip))); } + if (!controls.empty()) + setSensorControls(controls); + return 0; } @@ -1379,6 +1378,24 @@ void RPiCameraData::setDelayedControls(const ControlList &controls) handleState(); } +void RPiCameraData::setSensorControls(ControlList &controls) +{ + /* + * We need to ensure that if both VBLANK and EXPOSURE are present, the + * former must be written ahead of, and separately from EXPOSURE to avoid + * V4L2 rejecting the latter. This is identical to what DelayedControls + * does with the priority write flag. + */ + if (controls.contains(V4L2_CID_EXPOSURE) && controls.contains(V4L2_CID_VBLANK)) { + ControlList vblank_ctrl; + + vblank_ctrl.set(V4L2_CID_VBLANK, controls.get(V4L2_CID_VBLANK)); + unicam_[Unicam::Image].dev()->setControls(&vblank_ctrl); + } + + unicam_[Unicam::Image].dev()->setControls(&controls); +} + void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer) { RPi::Stream *stream = nullptr; From patchwork Thu Jul 1 11:34:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12758 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 80DACC3222 for ; Thu, 1 Jul 2021 11:34:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 29679684FE; Thu, 1 Jul 2021 13:34:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="gf0e0Dpp"; dkim-atps=neutral Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F6C76028A for ; Thu, 1 Jul 2021 13:34:49 +0200 (CEST) Received: by mail-wm1-x32a.google.com with SMTP id q18-20020a1ce9120000b02901f259f3a250so3838662wmc.2 for ; Thu, 01 Jul 2021 04:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EGeEY9yU9c9i+ew+Npb69APi1pbg1XO+XqTYcH5wxAw=; b=gf0e0DppCIn54OcrHL0FZtCpFnwWsWlM9h1jOUBYG9PBIgJXXRuaETQVP1zEuMXU7A DuLiEG76gdDawtcD9I1kOidKBqyFrvCGDepZXnjb3jSTtJLW+jphFSyc/ZH0I+ZE+p63 cY51f82RF1iMKwkU/h/zdVM0tcAFPIPzjiDR0LdEEIombu1+RJiiBQZr3q6Kxqy1w0WC EA5CIVD3QDeHAetVGGq8CU4NLMMlodAPq72e/lKwYDfqOQ6DdJcIzYg4uX5snaGF0xMO 2HNIxRoctJxJ93mDX2WrnELIzpELfvC+/7ZnbXJqIBGNTh9uMHN7jKApVaFCkQbk1gGb yOrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EGeEY9yU9c9i+ew+Npb69APi1pbg1XO+XqTYcH5wxAw=; b=OoqGOW7nlK4U3poA/oSPd+sE7HpvPSLGCWnpIU1V0kxS51bpW1XLdL1jRM4+7AHpqD fOW8i3BR0btREKhkvGDjnUWdCxHglN8ZP/1fjts0hCounX0+AWY0md/dStDEjS0ia+P9 T7npMLxTVsIYzr36GDY5kTJLbSxHpnObzvQZa8WjTZNqjvXCYAVioBMTflLXHlincy/w Xp/zUHZ7Qhn4uTjm3TxmaqACm3OOaPRaGVUsJt2HBHB8egjEx2AaY4k6gEJio+krA6ta 8JalMZrXL7xjH17u3BDe7hPi3HhhEOjvKH0/0qYe2HH9eI5Av0QdOd0JAgq7j+VaTGF1 LWlA== X-Gm-Message-State: AOAM532jRg3hGo77Kc/L/N83mW+w5p3TVwSvfS/795Y9EjR9kk1TnxB3 g8oAwu5/oxLrUZheFlybxla7tM0XIqchag== X-Google-Smtp-Source: ABdhPJwsGe/L72EUbWmM4bujIT2ebs2q99sxz1/KnBCJ5IhSUTwC2L3fmkGHBt625eO8kIOF4aKqIw== X-Received: by 2002:a1c:a797:: with SMTP id q145mr10235803wme.144.1625139288821; Thu, 01 Jul 2021 04:34:48 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id f6sm8076495wrs.13.2021.07.01.04.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 04:34:48 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jul 2021 12:34:41 +0100 Message-Id: <20210701113442.111718-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701113442.111718-1-naush@raspberrypi.com> References: <20210701113442.111718-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/4] ipa: raspberrypi: Increase the default max frame duration to 250s X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" With the recent change to allow long exposures on the imx477, the existing 100s limit was not adequate. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/raspberrypi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 4d09a84f6532..dd20c854c788 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -62,7 +62,7 @@ using utils::Duration; constexpr double DefaultAnalogueGain = 1.0; constexpr Duration DefaultExposureTime = 20.0ms; constexpr Duration defaultMinFrameDuration = 1.0s / 30.0; -constexpr Duration defaultMaxFrameDuration = 100.0s; +constexpr Duration defaultMaxFrameDuration = 250.0s; /* * Determine the minimum allowable inter-frame duration to run the controller From patchwork Thu Jul 1 11:34:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12759 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0E695C3220 for ; Thu, 1 Jul 2021 11:34:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B820684EA; Thu, 1 Jul 2021 13:34:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="g7C1M0yc"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 09C33684EA for ; Thu, 1 Jul 2021 13:34:50 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso4834249wmc.1 for ; Thu, 01 Jul 2021 04:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WkzBNnGjJ5EyXZGtKLLqJZkUqXd6Ab1czyjc/QkrYI0=; b=g7C1M0yc8Tus3qBFcLXCDcdHYo00sABrsSoSv+bcIF8I5YvreaOILn7zJNWYEjI0QW xliNPT0l9cWkRW/C/cpzKTov2W+3nuoriiZcCmtVjr52QTqaL/drqUPt9tmeCbSEQl+6 SOLvPcRyMp0Pprc2mYV4ueKkwPRlHd3sd/JCJIn4KsclRmjW7x5zou2TSAW8WD5w9YaR AUZVslkS6WIyfnJut7MweXTbDlNmW2ZrCIUW3L2ArqWgfLg/TxhRZi9xpBALM7QomjZG UtbjCxS3b6zUudv6wNmio0aEou3Ew1zmWa5ZBcIxUADMozei5M4mn5R6zheey8HW3akq ChZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WkzBNnGjJ5EyXZGtKLLqJZkUqXd6Ab1czyjc/QkrYI0=; b=VtZLwF0vs74MZZ/qPmMCkzacFwCTENPvNups6hII1zq6zMMscUnsIifeuikQrLaWr7 uW0bj3rDd4uBWXeK+Gx6t/Glxe6Vg9LRc+ftPTWTIGJZcdWJHdk2l7QtqZIPLekVQk+j aErjKRfLoZOcqtkzK2efrNitMxNV7VY5AB8YSnek8OXWXp3T4gSy2v9EuUphIHTHxml0 vLkhwgdIsE8Vs9lNwzoMjd9xcNJX2wjLHuU/yWGyqIsreavzFMS/jjQZVCJ+z8kBS6aG BrY6BGSLEIVaap8hO9uAiedcyTU83oJ0LACueHFQyyCQe+nM9m+8YhrRF1I39+dAnrDc REbA== X-Gm-Message-State: AOAM531ZR8AdfKk/uleaguaBc3XK2Agqzm+/+UZtDsUlpcP1R20jnThO sHjghMZ2Tvw7dxnuCTwJG864KP/bt5shpg== X-Google-Smtp-Source: ABdhPJyigk+yzgwWSpALqmnKV9r5tU8sMofUSytMHO82l+ighUPmcHol66gp83W4rfCS4EGOeDrd6g== X-Received: by 2002:a1c:771a:: with SMTP id t26mr10361322wmi.36.1625139289565; Thu, 01 Jul 2021 04:34:49 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id f6sm8076495wrs.13.2021.07.01.04.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 04:34:49 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 1 Jul 2021 12:34:42 +0100 Message-Id: <20210701113442.111718-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210701113442.111718-1-naush@raspberrypi.com> References: <20210701113442.111718-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] ipa: raspberrypi: Make variable names consistent X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" s/DefaultAnalogueGain/defaultAnalogueGain/ s/DefaultExposureTime/defaultExposureTime/ Change these for consistency with the other static const variables. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/raspberrypi.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index dd20c854c788..e9bd724f5eac 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -59,8 +59,8 @@ using namespace std::literals::chrono_literals; using utils::Duration; /* Configure the sensor with these values initially. */ -constexpr double DefaultAnalogueGain = 1.0; -constexpr Duration DefaultExposureTime = 20.0ms; +constexpr double defaultAnalogueGain = 1.0; +constexpr Duration defaultExposureTime = 20.0ms; constexpr Duration defaultMinFrameDuration = 1.0s / 30.0; constexpr Duration defaultMaxFrameDuration = 250.0s; @@ -390,8 +390,8 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, /* Supply initial values for gain and exposure. */ ControlList ctrls(sensorCtrls_); AgcStatus agcStatus; - agcStatus.shutter_time = DefaultExposureTime; - agcStatus.analogue_gain = DefaultAnalogueGain; + agcStatus.shutter_time = defaultExposureTime; + agcStatus.analogue_gain = defaultAnalogueGain; applyAGC(&agcStatus, ctrls); ASSERT(controls);