From patchwork Fri Dec 20 16:26:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22447 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 A5370C327D for ; Fri, 20 Dec 2024 16:27:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C581C684C6; Fri, 20 Dec 2024 17:27:50 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="E0rmwOPn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C4573684B0 for ; Fri, 20 Dec 2024 17:27:46 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:4eeb:7fa7:1fd0:c13d]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 04073C67; Fri, 20 Dec 2024 17:27:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1734712027; bh=rRS2641M0Mw6O+i8N9WGWcaIbAsjseHCybenQx4pQwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E0rmwOPny3Kh5NeLiBeXLSdPnqNAmF+J2hrp0Fao0yGHnJCeEyFIcBk+te/0pXa3j p90v8a7zyZSDYBmUJtGpnfpy7/YiHIswf+vmXVDvYCpXf48o6oqSk4+2f6iJXQNpta 6JIz3a5UNI6YD4TCzj06a/iTyme/PkcTACIqKR8U= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [RFC PATCH 7/7] ipa: rkisp1: Set frameContext.agc in queueRequest for auto mode also Date: Fri, 20 Dec 2024 17:26:53 +0100 Message-ID: <20241220162724.756494-8-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241220162724.756494-1-stefan.klug@ideasonboard.com> References: <20241220162724.756494-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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 40e5a8f481b2..46be1413a728 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -243,7 +243,10 @@ void Agc::queueRequest(IPAContext &context, frameContext.agc.autoEnabled = agc.autoEnabled; - if (!frameContext.agc.autoEnabled) { + if (frameContext.agc.autoEnabled) { + frameContext.agc.exposure = context.activeState.agc.automatic.exposure; + frameContext.agc.gain = context.activeState.agc.automatic.gain; + } else { frameContext.agc.exposure = agc.manual.exposure; frameContext.agc.gain = agc.manual.gain; } @@ -283,11 +286,6 @@ void Agc::queueRequest(IPAContext &context, void Agc::prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, RkISP1Params *params) { - if (frameContext.agc.autoEnabled) { - frameContext.agc.exposure = context.activeState.agc.automatic.exposure; - frameContext.agc.gain = context.activeState.agc.automatic.gain; - } - if (frame > 0 && !frameContext.agc.updateMetering) return;