From patchwork Fri Oct 24 08:50:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24781 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 5F0FEC3259 for ; Fri, 24 Oct 2025 08:52:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 25CB1608D2; Fri, 24 Oct 2025 10:52:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Bm8lr0B5"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4048F6089B for ; Fri, 24 Oct 2025 10:52:22 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:7edc:62f4:c118:1549]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id A753620A4; Fri, 24 Oct 2025 10:50:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1761295836; bh=Bm7AeoHy6oUG/h9poJIAqz9bTSajkoEGA7WJM63Ko4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bm8lr0B5vL+kCEMW95vz2uxz+lQOyZ32wrhpfSq6DqyNAle+iw2WMMqizbYSDuKpZ QF4DIo7GxVhkJvNBAdA47vzBlEtD8sXOgaoHVOZtOnpP9Q1Z6UGCNwdA3I+4HmoOX2 BP5yJVT8jHTlVsDnZ10R32m8i19HMDssXBNyU8io= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 15/35] ipa: rkisp1: Set frameContext.agc in queueRequest for auto mode also Date: Fri, 24 Oct 2025 10:50:39 +0200 Message-ID: <20251024085130.995967-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251024085130.995967-1-stefan.klug@ideasonboard.com> References: <20251024085130.995967-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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" If the agc is in auto mode, exposure time and gain used to be set on the frame context within prepare(). As exposure time and gain are used by getSensorControls(0) from within start() that is too late (prepare() hasn't run yet). Also prepare() is documented as the place to initialize the params buffer, not the frame context. From the pipeline point of view, prepare() gets called immediately after queueRequest(). Therefore we can safely move setting the frame context into queueRequest() to fix the sensor controls for start(). Signed-off-by: Stefan Klug --- src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index f5a3c917cb69..c67106339ef8 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -284,9 +284,13 @@ void Agc::queueRequest(IPAContext &context, frameContext.agc.autoExposureEnabled = agc.autoExposureEnabled; frameContext.agc.autoGainEnabled = agc.autoGainEnabled; - if (!frameContext.agc.autoExposureEnabled) + if (frameContext.agc.autoExposureEnabled) + frameContext.agc.exposure = context.activeState.agc.automatic.exposure; + else frameContext.agc.exposure = agc.manual.exposure; - if (!frameContext.agc.autoGainEnabled) + if (frameContext.agc.autoGainEnabled) + frameContext.agc.gain = context.activeState.agc.automatic.gain; + else frameContext.agc.gain = agc.manual.gain; if (!frameContext.agc.autoExposureEnabled &&