From patchwork Wed Mar 25 15:13:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 26357 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 1AF4BC32F5 for ; Wed, 25 Mar 2026 15:15:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B595E62B9A; Wed, 25 Mar 2026 16:15:24 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cjkXxnQH"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ACF6628CA for ; Wed, 25 Mar 2026 16:15:23 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 522521992; Wed, 25 Mar 2026 16:14:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1774451645; bh=XoB6H/0U6tGn+weK6nvbPi46XdQqpT3ry2fV8PvjQx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjkXxnQHyghYkMXOaQXd9x7a+DbqDCqXVnUBw4WmRT1Fh0kaVLOc5TATLdliX2zkp 10UAJ1VBAE8FJ2MfSPQU/R+ShbnGfaYgHlNUDmBdm7BzpmTwa125SmGNV+iwdYnAFo WCOEZb+9e+Lz7aT6LDci0g/PChTZBH6bUGNc4mug= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 15/32] ipa: rkisp1: Set frameContext.agc in queueRequest for auto mode also Date: Wed, 25 Mar 2026 16:13:47 +0100 Message-ID: <20260325151416.2114564-16-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260325151416.2114564-1-stefan.klug@ideasonboard.com> References: <20260325151416.2114564-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 in 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 Reviewed-by: Paul Elder --- Changes in v2: - Collected tag --- 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 1ecaff680978..fd227e2129ed 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 &&