From patchwork Fri Sep 30 19:08:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 17475 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 68859BD16B for ; Fri, 30 Sep 2022 19:08:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 203AC6283F; Fri, 30 Sep 2022 21:08:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664564910; bh=EuH9q31nhheLGrG8SQX11sav4/CmZu0h4aKbs21g0mQ=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ZWJ3793/OIgis1KKpv4ce8z7BrPMvMRS5sTsmWNLElw9by7vXC3/Ilsk0dzQxx7eG JQU5lvsvvZ7BpBmHNqK+PDZ1fbXKm10oGL7lsu9sMdLfeBjwyO2LjHE/BLrxTfKFqj EQfup3Ibk0awwB0b4RB3yx99tfmUIND4WCVQ9sxdm84lYBqsSA96eN83nTZjZOw1jp GjBqRdC+nJITrEjsaHHf57TQ75gEpijdw3Fz61M7/CaKjy7nY7E1wfr4maCpzEPNba aqyxTsuHSEyGfoO7RcwOJpleWPX+sEIiNpxfj2jcMEAePCYSwHpsLajeBRuVjOdxd2 w19S7noqFYbxg== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5CD6761FB1 for ; Fri, 30 Sep 2022 21:08:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ik9k44op"; dkim-atps=neutral Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0508547C; Fri, 30 Sep 2022 21:08:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1664564908; bh=EuH9q31nhheLGrG8SQX11sav4/CmZu0h4aKbs21g0mQ=; h=From:To:Cc:Subject:Date:From; b=Ik9k44opsmMXiCu6Hx1S4+bm8ec83OfQ3GjNXK0cezBeuWryTrnGyNg24I7j3V+qE ihhZvOg82lWCrgZdimdg2gc6mf2LPLph746tmuD7m03c+WZ8ESQ7TrDGs5T9EQRHA3 V0wKEActoY1o+VDl3H4y61BM3VpaboSFALRuFXkw= To: libcamera devel Date: Fri, 30 Sep 2022 20:08:21 +0100 Message-Id: <20220930190821.4100474-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: ipu3: Correct context during configure() 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: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The introduction of the FCQueue in the IPU3 inadvertently introduced a bug which cleared the initialisation of the session configuration immediately after some parameters had been set. Furthermore, it cleared and never re-initialised the sensor line duration property, which was previously only set during the call to init(). Move the clearing of the contexts from the updateSessionConfiguration() call to the earliest opportunity in configure(), and immediately re-initialise the sensor parameters. Bug: https://bugs.libcamera.org/show_bug.cgi?id=151 Fixes: 85c5c47325ab ("ipa: ipu3: Use the FCQueue") Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/ipa/ipu3/ipu3.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index d1ea081d595d..7fb62c749fde 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -217,11 +217,6 @@ void IPAIPU3::updateSessionConfiguration(const ControlInfoMap &sensorControls) int32_t minGain = v4l2Gain.min().get(); int32_t maxGain = v4l2Gain.max().get(); - /* Clear the IPA context before the streaming session. */ - context_.configuration = {}; - context_.activeState = {}; - context_.frameContexts.clear(); - /* * When the AGC computes the new exposure values for a frame, it needs * to know the limits for shutter speed and analogue gain. @@ -498,6 +493,14 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, lensCtrls_ = configInfo.lensControls; + /* Clear the IPA context for the new streaming session. */ + context_.activeState = {}; + context_.configuration = {}; + context_.frameContexts.clear(); + + /* Intialise the sensor configuration */ + context_.configuration.sensor.lineDuration = sensorInfo_.lineLength * 1.0s / sensorInfo_.pixelRate; + /* * Compute the sensor V4L2 controls to be used by the algorithms and * to be set on the sensor.