From patchwork Tue Mar 23 12:27:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11661 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 CFF56C32E5 for ; Tue, 23 Mar 2021 12:27:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6F61168D73; Tue, 23 Mar 2021 13:27:53 +0100 (CET) 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="ntxIWY3i"; dkim-atps=neutral Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D3A368D63 for ; Tue, 23 Mar 2021 13:27:48 +0100 (CET) Received: by mail-ej1-x635.google.com with SMTP id e14so8560356ejz.11 for ; Tue, 23 Mar 2021 05:27: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=/lMzWKO1kPu2+n0bhmCmtBZy0p0aK+9qkfid0q6hd3E=; b=ntxIWY3iu1T0tWci61AcB08K0wl8bYzuJLuC5KHCwOdyMZSdwJdF4WSeFuoJsvo5Dn JrxVzkcwjtMBWZ02cr93EzDQEzNY0Bf6T2KQPWnOnRxD7PI/fvTOSFGZiubWxsEEdjfm BsJqKxmugSqLxNhhQBSLVvYhZe4L9kVQVN7IqTgTvx8wLTRixNgor1xPdtJAwyvyinxs wF8X0iOjRhSc55voX6eNKmyNOIGJZOnzJzutAWFF55KeF4GzD7uNvMxfylNDoMBsJBdE 2YmsAWsc1VfsbyA4MSQ07vBZBngeWJ4yMkJc1ipLRCBxP5ty1Xi418OkoX6zmXIaGG1r 0Qnw== 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=/lMzWKO1kPu2+n0bhmCmtBZy0p0aK+9qkfid0q6hd3E=; b=CiPIsHPh/oO5lmpy5Re6SIy1ru6KPfzTVbJhTQyb8J7TtsZYG7zk7ig1UVbX39WD3P ae8zvQItwt6/HFhIpyk/Kobd8Vjke/SrUnurP/Dibbu1z8/jM+akZaySUImK22RRVUxX 0LcU7G30+V5ZdAxQLTnYwC5OhdqfBuY2pHcYE85ClWfn4hIrhISV6jPQTXCRPAQ/ZID+ M5wCx26Teqks5TfjrTaPmQ3ehOm9krwEDkk6fbMcP2qVsWAQ3QNT1HB2bUoC/TlRoEPt aEhX4BQdDVx2jXpSQcWDPQci7/VPyPcLnJGMicSGe++mW+FzArfDhg9ICkJnYBOw64/4 x5eA== X-Gm-Message-State: AOAM533gXh80zC18e+jyZK8mp7JJVGxTT8rEyaNB20OKkoNAfXY4uayW 1WMb4Rbgwm63UN4twJ9iVvatHZwnERL16g== X-Google-Smtp-Source: ABdhPJyyjk17+UfqkHVkicBXIfmSAiAewY+FPJC6lKxbJyxddI/F3yI1hd4khs032ELUBeNtF9eLUw== X-Received: by 2002:a17:906:6882:: with SMTP id n2mr4676131ejr.50.1616502467615; Tue, 23 Mar 2021 05:27:47 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u13sm11082295ejy.31.2021.03.23.05.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 05:27:47 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 12:27:36 +0000 Message-Id: <20210323122739.680560-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323122739.680560-1-naush@raspberrypi.com> References: <20210323122739.680560-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/7] ipa: raspberrypi: Move the controller initialise to ipa::init() 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" The controller initialise is a one-off operation, so move it from ipa::configure() to ipa::init(). Signed-off-by: Naushir Patuck Tested-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/raspberrypi.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index a5b4b3110abf..bd20b144f520 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -67,9 +67,8 @@ class IPARPi : public ipa::RPi::IPARPiInterface { public: IPARPi() - : lastMode_({}), controller_(), controllerInit_(false), - frameCount_(0), checkCount_(0), mistrustCount_(0), - lsTable_(nullptr), firstStart_(true) + : lastMode_({}), controller_(), frameCount_(0), checkCount_(0), + mistrustCount_(0), lsTable_(nullptr), firstStart_(true) { } @@ -127,9 +126,6 @@ private: ControlInfoMap ispCtrls_; ControlList libcameraMetadata_; - /* IPA configuration. */ - std::string tuningFile_; - /* Camera sensor params. */ CameraMode mode_; CameraMode lastMode_; @@ -137,7 +133,6 @@ private: /* Raspberry Pi controller specific defines. */ std::unique_ptr helper_; RPiController::Controller controller_; - bool controllerInit_; RPiController::Metadata rpiMetadata_; /* @@ -166,8 +161,6 @@ private: int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) { - tuningFile_ = settings.configurationFile; - /* * Load the "helper" for this sensor. This tells us all the device specific stuff * that the kernel driver doesn't. We only do this the first time; we don't need @@ -193,6 +186,10 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf sensorConfig->vblankDelay = vblankDelay; sensorConfig->sensorMetadata = sensorMetadata; + /* Load the tuning file for this sensor. */ + controller_.Read(settings.configurationFile.c_str()); + controller_.Initialise(); + return 0; } @@ -372,12 +369,7 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo, /* Pass the camera mode to the CamHelper to setup algorithms. */ helper_->SetCameraMode(mode_); - if (!controllerInit_) { - /* Load the tuning file for this sensor. */ - controller_.Read(tuningFile_.c_str()); - controller_.Initialise(); - controllerInit_ = true; - + if (firstStart_) { /* Supply initial values for frame durations. */ applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);