[{"id":32690,"web_url":"https://patchwork.libcamera.org/comment/32690/","msgid":"<kgogxkyxnrfad4rdasboznoo4ittmmpcwe5vsw336qrvv3kqe2@i4uwqvzgc4a6>","date":"2024-12-12T10:22:25","subject":"Re: [PATCH v4 1/4] libcamera: controls: Populate direction field in\n\tcontrol definitions","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Thu, Dec 12, 2024 at 02:24:35PM +0900, Paul Elder wrote:\n> In preparation for adding support for querying direction information\n> from controls, populate the corresponding field in the control ID\n> defintions.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> \n\nCheers,\nStefan\n\n> \n> ---\n> Changes in v4:\n> - fix a few direction entries\n> \n> No change in v3\n> \n> Changes in v2:\n> - add missing entries\n> - add entries for all controls, since this field shoul dbe mandatory\n> ---\n>  src/libcamera/control_ids_core.yaml  | 44 ++++++++++++++++++++++++++++\n>  src/libcamera/control_ids_draft.yaml | 15 ++++++++++\n>  src/libcamera/control_ids_rpi.yaml   |  3 ++\n>  3 files changed, 62 insertions(+)\n> \n> diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\n> index d45cf8e56187..073e0611d47c 100644\n> --- a/src/libcamera/control_ids_core.yaml\n> +++ b/src/libcamera/control_ids_core.yaml\n> @@ -10,6 +10,7 @@ vendor: libcamera\n>  controls:\n>    - AeEnable:\n>        type: bool\n> +      direction: inout\n>        description: |\n>          Enable or disable the AE.\n>  \n> @@ -17,6 +18,7 @@ controls:\n>  \n>    - AeLocked:\n>        type: bool\n> +      direction: out\n>        description: |\n>          Report the lock status of a running AE algorithm.\n>  \n> @@ -31,6 +33,7 @@ controls:\n>    # - Better handling of custom types.\n>    - AeMeteringMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Specify a metering mode for the AE algorithm to use.\n>  \n> @@ -56,6 +59,7 @@ controls:\n>    # - Better handling of custom types.\n>    - AeConstraintMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Specify a constraint mode for the AE algorithm to use.\n>  \n> @@ -98,6 +102,7 @@ controls:\n>    # - Better handling of custom types.\n>    - AeExposureMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Specify an exposure mode for the AE algorithm to use.\n>  \n> @@ -120,6 +125,7 @@ controls:\n>  \n>    - ExposureValue:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Specify an Exposure Value (EV) parameter.\n>  \n> @@ -134,6 +140,7 @@ controls:\n>  \n>    - ExposureTime:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Exposure time for the frame applied in the sensor device.\n>  \n> @@ -153,6 +160,7 @@ controls:\n>  \n>    - AnalogueGain:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Analogue gain value applied in the sensor device.\n>  \n> @@ -173,6 +181,7 @@ controls:\n>  \n>    - AeFlickerMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Set the flicker avoidance mode for AGC/AEC.\n>  \n> @@ -215,6 +224,7 @@ controls:\n>  \n>    - AeFlickerPeriod:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Manual flicker period in microseconds.\n>  \n> @@ -235,6 +245,7 @@ controls:\n>  \n>    - AeFlickerDetected:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Flicker period detected in microseconds.\n>  \n> @@ -257,6 +268,7 @@ controls:\n>  \n>    - Brightness:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Specify a fixed brightness parameter.\n>  \n> @@ -265,6 +277,7 @@ controls:\n>  \n>    - Contrast:\n>        type: float\n> +      direction: inout\n>        description:  |\n>          Specify a fixed contrast parameter.\n>  \n> @@ -273,6 +286,7 @@ controls:\n>  \n>    - Lux:\n>        type: float\n> +      direction: out\n>        description: |\n>          Report an estimate of the current illuminance level in lux.\n>  \n> @@ -280,6 +294,7 @@ controls:\n>  \n>    - AwbEnable:\n>        type: bool\n> +      direction: inout\n>        description: |\n>          Enable or disable the AWB.\n>  \n> @@ -290,6 +305,7 @@ controls:\n>    # - Better handling of custom types.\n>    - AwbMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Specify the range of illuminants to use for the AWB algorithm.\n>  \n> @@ -323,6 +339,7 @@ controls:\n>  \n>    - AwbLocked:\n>        type: bool\n> +      direction: out\n>        description: |\n>          Report the lock status of a running AWB algorithm.\n>  \n> @@ -334,6 +351,7 @@ controls:\n>  \n>    - ColourGains:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Pair of gain values for the Red and Blue colour channels, in that\n>          order.\n> @@ -345,6 +363,7 @@ controls:\n>  \n>    - ColourTemperature:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Report the estimate of the colour temperature for the frame, in kelvin.\n>  \n> @@ -352,6 +371,7 @@ controls:\n>  \n>    - Saturation:\n>        type: float\n> +      direction: inout\n>        description:  |\n>          Specify a fixed saturation parameter.\n>  \n> @@ -360,6 +380,7 @@ controls:\n>  \n>    - SensorBlackLevels:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Reports the sensor black levels used for processing a frame.\n>  \n> @@ -370,6 +391,7 @@ controls:\n>  \n>    - Sharpness:\n>        type: float\n> +      direction: inout\n>        description:  |\n>          Intensity of the sharpening applied to the image.\n>  \n> @@ -384,6 +406,7 @@ controls:\n>  \n>    - FocusFoM:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Reports a Figure of Merit (FoM) to indicate how in-focus the frame is.\n>  \n> @@ -396,6 +419,7 @@ controls:\n>  \n>    - ColourCorrectionMatrix:\n>        type: float\n> +      direction: inout\n>        description: |\n>          The 3x3 matrix that converts camera RGB to sRGB within the imaging\n>          pipeline.\n> @@ -409,6 +433,7 @@ controls:\n>  \n>    - ScalerCrop:\n>        type: Rectangle\n> +      direction: inout\n>        description: |\n>          Sets the image portion that will be scaled to form the whole of\n>          the final output image.\n> @@ -424,6 +449,7 @@ controls:\n>  \n>    - DigitalGain:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Digital gain value applied during the processing steps applied\n>          to the image as captured from the sensor.\n> @@ -441,6 +467,7 @@ controls:\n>  \n>    - FrameDuration:\n>        type: int64_t\n> +      direction: out\n>        description: |\n>          The instantaneous frame duration from start of frame exposure to start\n>          of next exposure, expressed in microseconds.\n> @@ -449,6 +476,7 @@ controls:\n>  \n>    - FrameDurationLimits:\n>        type: int64_t\n> +      direction: inout\n>        description: |\n>          The minimum and maximum (in that order) frame duration, expressed in\n>          microseconds.\n> @@ -485,6 +513,7 @@ controls:\n>  \n>    - SensorTemperature:\n>        type: float\n> +      direction: out\n>        description: |\n>          Temperature measure from the camera sensor in Celsius.\n>  \n> @@ -497,6 +526,7 @@ controls:\n>  \n>    - SensorTimestamp:\n>        type: int64_t\n> +      direction: out\n>        description: |\n>          The time when the first row of the image sensor active array is exposed.\n>  \n> @@ -511,6 +541,7 @@ controls:\n>  \n>    - AfMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          The mode of the AF (autofocus) algorithm.\n>  \n> @@ -575,6 +606,7 @@ controls:\n>  \n>    - AfRange:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          The range of focus distances that is scanned.\n>  \n> @@ -602,6 +634,7 @@ controls:\n>  \n>    - AfSpeed:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Determine whether the AF is to move the lens as quickly as possible or\n>          more steadily.\n> @@ -620,6 +653,7 @@ controls:\n>  \n>    - AfMetering:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          The parts of the image used by the AF algorithm to measure focus.\n>        enum:\n> @@ -636,6 +670,7 @@ controls:\n>  \n>    - AfWindows:\n>        type: Rectangle\n> +      direction: inout\n>        description: |\n>          The focus windows used by the AF algorithm when AfMetering is set to\n>          AfMeteringWindows.\n> @@ -665,6 +700,7 @@ controls:\n>  \n>    - AfTrigger:\n>        type: int32_t\n> +      direction: in\n>        description: |\n>          Start an autofocus scan.\n>  \n> @@ -690,6 +726,7 @@ controls:\n>  \n>    - AfPause:\n>        type: int32_t\n> +      direction: in\n>        description: |\n>          Pause lens movements when in continuous autofocus mode.\n>  \n> @@ -734,6 +771,7 @@ controls:\n>  \n>    - LensPosition:\n>        type: float\n> +      direction: inout\n>        description: |\n>          Set and report the focus lens position.\n>  \n> @@ -768,6 +806,7 @@ controls:\n>  \n>    - AfState:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          The current state of the AF algorithm.\n>  \n> @@ -825,6 +864,7 @@ controls:\n>  \n>    - AfPauseState:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Report whether the autofocus is currently running, paused or pausing.\n>  \n> @@ -860,6 +900,7 @@ controls:\n>  \n>    - HdrMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Set the mode to be used for High Dynamic Range (HDR) imaging.\n>  \n> @@ -926,6 +967,7 @@ controls:\n>  \n>    - HdrChannel:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          The HDR channel used to capture the frame.\n>  \n> @@ -960,6 +1002,7 @@ controls:\n>  \n>    - Gamma:\n>        type: float\n> +      direction: inout\n>        description:  |\n>          Specify a fixed gamma value.\n>  \n> @@ -968,6 +1011,7 @@ controls:\n>  \n>    - DebugMetadataEnable:\n>        type: bool\n> +      direction: inout\n>        description: |\n>          Enable or disable the debug metadata.\n>  \n> diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml\n> index 1b284257f601..87e4e02db482 100644\n> --- a/src/libcamera/control_ids_draft.yaml\n> +++ b/src/libcamera/control_ids_draft.yaml\n> @@ -10,6 +10,7 @@ vendor: draft\n>  controls:\n>    - AePrecaptureTrigger:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Control for AE metering trigger. Currently identical to\n>          ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER.\n> @@ -31,6 +32,7 @@ controls:\n>  \n>    - NoiseReductionMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>         Control to select the noise reduction algorithm mode. Currently\n>         identical to ANDROID_NOISE_REDUCTION_MODE.\n> @@ -59,6 +61,7 @@ controls:\n>  \n>    - ColorCorrectionAberrationMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>         Control to select the color correction aberration mode. Currently\n>         identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE.\n> @@ -79,6 +82,7 @@ controls:\n>  \n>    - AeState:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>         Control to report the current AE algorithm state. Currently identical to\n>         ANDROID_CONTROL_AE_STATE.\n> @@ -108,6 +112,7 @@ controls:\n>  \n>    - AwbState:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>         Control to report the current AWB algorithm state. Currently identical\n>         to ANDROID_CONTROL_AWB_STATE.\n> @@ -129,6 +134,7 @@ controls:\n>  \n>    - SensorRollingShutterSkew:\n>        type: int64_t\n> +      direction: out\n>        description: |\n>         Control to report the time between the start of exposure of the first\n>         row and the start of exposure of the last row. Currently identical to\n> @@ -136,6 +142,7 @@ controls:\n>  \n>    - LensShadingMapMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>         Control to report if the lens shading map is available. Currently\n>         identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE.\n> @@ -149,6 +156,7 @@ controls:\n>  \n>    - PipelineDepth:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Specifies the number of pipeline stages the frame went through from when\n>          it was exposed to when the final completed result was available to the\n> @@ -163,6 +171,7 @@ controls:\n>  \n>    - MaxLatency:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          The maximum number of frames that can occur after a request (different\n>          than the previous) has been submitted, and before the result's state\n> @@ -172,6 +181,7 @@ controls:\n>  \n>    - TestPatternMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Control to select the test pattern mode. Currently identical to\n>          ANDROID_SENSOR_TEST_PATTERN_MODE.\n> @@ -229,6 +239,7 @@ controls:\n>  \n>    - FaceDetectMode:\n>        type: int32_t\n> +      direction: inout\n>        description: |\n>          Control to select the face detection mode used by the pipeline.\n>  \n> @@ -262,6 +273,7 @@ controls:\n>  \n>    - FaceDetectFaceRectangles:\n>        type: Rectangle\n> +      direction: out\n>        description: |\n>          Boundary rectangles of the detected faces. The number of values is\n>          the number of detected faces.\n> @@ -273,6 +285,7 @@ controls:\n>  \n>    - FaceDetectFaceScores:\n>        type: uint8_t\n> +      direction: out\n>        description: |\n>          Confidence score of each of the detected faces. The range of score is\n>          [0, 100]. The number of values should be the number of faces reported\n> @@ -285,6 +298,7 @@ controls:\n>  \n>    - FaceDetectFaceLandmarks:\n>        type: Point\n> +      direction: out\n>        description: |\n>          Array of human face landmark coordinates in format [..., left_eye_i,\n>          right_eye_i, mouth_i, left_eye_i+1, ...], with i = index of face. The\n> @@ -298,6 +312,7 @@ controls:\n>  \n>    - FaceDetectFaceIds:\n>        type: int32_t\n> +      direction: out\n>        description: |\n>          Each detected face is given a unique ID that is valid for as long as the\n>          face is visible to the camera device. A face that leaves the field of\n> diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\n> index 34bbdfc863c5..7524c5d23258 100644\n> --- a/src/libcamera/control_ids_rpi.yaml\n> +++ b/src/libcamera/control_ids_rpi.yaml\n> @@ -9,6 +9,7 @@ vendor: rpi\n>  controls:\n>    - StatsOutputEnable:\n>        type: bool\n> +      direction: inout\n>        description: |\n>          Toggles the Raspberry Pi IPA to output the hardware generated statistics.\n>  \n> @@ -21,6 +22,7 @@ controls:\n>    - Bcm2835StatsOutput:\n>        type: uint8_t\n>        size: [n]\n> +      direction: out\n>        description: |\n>          Span of the BCM2835 ISP generated statistics for the current frame.\n>  \n> @@ -33,6 +35,7 @@ controls:\n>    - ScalerCrops:\n>        type: Rectangle\n>        size: [n]\n> +      direction: out\n>        description: |\n>          An array of rectangles, where each singular value has identical\n>          functionality to the ScalerCrop control. This control allows the\n> -- \n> 2.39.2\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id E0174C3260\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 12 Dec 2024 10:22:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC9C767EC3;\n\tThu, 12 Dec 2024 11:22:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D57567E6D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 12 Dec 2024 11:22:28 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:c1df:b66b:4478:b7ea])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B6647229;\n\tThu, 12 Dec 2024 11:21:54 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PPBM1Z+Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733998914;\n\tbh=38qcNsNHmcL1fnOSKfNvmRKLAQKo8kBcbTDfWixB24k=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=PPBM1Z+QyUImqZdoiB9L/1lPbQs5IifTo9lKZ767L92ZYpMLdApi1DeBujR/V8u4I\n\tYwEcHDLDkqeh0PqoOYTIpLxoEa/WAT3AoSrH5xphJ9nBB5ipSg04oC1SNNYl/HT5e5\n\tKZ5odLhkkBeNAOvyhsRKt8IdhT4i5dvWcjKAihw4=","Date":"Thu, 12 Dec 2024 11:22:25 +0100","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v4 1/4] libcamera: controls: Populate direction field in\n\tcontrol definitions","Message-ID":"<kgogxkyxnrfad4rdasboznoo4ittmmpcwe5vsw336qrvv3kqe2@i4uwqvzgc4a6>","References":"<20241212052438.1547410-1-paul.elder@ideasonboard.com>\n\t<20241212052438.1547410-2-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241212052438.1547410-2-paul.elder@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]