[v1,03/11] ipa: rkisp1: controls: define control block
diff mbox series

Message ID 20251125000848.4103786-4-rui.wang@ideasonboard.com
State New
Headers show
Series
  • ipa: rkisp1: DPF refactor and tuning improvements
Related show

Commit Message

Rui Wang Nov. 25, 2025, 12:08 a.m. UTC
Reserve the next free vendor allocation for rkisp1 and add the dedicated
control_ids_rkisp1.yaml. Hook the new YAML into the Meson build so the
generated control headers expose the rkisp1 control namespace.

Signed-off-by: Rui Wang <rui.wang@ideasonboard.com>
---
 include/libcamera/meson.build         |  1 +
 src/libcamera/control_ids_rkisp1.yaml | 73 +++++++++++++++++++++++++++
 src/libcamera/control_ranges.yaml     |  4 +-
 3 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 src/libcamera/control_ids_rkisp1.yaml

Patch
diff mbox series

diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index 30ea76f9..3fd7ef94 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -39,6 +39,7 @@  controls_map = {
         'draft': 'control_ids_draft.yaml',
         'rpi/pisp': 'control_ids_rpi.yaml',
         'rpi/vc4': 'control_ids_rpi.yaml',
+        'rkisp1': 'control_ids_rkisp1.yaml',
     },
 
     'properties': {
diff --git a/src/libcamera/control_ids_rkisp1.yaml b/src/libcamera/control_ids_rkisp1.yaml
new file mode 100644
index 00000000..3e008ee4
--- /dev/null
+++ b/src/libcamera/control_ids_rkisp1.yaml
@@ -0,0 +1,73 @@ 
+# SPDX-License-Identifier: LGPL-2.1-or-later
+#
+# Copyright (C) 2025, Ideas On Board
+#
+# RkISP1 specific control definitions
+---
+# Unless otherwise stated, all controls are bi-directional, i.e. they can be
+# set through Request::controls() and returned out through Request::metadata().
+vendor: rkisp1
+controls:
+  # --- RkISP1 DPF controls ---
+  - DenoiseMode:
+      type: int32_t
+      direction: inout
+      description: |
+        Controls the operating mode of the rkisp1 denoise pipeline. This setting is
+        consumed by the DPF module and any additional denoise algorithms that honour
+        the common mode state exposed here.
+
+        In Disabled mode (default) all denoise processing stages are disabled. This
+        bypasses noise reduction and surfaces raw sensor data. Other denoise-related
+        controls are ignored in this mode.
+
+        In Auto mode each denoise algorithm selects parameters automatically from the
+        sensor tuning data and (if provided) the exposure index level table. Changes in
+        scene brightness (analogue gain / exposure index) may cause algorithms to
+        re-evaluate and reprogram hardware when an exposure index band boundary is
+        crossed.
+
+        In Manual mode the automatically selected parameters are frozen at the moment
+        the mode switch occurs (a snapshot is taken). Subsequent per-frame automatic
+        updates are disabled until the mode is set back to Auto. While in Manual mode
+        the application may modify any algorithm-specific override controls (for DPF:
+        DpfChannelStrengths, DpfGreenSpatialCoefficients, DpfRedBlueSpatialCoefficients,
+        DpfRbFilterSize, DpfNoiseLevelLookupCoefficients, DpfNoiseLevelLookupScaleMode).
+        Individual denoise modules apply changes immediately to hardware.
+
+        In Reduction mode the algorithms use predefined noise reduction settings based
+        on the active NoiseReductionMode control. This provides optimized presets for
+        different noise reduction levels (e.g., minimal, high-quality, fast) without
+        manual parameter tuning.
+
+        Transition Rules:
+          * Auto -> Manual: The current effective (auto-selected) parameters
+            are captured as the initial manual override values.
+          * Manual -> Auto: All manual override state is discarded and the
+            algorithm immediately reverts to automatic tuning selection,
+            potentially reprogramming hardware that same frame.
+          * Auto/Manual -> Reduction: Switches to using reduction mode configs
+            based on the current NoiseReductionMode setting.
+          * Reduction -> Auto/Manual: Reverts to the specified mode, discarding
+            reduction-specific state.
+
+        If the application switches to Manual but supplies no overrides,
+        the previously auto-derived parameters continue to be used unchanged.
+      enum:
+        - name: DenoiseModeDisabled
+          value: 0
+          description: |
+            Disabled mode - DPF processing is completely disabled.
+        - name: DenoiseModeAuto
+          value: 1
+          description: |
+            Automatic mode - algorithm selects parameters based on tuning data.
+        - name: DenoiseModeManual
+          value: 2
+          description: |
+            Manual mode - parameters are frozen and can be overridden.
+        - name: DenoiseModeReduction
+          value: 3
+          description: |
+            Reduction mode - uses predefined noise reduction settings from tuning data.
+...
diff --git a/src/libcamera/control_ranges.yaml b/src/libcamera/control_ranges.yaml
index 6752eb98..fc60de80 100644
--- a/src/libcamera/control_ranges.yaml
+++ b/src/libcamera/control_ranges.yaml
@@ -15,6 +15,8 @@  ranges:
   rpi: 20000
   # Controls for debug metadata
   debug: 30000
-  # Next range starts at 40000
+  # RkISP1 vendor controls
+  rkisp1: 40000
+  # Next range starts at 50000
 
 ...