From patchwork Mon Sep 28 11:13:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 28387 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 5C49BBDCBC for ; Mon, 28 Sep 2026 11:14:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 800DF68A60; Mon, 28 Sep 2026 13:14:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HMIrKdX2"; 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 E764D68A43 for ; Mon, 28 Sep 2026 13:14:14 +0200 (CEST) Received: from [127.0.1.1] (chfd-03-b2-v4wan-176392-cust229.vm15.cable.virginm.net [82.19.20.230]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 78557C24; Mon, 28 Sep 2026 13:12:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1790593944; bh=U4cfUevO0l2/kVQFQunKUlycGNlMZZdci/AwnQIl26g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HMIrKdX2M0gmcRHqy10BRuaUMKKxnU+GCmWIX873vp1fU4W4WU0YjZa7XVhBnqYkP UdJGKV11RZ+POmv0PF9lDbIJVMEAl9hBNpAt8S1OsPDrhOc9b41vGAHdk7+WkeQAxX t3sq9fwy4MQS0YKzYwcjfYWUmEDgrnVz8D/giSkU= From: Daniel Scally Date: Mon, 28 Sep 2026 12:13:57 +0100 Subject: [PATCH 1/5] libcamera: controls: Expand AWB controls MIME-Version: 1.0 Message-Id: <20260928-awb-state-v1-1-9b1bb8b9e51b@ideasonboard.com> References: <20260928-awb-state-v1-0-9b1bb8b9e51b@ideasonboard.com> In-Reply-To: <20260928-awb-state-v1-0-9b1bb8b9e51b@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4320; i=dan.scally@ideasonboard.com; h=from:subject:message-id; bh=U4cfUevO0l2/kVQFQunKUlycGNlMZZdci/AwnQIl26g=; b=owEBbQKS/ZANAwAKAchJV3psRXUyAcsmYgBqukwEOocscTg18yE6ZJiRVT7raadUEVkXIZ0r+ 5YSsbpU9OeJAjMEAAEKAB0WIQQqyuwyDnZdb+mxmm/ISVd6bEV1MgUCarpMBAAKCRDISVd6bEV1 MtGED/93IvG/dOfq2lhOsmapy63Bgw7Mww/LthBeRuCi/pPCMa3wLUYkg49uM4Kgwf6KCDXlC5c EGT+LoCwm7+Gdd3+P5EB6Han9DcUbBHcAAYI1qr6jsS+jRW+BNQepLs7TpkHrRXR4y1v4XLI9w9 auPWi+WxL8cQBOovtN4BbRKnm1Heis9snVYQ6RD0l5ix+d90TQ6C5EfIEeLIA25mkqfrN7KrBdH VBCrIWDfDfIZ66gBLW7xR3WjNB4RybAyql3LZ+h7Meh09o3v+PzMqaNMqQrsrSuXj59yZuzI0gp lVlO9blu1FozSwV49PN+5TKZW2FRQSEKEA3cHNno0kkfAiF2NhmcdeBgom/HaySnUur5llozPY/ +RcEixN/ojhtIPE67MCyKb7LLBfucXijZ8sm2UWiAmnub2EL4eebWNUgG+6YEsQiW/NI7chuEzj UCvQSo97MCcSQAPVFYZCui1tSGOBBDk7ctbm8FBF9hFG/t2LcAgZVs2xJ1SB9FsIFevNAHKD1A4 l0N5HmaNsabb+r7j5gqRup32bjcv1hjn6uTN8Ebf1lhks9UrOivpVRPr/Xhty7V/Rp6rS8QpqQY OLya/jqbBaICKZmN04duudLAchyCFDnmgkJL6c05lnWz8EcsG9J/Ed1Pc4n10INa4ow/50biYDL VBI6yaoVhlu7foA== X-Developer-Key: i=dan.scally@ideasonboard.com; a=openpgp; fpr=EEC699ACA1B7CB5D31330C0BBD501C2A3546CCF6 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" Expand the AWB controls. AwbState is moved from draft to core, but the Idle state is dropped since it effectively replicates the meaning of AwbEnable == false. The AwbLocked metadata item is repurposed as a control designed to allow users to freeze the AWB state. AwbTrigger is added a mechanism for forcing a recalculation of the gains to be applied despite that nominally frozen state. Signed-off-by: Daniel Scally --- src/libcamera/control_ids_core.yaml | 44 +++++++++++++++++++++++++++++++----- src/libcamera/control_ids_draft.yaml | 22 ------------------ 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index 89991d03d79a352197c38c22c5003ab186281e24..ad35b4a7b9e4b1dd59af7b29f0ec3f87eec334e2 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -568,17 +568,49 @@ controls: value: 7 description: Custom AWB mode. - - AwbLocked: - type: bool + - AwbState: + type: int32_t direction: out description: | - Report the lock status of a running AWB algorithm. + Reports the current AWB algorithm state. Where the algorithm has + calculated colour gains that differ by more than 5% from the preceding + frame the state will be reported as Searching. Where the calculated + colour gains are within that margin the state will be reported as + Converged. Where the algorithm has been disabled via the AwbEnable + control and a re-scan has not been triggered by the AwbTrigger control + the state will be reported as Locked. + + Note that there is no concept of an "idle" state. Whether the automatic + gains are applied is controlled by the AwbEnable control, but regardless + of the state of that control the automatic calculation of gains will be + performed for every frame. + + \sa AwbLocked + \sa AwbTrigger + + enum: + - name: AwbStateSearching + value: 0 + description: The AWB algorithm has not converged yet. + - name: AwbStateConverged + value: 1 + description: The AWB algorithm has converged. + - name: AwbStateLocked + value: 2 + description: The AWB algorithm is locked. + + - AwbTrigger: + type: bool + direction: in + description: | + Trigger a re-scan of the AWB algorithm in its Locked state. This causes + the state to drop to AwbSearching until the algorithm determines that it + has converged. - If the AWB algorithm is locked the value shall be set to true, if it's - converging it shall be set to false. If the AWB algorithm is not - running the control shall not be present in the metadata control list. + If AwbEnable is set true, then this control has no effect. \sa AwbEnable + \sa AwbState - ColourGains: type: float diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml index 03309eeac34fa76eee4bb5d1c87d6467b890c9a7..17ec6d5b5ee6b84faaee6cc481a027b3b5ef4421 100644 --- a/src/libcamera/control_ids_draft.yaml +++ b/src/libcamera/control_ids_draft.yaml @@ -80,28 +80,6 @@ controls: High quality aberration correction which might reduce the frame rate. - - AwbState: - type: int32_t - direction: out - description: | - Control to report the current AWB algorithm state. Currently identical - to ANDROID_CONTROL_AWB_STATE. - - Current state of the AWB algorithm. - enum: - - name: AwbStateInactive - value: 0 - description: The AWB algorithm is inactive. - - name: AwbStateSearching - value: 1 - description: The AWB algorithm has not converged yet. - - name: AwbConverged - value: 2 - description: The AWB algorithm has converged. - - name: AwbLocked - value: 3 - description: The AWB algorithm is locked. - - SensorRollingShutterSkew: type: int64_t direction: out