From patchwork Tue Mar 23 14:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11670 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 29EB1C32E5 for ; Tue, 23 Mar 2021 14:36:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D5FAD68D80; Tue, 23 Mar 2021 15:36:24 +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="n+E7eQtY"; dkim-atps=neutral Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8349768D65 for ; Tue, 23 Mar 2021 15:36:20 +0100 (CET) Received: by mail-ed1-x52a.google.com with SMTP id x21so23712149eds.4 for ; Tue, 23 Mar 2021 07:36:20 -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=n+E7eQtYUmboT8Z61aR9leUd7Ky0h+5jiZpOaTlOj0/yDq/SQ6UezkTtV6WkzGMFTv FvaXOMT+p7MWxyar/vWZPCPe9Zv7JbDNbaGtLNMs4gHt8U9+DtJOtSqwpbBZHsao0w5x OXJ6LToeK1GbhDB2O2j6QSkgjUIEXeC5zYkyGN9c9od++22ON7X3H8hvRnI39X24MlYI 9843moZ0hYeebKjzel+D0a42RbxfPqfVuws8a0Jsgx1RUWHNCzNS9p4IZHlCWzeycwMm 2/Dk4wbeRpXrPgkU/gamOPcG1nHiXUdc77uhjiozUPLdxWL4piX9fJhTOmIr6ZeQAuj+ gBXw== 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=RV8g38QOZBGQX2hy+rh3e8PlRG//tmN01GKlj7/MWkhiiIqwdGq1GsRmjaIoHAjznR 21Bq4zV1RNDP/qu4gUfYImjg6tdB0RpIFokCBKc1KristUH+LCsqGJXBfIosS77EjZcz NDb7tbRDynhCbigdQ0VHiCPa3sFnept8qSL+C4Uej33StXJ5IH383Z0ETv+LW2T41Ynn BKjLm/9Z2gfzjGxfMM1jcNl1QxYtzrrbJ51AnTR0V6T/T01HbnAK63VF8jONW7BV9Ata AhY/IZAsXgB7kYGLhFAdJ7/42+AfvBTkxxbuqGPugDSXPg3B4CcXEhXckfu5gZinEJPH bqTA== X-Gm-Message-State: AOAM532N5WFLmw88rZAevmnIS2d+jN9IGXK/l25scorlezR+CguYXArc 0hqVTnQ6ls5AEOTImfZkePmiIF/cUJnS3g== X-Google-Smtp-Source: ABdhPJxX6vy1i7F26zqLWIR5WHW7w1EH7+LblljPxe4iDiuGqQZfng0R2D7QVhaEOE9vPCYM6CAbGA== X-Received: by 2002:a05:6402:c88:: with SMTP id cm8mr4952338edb.62.1616510179836; Tue, 23 Mar 2021 07:36:19 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id n6sm11282430eji.37.2021.03.23.07.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 07:36:19 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 14:36:07 +0000 Message-Id: <20210323143610.787760-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323143610.787760-1-naush@raspberrypi.com> References: <20210323143610.787760-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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);