From patchwork Thu Nov 12 09:20:45 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: GuyliandeJong X-Patchwork-Id: 28873 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 CD2BDC3304 for ; Thu, 12 Nov 2026 09:20:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CE39C6915B; Thu, 12 Nov 2026 10:20:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=proton.me header.i=@proton.me header.b="LyRhdfRS"; dkim-atps=neutral Received: from mail-10629.protonmail.ch (mail-10629.protonmail.ch [79.135.106.29]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C2A70690E6 for ; Thu, 12 Nov 2026 10:20:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=xlj6umfc45c5vdofhywpnjbz44.protonmail2; t=1794475247; x=1794734447; bh=buf0QjiE1117vKhifcGaE+m8c3eCAueFfxDy3Xy00Ac=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=LyRhdfRSazV/9M5iKZgdysqU6gi/AxNS1qvOJknaQVe+7HKxMOoO0pi6dwHwITi8i 45bbXhiwZ+mQom5+Of7EqckbcSGodD3D5xEmrnQ8HGY/7TmQYWtpdVkqF3G+r5dcsi eJa/Q05CiGGG1yy945AWXaD5h8/O4Zno7vFK4wWB2M+wFc6iFCA+3oi3GZiktDwOY+ QfrQqz/uKcSaesEr4N+htkIceoEFar7UFcePLjltO5GrRG3UwEGHRKWruqcRIlvjyo 3CPkS+MUwHaZ+IMF8EW1h3F+oCI321w00+exqR2PlXkuk4VfJaz/qiO+tL6uphmejC 9wzCoZ7ahtHRA== Date: Thu, 12 Nov 2026 09:20:45 +0000 To: libcamera-devel@lists.libcamera.org From: GuyliandeJong Cc: Barnabas Pocze , Afonso Figuinha Subject: [PATCH] ipa: ipu3: Don't set sensor controls from an unprepared frame context Message-ID: <20261112092031.21810-1-guyliandejong@proton.me> Feedback-ID: 112452169:user:proton X-Pm-Message-ID: c2fa04a387c32bd63cb793a18022da4412860f6a 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" IPAIPU3::start() calls setControls(0) to apply known sensor controls before the first frame. Since the AGC was ported to AgcAlgorithm, setControls() takes the exposure and gain from the frame context instead of the active state. At start() time no request has been queued yet, so frame context 0 has not been prepared and the exposure, gain and vertical blanking values are all 0. DelayedControls then writes these values to the sensor, and reports them back as the effective values two frames later. The AGC logs "Effective exposure value is 0. This is a bug in AGC and must be fixed for proper operation." for these frames. Don't set the controls in start(), as the RkISP1 IPA does. The sensor keeps its current exposure and gain until the AGC computes new values from the first statistics. Reported-by: Afonso Figuinha Fixes: 78683043e35f ("ipa: ipu3: agc: Port to `AgcAlgorithm`") Signed-off-by: GuyliandeJong --- Tested on a Surface Laptop 2 (OV9734), on top of the "ipu3: Fix support for small sensors such as the OV9734" series, as master has no OV9734 helper. Without this patch, "Effective exposure value is 0" is logged twice in each of 6 runs of cam -C10, and exposure, gain and vertical blanking 0 are written to the sensor at start. With it, 6 out of 6 runs log nothing, and the first values written are the AGC's. An alternative would be to keep setControls(0) and prepare frame context 0 from the active state in start(), but frame context 0 would then be prepared again when the first request is queued. I went with matching RkISP1, but I'm happy to change it. src/ipa/ipu3/ipu3.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index e4333539..aab11f2f 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -276,12 +276,7 @@ int IPAIPU3::init(const IPASettings &settings, */ int IPAIPU3::start() { - /* - * Set the sensors V4L2 controls before the first frame to ensure that - * we have an expected and known configuration from the start. - */ - setControls(0); - + /* \todo Properly handle startup controls. */ return 0; }