[v2,1/4] libcamera: controls: Populate direction field in control definitions
diff mbox series

Message ID 20241127085017.2192069-2-paul.elder@ideasonboard.com
State New
Headers show
Series
  • Add direction field to ControlId
Related show

Commit Message

Paul Elder Nov. 27, 2024, 8:50 a.m. UTC
In preparation for adding support for querying direction information
from controls, populate the corresponding field in the control ID
defintions.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
Changes in v2:
- add missing entries
- add entries for all controls, since this field should be mandatory
---
 src/libcamera/control_ids_core.yaml  | 44 ++++++++++++++++++++++++++++
 src/libcamera/control_ids_draft.yaml | 15 ++++++++++
 src/libcamera/control_ids_rpi.yaml   |  3 ++
 3 files changed, 62 insertions(+)

Patch
diff mbox series

diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml
index d45cf8e56187..7335dd6ef4fa 100644
--- a/src/libcamera/control_ids_core.yaml
+++ b/src/libcamera/control_ids_core.yaml
@@ -10,6 +10,7 @@  vendor: libcamera
 controls:
   - AeEnable:
       type: bool
+      direction: inout
       description: |
         Enable or disable the AE.
 
@@ -17,6 +18,7 @@  controls:
 
   - AeLocked:
       type: bool
+      direction: out
       description: |
         Report the lock status of a running AE algorithm.
 
@@ -31,6 +33,7 @@  controls:
   # - Better handling of custom types.
   - AeMeteringMode:
       type: int32_t
+      direction: inout
       description: |
         Specify a metering mode for the AE algorithm to use.
 
@@ -56,6 +59,7 @@  controls:
   # - Better handling of custom types.
   - AeConstraintMode:
       type: int32_t
+      direction: inout
       description: |
         Specify a constraint mode for the AE algorithm to use.
 
@@ -98,6 +102,7 @@  controls:
   # - Better handling of custom types.
   - AeExposureMode:
       type: int32_t
+      direction: inout
       description: |
         Specify an exposure mode for the AE algorithm to use.
 
@@ -120,6 +125,7 @@  controls:
 
   - ExposureValue:
       type: float
+      direction: inout
       description: |
         Specify an Exposure Value (EV) parameter.
 
@@ -134,6 +140,7 @@  controls:
 
   - ExposureTime:
       type: int32_t
+      direction: inout
       description: |
         Exposure time for the frame applied in the sensor device.
 
@@ -153,6 +160,7 @@  controls:
 
   - AnalogueGain:
       type: float
+      direction: inout
       description: |
         Analogue gain value applied in the sensor device.
 
@@ -173,6 +181,7 @@  controls:
 
   - AeFlickerMode:
       type: int32_t
+      direction: inout
       description: |
         Set the flicker avoidance mode for AGC/AEC.
 
@@ -215,6 +224,7 @@  controls:
 
   - AeFlickerPeriod:
       type: int32_t
+      direction: inout
       description: |
         Manual flicker period in microseconds.
 
@@ -235,6 +245,7 @@  controls:
 
   - AeFlickerDetected:
       type: int32_t
+      direction: out
       description: |
         Flicker period detected in microseconds.
 
@@ -257,6 +268,7 @@  controls:
 
   - Brightness:
       type: float
+      direction: inout
       description: |
         Specify a fixed brightness parameter.
 
@@ -265,6 +277,7 @@  controls:
 
   - Contrast:
       type: float
+      direction: inout
       description:  |
         Specify a fixed contrast parameter.
 
@@ -273,6 +286,7 @@  controls:
 
   - Lux:
       type: float
+      direction: out
       description: |
         Report an estimate of the current illuminance level in lux.
 
@@ -280,6 +294,7 @@  controls:
 
   - AwbEnable:
       type: bool
+      direction: inout
       description: |
         Enable or disable the AWB.
 
@@ -290,6 +305,7 @@  controls:
   # - Better handling of custom types.
   - AwbMode:
       type: int32_t
+      direction: inout
       description: |
         Specify the range of illuminants to use for the AWB algorithm.
 
@@ -323,6 +339,7 @@  controls:
 
   - AwbLocked:
       type: bool
+      direction: out
       description: |
         Report the lock status of a running AWB algorithm.
 
@@ -334,6 +351,7 @@  controls:
 
   - ColourGains:
       type: float
+      direction: inout
       description: |
         Pair of gain values for the Red and Blue colour channels, in that
         order.
@@ -345,6 +363,7 @@  controls:
 
   - ColourTemperature:
       type: int32_t
+      direction: out
       description: |
         Report the estimate of the colour temperature for the frame, in kelvin.
 
@@ -352,6 +371,7 @@  controls:
 
   - Saturation:
       type: float
+      direction: inout
       description:  |
         Specify a fixed saturation parameter.
 
@@ -360,6 +380,7 @@  controls:
 
   - SensorBlackLevels:
       type: int32_t
+      direction: out
       description: |
         Reports the sensor black levels used for processing a frame.
 
@@ -370,6 +391,7 @@  controls:
 
   - Sharpness:
       type: float
+      direction: inout
       description:  |
         Intensity of the sharpening applied to the image.
 
@@ -384,6 +406,7 @@  controls:
 
   - FocusFoM:
       type: int32_t
+      direction: out
       description: |
         Reports a Figure of Merit (FoM) to indicate how in-focus the frame is.
 
@@ -396,6 +419,7 @@  controls:
 
   - ColourCorrectionMatrix:
       type: float
+      direction: inout
       description: |
         The 3x3 matrix that converts camera RGB to sRGB within the imaging
         pipeline.
@@ -409,6 +433,7 @@  controls:
 
   - ScalerCrop:
       type: Rectangle
+      direction: inout
       description: |
         Sets the image portion that will be scaled to form the whole of
         the final output image.
@@ -424,6 +449,7 @@  controls:
 
   - DigitalGain:
       type: float
+      direction: inout
       description: |
         Digital gain value applied during the processing steps applied
         to the image as captured from the sensor.
@@ -441,6 +467,7 @@  controls:
 
   - FrameDuration:
       type: int64_t
+      direction: out
       description: |
         The instantaneous frame duration from start of frame exposure to start
         of next exposure, expressed in microseconds.
@@ -449,6 +476,7 @@  controls:
 
   - FrameDurationLimits:
       type: int64_t
+      direction: inout
       description: |
         The minimum and maximum (in that order) frame duration, expressed in
         microseconds.
@@ -485,6 +513,7 @@  controls:
 
   - SensorTemperature:
       type: float
+      direction: out
       description: |
         Temperature measure from the camera sensor in Celsius.
 
@@ -497,6 +526,7 @@  controls:
 
   - SensorTimestamp:
       type: int64_t
+      direction: out
       description: |
         The time when the first row of the image sensor active array is exposed.
 
@@ -511,6 +541,7 @@  controls:
 
   - AfMode:
       type: int32_t
+      direction: inout
       description: |
         The mode of the AF (autofocus) algorithm.
 
@@ -575,6 +606,7 @@  controls:
 
   - AfRange:
       type: int32_t
+      direction: inout
       description: |
         The range of focus distances that is scanned.
 
@@ -602,6 +634,7 @@  controls:
 
   - AfSpeed:
       type: int32_t
+      direction: inout
       description: |
         Determine whether the AF is to move the lens as quickly as possible or
         more steadily.
@@ -620,6 +653,7 @@  controls:
 
   - AfMetering:
       type: int32_t
+      direction: inout
       description: |
         The parts of the image used by the AF algorithm to measure focus.
       enum:
@@ -636,6 +670,7 @@  controls:
 
   - AfWindows:
       type: Rectangle
+      direction: inout
       description: |
         The focus windows used by the AF algorithm when AfMetering is set to
         AfMeteringWindows.
@@ -665,6 +700,7 @@  controls:
 
   - AfTrigger:
       type: int32_t
+      direction: in
       description: |
         Start an autofocus scan.
 
@@ -690,6 +726,7 @@  controls:
 
   - AfPause:
       type: int32_t
+      direction: in
       description: |
         Pause lens movements when in continuous autofocus mode.
 
@@ -734,6 +771,7 @@  controls:
 
   - LensPosition:
       type: float
+      direction: inout
       description: |
         Set and report the focus lens position.
 
@@ -768,6 +806,7 @@  controls:
 
   - AfState:
       type: int32_t
+      direction: out
       description: |
         The current state of the AF algorithm.
 
@@ -825,6 +864,7 @@  controls:
 
   - AfPauseState:
       type: int32_t
+      direction: inout
       description: |
         Report whether the autofocus is currently running, paused or pausing.
 
@@ -860,6 +900,7 @@  controls:
 
   - HdrMode:
       type: int32_t
+      direction: inout
       description: |
         Set the mode to be used for High Dynamic Range (HDR) imaging.
 
@@ -926,6 +967,7 @@  controls:
 
   - HdrChannel:
       type: int32_t
+      direction: out
       description: |
         The HDR channel used to capture the frame.
 
@@ -960,6 +1002,7 @@  controls:
 
   - Gamma:
       type: float
+      direction: inout
       description:  |
         Specify a fixed gamma value.
 
@@ -968,6 +1011,7 @@  controls:
 
   - DebugMetadataEnable:
       type: bool
+      direction: inout
       description: |
         Enable or disable the debug metadata.
 
diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml
index 1b284257f601..894d4749fb03 100644
--- a/src/libcamera/control_ids_draft.yaml
+++ b/src/libcamera/control_ids_draft.yaml
@@ -10,6 +10,7 @@  vendor: draft
 controls:
   - AePrecaptureTrigger:
       type: int32_t
+      direction: inout
       description: |
         Control for AE metering trigger. Currently identical to
         ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER.
@@ -31,6 +32,7 @@  controls:
 
   - NoiseReductionMode:
       type: int32_t
+      direction: inout
       description: |
        Control to select the noise reduction algorithm mode. Currently
        identical to ANDROID_NOISE_REDUCTION_MODE.
@@ -59,6 +61,7 @@  controls:
 
   - ColorCorrectionAberrationMode:
       type: int32_t
+      direction: out
       description: |
        Control to select the color correction aberration mode. Currently
        identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE.
@@ -79,6 +82,7 @@  controls:
 
   - AeState:
       type: int32_t
+      direction: out
       description: |
        Control to report the current AE algorithm state. Currently identical to
        ANDROID_CONTROL_AE_STATE.
@@ -108,6 +112,7 @@  controls:
 
   - AwbState:
       type: int32_t
+      direction: out
       description: |
        Control to report the current AWB algorithm state. Currently identical
        to ANDROID_CONTROL_AWB_STATE.
@@ -129,6 +134,7 @@  controls:
 
   - SensorRollingShutterSkew:
       type: int64_t
+      direction: out
       description: |
        Control to report the time between the start of exposure of the first
        row and the start of exposure of the last row. Currently identical to
@@ -136,6 +142,7 @@  controls:
 
   - LensShadingMapMode:
       type: int32_t
+      direction: out
       description: |
        Control to report if the lens shading map is available. Currently
        identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.
@@ -149,6 +156,7 @@  controls:
 
   - PipelineDepth:
       type: int32_t
+      direction: out
       description: |
         Specifies the number of pipeline stages the frame went through from when
         it was exposed to when the final completed result was available to the
@@ -163,6 +171,7 @@  controls:
 
   - MaxLatency:
       type: int32_t
+      direction: out
       description: |
         The maximum number of frames that can occur after a request (different
         than the previous) has been submitted, and before the result's state
@@ -172,6 +181,7 @@  controls:
 
   - TestPatternMode:
       type: int32_t
+      direction: out
       description: |
         Control to select the test pattern mode. Currently identical to
         ANDROID_SENSOR_TEST_PATTERN_MODE.
@@ -229,6 +239,7 @@  controls:
 
   - FaceDetectMode:
       type: int32_t
+      direction: out
       description: |
         Control to select the face detection mode used by the pipeline.
 
@@ -262,6 +273,7 @@  controls:
 
   - FaceDetectFaceRectangles:
       type: Rectangle
+      direction: out
       description: |
         Boundary rectangles of the detected faces. The number of values is
         the number of detected faces.
@@ -273,6 +285,7 @@  controls:
 
   - FaceDetectFaceScores:
       type: uint8_t
+      direction: out
       description: |
         Confidence score of each of the detected faces. The range of score is
         [0, 100]. The number of values should be the number of faces reported
@@ -285,6 +298,7 @@  controls:
 
   - FaceDetectFaceLandmarks:
       type: Point
+      direction: out
       description: |
         Array of human face landmark coordinates in format [..., left_eye_i,
         right_eye_i, mouth_i, left_eye_i+1, ...], with i = index of face. The
@@ -298,6 +312,7 @@  controls:
 
   - FaceDetectFaceIds:
       type: int32_t
+      direction: out
       description: |
         Each detected face is given a unique ID that is valid for as long as the
         face is visible to the camera device. A face that leaves the field of
diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml
index 34bbdfc863c5..7524c5d23258 100644
--- a/src/libcamera/control_ids_rpi.yaml
+++ b/src/libcamera/control_ids_rpi.yaml
@@ -9,6 +9,7 @@  vendor: rpi
 controls:
   - StatsOutputEnable:
       type: bool
+      direction: inout
       description: |
         Toggles the Raspberry Pi IPA to output the hardware generated statistics.
 
@@ -21,6 +22,7 @@  controls:
   - Bcm2835StatsOutput:
       type: uint8_t
       size: [n]
+      direction: out
       description: |
         Span of the BCM2835 ISP generated statistics for the current frame.
 
@@ -33,6 +35,7 @@  controls:
   - ScalerCrops:
       type: Rectangle
       size: [n]
+      direction: out
       description: |
         An array of rectangles, where each singular value has identical
         functionality to the ScalerCrop control. This control allows the