[1/5] libcamera: controls: Expand AWB controls
diff mbox series

Message ID 20260928-awb-state-v1-1-9b1bb8b9e51b@ideasonboard.com
State New
Headers show
Series
  • Add AwbState metadata and AwbTrigger control
Related show

Commit Message

Dan Scally Sept. 28, 2026, 11:13 a.m. UTC
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 <dan.scally@ideasonboard.com>
---
 src/libcamera/control_ids_core.yaml  | 44 +++++++++++++++++++++++++++++++-----
 src/libcamera/control_ids_draft.yaml | 22 ------------------
 2 files changed, 38 insertions(+), 28 deletions(-)

Patch
diff mbox series

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