From patchwork Mon Jun 14 10:00:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12587 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 0A553BD78E for ; Mon, 14 Jun 2021 10:00:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A590A68938; Mon, 14 Jun 2021 12:00:48 +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="gW00TOjr"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A3A16029D for ; Mon, 14 Jun 2021 12:00:47 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso12599335wmh.4 for ; Mon, 14 Jun 2021 03:00: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=ZX/Hvx+4FWa/VdRkJFtOz6i8I4UWBAZ7YoGZTOfMBsM=; b=gW00TOjrhyBdhV0ly2cTJ0hjYqRmaXaI9A+xRePwFWjwHITSnGvK8KMheWUuTHADip WkD++bzwKiGPApzXBUUrpxXJS58KBJiMDZL+40ihU53sOuzz3oyxIgmRg+Da7NLlfu5D 59mQxs9eKkvZ+mxemMJRXTM4jIJEoel12Z2Jki//Wsr73LDw9wyduV4bpsC+U7ZgRp7A PyhdvTG37SUgEuRjX27bP4qlNL0kd14bEcKzGHKXBbnkW0V5CsttAGdmMBIgJYhqKey8 fShm+unV/PCoNhjZRnDQNWUWGoeUGCAGx2DgQ3/reh3BH19Lb8NuqC145aSB6bdlxcGM N6YQ== 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=ZX/Hvx+4FWa/VdRkJFtOz6i8I4UWBAZ7YoGZTOfMBsM=; b=YgTfDGC8kiPIKxvYRZVHIcNx6QH0N1J8/r/KSO4K4r4ks+P307E6rRTzTdgeow7yf7 vsCY/V0PC4NOkcSi4VfgajG4yj2PHao+wDrL32TP8QGX1wtQw+WYVQM2WiE+8ZpvtxiQ LXOttwpnUOwzdwf7lZCVoGWMq2eti+na9zX6U9oO/qv6tocwMBsVSZKAcR4fKViluMmO zy8KHuWzgifsckOHlvWbyDShT0qw2k6Ca0NtmZY8KWVF+kqCAhNEg4H17pj1al3jCgrX +tGJP0OMG9GP4NTj8VAI059QyfyuWuR2N8ULbfcvcFk8ekxvC9P8kjObS5AeyJbwj6SG Zc0A== X-Gm-Message-State: AOAM532ZmGox+wgdg94+1ZjE7FNFXFJSNqv2YuPE8RL226TCkEtmj6Wh TH0XzOWssYJl8irHRDMAD8r9tKP5BzP5Qg== X-Google-Smtp-Source: ABdhPJw/6UabzHEAqSc0U9GTDhWRwKWrosbrTyeUBCtWOehBpkA4qlJkcIajF2qLZIOYYacZkKw1tA== X-Received: by 2002:a1c:41c5:: with SMTP id o188mr31506780wma.60.1623664846511; Mon, 14 Jun 2021 03:00:46 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:fd93:d554:2dff:83ca]) by smtp.gmail.com with ESMTPSA id 89sm16235959wrq.14.2021.06.14.03.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 03:00:46 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Jun 2021 11:00:37 +0100 Message-Id: <20210614100040.3054433-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614100040.3054433-1-naush@raspberrypi.com> References: <20210614100040.3054433-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 use. 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 | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/ipa/raspberrypi/cam_helper_imx477.cpp b/src/ipa/raspberrypi/cam_helper_imx477.cpp index 7a1100c25afc..549c2620765a 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 @@ -30,6 +32,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; @@ -40,6 +45,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; MdParserSmia imx477_parser; @@ -72,6 +81,64 @@ 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; + } + + /* 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 Mon Jun 14 10:00:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12588 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 0AB01BD78E for ; Mon, 14 Jun 2021 10:00:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 67A7D6893A; Mon, 14 Jun 2021 12:00: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="LPs5gVWl"; 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 87E1D6029D for ; Mon, 14 Jun 2021 12:00:47 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id m3so6540986wms.4 for ; Mon, 14 Jun 2021 03:00: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=XOTzI+LHz/v5CJrTrK8WL78atBQ6sIBz/zqpsVLy2h4=; b=LPs5gVWlHAo3iJDVUmMETvJ4cfCtuEIJ8hRjDZTx2QlyQCYB+8IcQPEIBA01+9fydB TEp5fM5H6R8U1IJ9qSNYJkVkL68bw+ylkJvKEhET9OO4GEpFJ81c1o0haT2Qjn/TjJC4 SYugBSDasLUGvi+Lx+UEsAhLxToWHITPSDDvgDdR226P41sCRKk6/7ffWQhQsqMPstUS D088ZOHR0qVrToYQGd94w542PUONlRfHoPV8d01UZLzONATTk4PwgBhtjVfVH20eSxk7 E3hqIqViTbOU0anAo5Ne55XAe2ZO7zdNEqk31HY49uwTcqcuidJJSkUZkOAcxULmPmnI S8oQ== 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=XOTzI+LHz/v5CJrTrK8WL78atBQ6sIBz/zqpsVLy2h4=; b=a/Sp/qkrMdOELftoLP8QCtWckND1eLBnz6wFziMTjM/xWAK2iRaBTDGKP57Ja5KtIx xfJkgTq62udbjXJnSho7HwUX+gvVMX3YgE/XDniUKCbBwGg9SsTGqUKXR8R9ksc+pygB KdwCr/hSSFdO++N9ucq92g+jpVGbIEzNug5NEX/1nb1agmsHvo6kUbFvqg80ELU5+BCp p8rboFJOzGJ1C/a7AKKqV6Di7+Tahnvr+h0hLN4Wvkwn0BpM2xBuY6bjc87p1YtZ94YE 70Ve+Inm0TN4YPaX/wasXus9t9EIWxomZa/UQWq5blJ83Vf/kHjtVyptkUsakbojTqPj Lsgw== X-Gm-Message-State: AOAM530b8KDHhcef9E2klgXvDtZSqqOEvS68WrJhHwjNm9HFrz6XlqlK Au2+OXA0fkYhmRSyWOh2MJtWcsmKY4QEFg== X-Google-Smtp-Source: ABdhPJzKxIzdF94Xhtk8uF8BQJRfZ4s/OdXTsMcaMTZxwgx6FZlc04aMFg70DMZizqMeea46LAp3uQ== X-Received: by 2002:a05:600c:282:: with SMTP id 2mr32255251wmk.98.1623664846986; Mon, 14 Jun 2021 03:00:46 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:fd93:d554:2dff:83ca]) by smtp.gmail.com with ESMTPSA id 89sm16235959wrq.14.2021.06.14.03.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 03:00:46 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Jun 2021 11:00:38 +0100 Message-Id: <20210614100040.3054433-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614100040.3054433-1-naush@raspberrypi.com> References: <20210614100040.3054433-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 EXPSOURE 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 887f8d0f7404..d180fc059613 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -153,6 +153,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); @@ -827,7 +828,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; @@ -1293,22 +1294,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; } @@ -1378,6 +1377,24 @@ void RPiCameraData::setDelayedControls(const ControlList &controls) handleState(); } +void RPiCameraData::setSensorControls(ControlList &controls) +{ + /* + * We need to ensure that if both VBLANK and EXPSURE 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 Mon Jun 14 10:00: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: 12589 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 993FEBD78E for ; Mon, 14 Jun 2021 10:00:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BBC43602A1; Mon, 14 Jun 2021 12:00: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="X5FDlOyS"; dkim-atps=neutral Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7D04968932 for ; Mon, 14 Jun 2021 12:00:48 +0200 (CEST) Received: by mail-wm1-x32d.google.com with SMTP id m41-20020a05600c3b29b02901b9e5d74f02so9321786wms.3 for ; Mon, 14 Jun 2021 03:00: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=Q3gdgtjEoMpV5OZkbts7EU8+H9RiDnxUkfsdg/BbYTc=; b=X5FDlOySXq5V6WsaEbkwusIL/Cmrqbbs85oc+sTqy4nJ8yejSn93mD5zHVAHytlnji R5FyMkA3d77YzDGItGCn4jb2X43PhRoo9/y0gyyaN+KFYiP3+UnYVBSjzSfElRYKvH6Y be4FgoAFJN7lqVSeOrhD/pQcM5vxX1vMhZqYmbpDumEtFkidFpdPJi5oiy8wxFXchbwv /eogxSigZYt2+YOQNrMhnXFFFiEzknfbTHQiODOWJbv8IqUiX1fvyRnlY9DBcgUyceqZ Z5mPspFKLI6fw7t8n32fV2+mcEKssunqmBFtcUoB/Px32ixSAVoh3McZ4uJrHf0pO6Xu dbGQ== 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=Q3gdgtjEoMpV5OZkbts7EU8+H9RiDnxUkfsdg/BbYTc=; b=b2aQheclyj3JSyeEZiKbKJL6eTAxLMSkpHqBWeqpJsbkEmhixva/pkJT3o4XqwOGAB 0An9IhTyFPfbxkaFd8JS5R8j4/Kb3458EywRBGB7xG8BR/hJg+SDBAS9VTpdgHg37u1j ZOD6rc/nG4D74pAIZv8pf0hQ+yCcHvkbPecO+qM8osidNDEgNgyU+15kWy5JslHKWd4b WU+To1dMllJohwnVVHHKXiKfTcie/dodHqyGWih3uAsjMxF7e+o+vMirRDgrEWZ9YyEI U6r3XOFAq9pbF3ZMs3SlX8u0Z/JUxgmf/4zXyuUIss3kqrQQ2dunsL3i6OVdqeiZbWnC toKw== X-Gm-Message-State: AOAM533Vzmf3lM7bqKQh0G2ML5airsDKgV6lWyQCsjYU1Z0yCqJ1ru4L fyJjuw27yPo+/GPx9t0Y2d/GylMiRL3mBw== X-Google-Smtp-Source: ABdhPJyeuWvW+4MCuj0+l0xG2fcJtEN3Rkoa2MT9tXZerxlFa81UH/P4FjuSf0mmadmTWuyaxlrdHA== X-Received: by 2002:a1c:65c2:: with SMTP id z185mr32170520wmb.2.1623664847790; Mon, 14 Jun 2021 03:00:47 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:fd93:d554:2dff:83ca]) by smtp.gmail.com with ESMTPSA id 89sm16235959wrq.14.2021.06.14.03.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 03:00:47 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Jun 2021 11:00:39 +0100 Message-Id: <20210614100040.3054433-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614100040.3054433-1-naush@raspberrypi.com> References: <20210614100040.3054433-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 --- 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 1c1e802a2cdc..8a8e9c0a52ab 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -61,7 +61,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 Mon Jun 14 10:00: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: 12590 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 6F4C9BD78E for ; Mon, 14 Jun 2021 10:00:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2F62868932; Mon, 14 Jun 2021 12:00: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="MMnrpBIQ"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5041768939 for ; Mon, 14 Jun 2021 12:00:49 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id g204so11760254wmf.5 for ; Mon, 14 Jun 2021 03:00: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=BbEDq3QFhNs6q2Yo/EM3SLXoECkNfP5qpJtL0OjICrc=; b=MMnrpBIQ/k5aPK2T3eRenoR7To5f4+CykiuE3yFY/hBmusAF04+it1bPtSGReoD/aP iXVSUTuz88Fnp41iwo/TXakD9Pl3FezecaM2BMXdgC94S68iCLyEkxrUquxmTh/p1Yor UGSLmwrjZp30L5fhFbJitCNSFsUkkITyS3jUpIp1433CJd75kJmWFPS61nfGQ4bk0XD2 3qXKE/jcdVUxs1cUhrWncmN6gtGXKH5CLP1pJ0B4W/uKgYCYV0V+XFzOPhld5CrQL2Vw Dh2qhTMA+/Vn8zGpawNOmN68aa9iO0sgNGF6UmgMuRuTtNFd3pmhusZOjFvcNRJfK0nr 9XHw== 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=BbEDq3QFhNs6q2Yo/EM3SLXoECkNfP5qpJtL0OjICrc=; b=VU4WVQZk4i5l84XCXpsGh37vwD+7eU4fOwrkrniwFVStnEEZ5DbLDLsQy2jhbjzqfB sLgXqIWa06pUsTYw12VO+mqlUZOwh0GWg4atsonGxEPcrAH+/8ZQ9MT1EJkYDqrSjr6c iglZXTXf4sUDHrCfw51T2jHAGe9//ypj7Yy5f49/dF2FN+YRHsqzGmiQKjc1eJWoyZVP S3g41pFDN1CRr0od6WIO6zlSr1NONVH5HSAPLytAzu46f1n19ElRAkLFRdFIQTC2pj2i f93juI9JU7r5MqVpmsVOYGFvHDCNKVQQzXUiawUFt9Gl504lGK+mIQAed7ki3jB14QVi SWdw== X-Gm-Message-State: AOAM5307hvFCM8LccMXdy/NVcpqYLPfW34YxT79UMii+NRJCGAlIB42c oDwbZqLLIdvu1i6nQd8zYwjukbtAoLql+w== X-Google-Smtp-Source: ABdhPJxR3oB/19Ug8cHU4DbV/ejq37MI/B7OmYQOGVAEftWS4nBrCAjaV/ojmz9CLaEseOqxdzi10w== X-Received: by 2002:a05:600c:3594:: with SMTP id p20mr29412156wmq.52.1623664848795; Mon, 14 Jun 2021 03:00:48 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:fd93:d554:2dff:83ca]) by smtp.gmail.com with ESMTPSA id 89sm16235959wrq.14.2021.06.14.03.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 03:00:48 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 14 Jun 2021 11:00:40 +0100 Message-Id: <20210614100040.3054433-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210614100040.3054433-1-naush@raspberrypi.com> References: <20210614100040.3054433-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 --- 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 8a8e9c0a52ab..e15d49e49645 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -58,8 +58,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; @@ -389,8 +389,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);