From patchwork Wed Oct 21 14:36:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10162 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 4C6CBBDB13 for ; Wed, 21 Oct 2020 14:36:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0CCEC61E08; Wed, 21 Oct 2020 16:36:46 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4A03D61DC5 for ; Wed, 21 Oct 2020 16:36:44 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 8D617C0005; Wed, 21 Oct 2020 14:36:43 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:22 +0200 Message-Id: <20201021143635.22846-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 01/14] libcamera: Support draft controls and properties 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" From: Kieran Bingham Extend the control and property framework to support exposing draft controls and properties in a scoped namespace. The controls/properties themselves will retain the same ordering in the relevant enum/id maps - but the access to any draft control will require explicitly referencing through its' draft:: namespace prefix. Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Kieran Bingham [Added missing hunk in control_ids.cpp.in and changed subject] Signed-off-by: Jacopo Mondi --- include/libcamera/control_ids.h.in | 6 +++++ include/libcamera/property_ids.h.in | 6 +++++ src/libcamera/control_ids.cpp.in | 15 +++++++++++ src/libcamera/property_ids.cpp.in | 15 +++++++++++ utils/gen-controls.py | 39 +++++++++++++++++++++++------ 5 files changed, 73 insertions(+), 8 deletions(-) diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in index 95a7a7f1e260..baadca83b103 100644 --- a/include/libcamera/control_ids.h.in +++ b/include/libcamera/control_ids.h.in @@ -26,6 +26,12 @@ ${controls} extern const ControlIdMap controls; +namespace draft { + +${draft_controls} + +} /* namespace draft */ + } /* namespace controls */ } /* namespace libcamera */ diff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in index e4dea335cd3b..52646c1f78ae 100644 --- a/include/libcamera/property_ids.h.in +++ b/include/libcamera/property_ids.h.in @@ -24,6 +24,12 @@ ${ids} ${controls} +namespace draft { + +${draft_controls} + +} /* namespace draft */ + extern const ControlIdMap properties; } /* namespace properties */ diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index cba6258d68dd..056645cfbdfb 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -23,12 +23,27 @@ namespace controls { ${controls_doc} +/** + * \brief Namespace for libcamera draft controls + */ +namespace draft { + +${draft_controls_doc} + +} /* namespace draft */ + #ifndef __DOXYGEN__ /* * Keep the controls definitions hidden from doxygen as it incorrectly parses * them as functions. */ ${controls_def} + +namespace draft { + +${draft_controls_def} + +} /* namespace draft */ #endif /** diff --git a/src/libcamera/property_ids.cpp.in b/src/libcamera/property_ids.cpp.in index bfdd823f63b0..f917e3349766 100644 --- a/src/libcamera/property_ids.cpp.in +++ b/src/libcamera/property_ids.cpp.in @@ -23,12 +23,27 @@ namespace properties { ${controls_doc} +/** + * \brief Namespace for libcamera draft properties + */ +namespace draft { + +${draft_controls_doc} + +} /* namespace draft */ + #ifndef __DOXYGEN__ /* * Keep the properties definitions hidden from doxygen as it incorrectly parses * them as functions. */ ${controls_def} + +namespace draft { + +${draft_controls_def} + +} /* namespace draft */ #endif /** diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 87c3d52ada6d..93cb3885c3da 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -36,6 +36,8 @@ ${description} ctrls_doc = [] ctrls_def = [] + draft_ctrls_doc = [] + draft_ctrls_def = [] ctrls_map = [] for ctrl in controls: @@ -55,6 +57,12 @@ ${description} 'id_name': id_name, } + target_doc = ctrls_doc + target_def = ctrls_def + if ctrl.get('draft'): + target_doc = draft_ctrls_doc + target_def = draft_ctrls_def + enum = ctrl.get('enum') if enum: enum_doc = [] @@ -70,15 +78,21 @@ ${description} enum_doc = '\n *\n'.join(enum_doc) enum_doc += '\n */' - ctrls_doc.append(enum_doc) + target_doc.append(enum_doc) + + target_doc.append(doc_template.substitute(info)) + target_def.append(def_template.substitute(info)) + + if ctrl.get('draft'): + name = 'draft::' + name - ctrls_doc.append(doc_template.substitute(info)) - ctrls_def.append(def_template.substitute(info)) ctrls_map.append('\t{ ' + id_name + ', &' + name + ' },') return { 'controls_doc': '\n\n'.join(ctrls_doc), 'controls_def': '\n'.join(ctrls_def), + 'draft_controls_doc': '\n\n'.join(draft_ctrls_doc), + 'draft_controls_def': '\n\n'.join(draft_ctrls_def), 'controls_map': '\n'.join(ctrls_map), } @@ -89,6 +103,7 @@ def generate_h(controls): template = string.Template('''extern const Control<${type}> ${name};''') ctrls = [] + draft_ctrls = [] ids = [] id_value = 1 @@ -109,22 +124,30 @@ def generate_h(controls): 'type': ctrl_type, } + target_ctrls = ctrls + if ctrl.get('draft'): + target_ctrls = draft_ctrls + enum = ctrl.get('enum') if enum: - ctrls.append(enum_template_start.substitute(info)) + target_ctrls.append(enum_template_start.substitute(info)) for entry in enum: value_info = { 'name': entry['name'], 'value': entry['value'], } - ctrls.append(enum_value_template.substitute(value_info)) - ctrls.append("};") + target_ctrls.append(enum_value_template.substitute(value_info)) + target_ctrls.append("};") - ctrls.append(template.substitute(info)) + target_ctrls.append(template.substitute(info)) id_value += 1 - return {'ids': '\n'.join(ids), 'controls': '\n'.join(ctrls)} + return { + 'ids': '\n'.join(ids), + 'controls': '\n'.join(ctrls), + 'draft_controls': '\n'.join(draft_ctrls) + } def fill_template(template, data): From patchwork Wed Oct 21 14:36:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10163 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 C7700BDB13 for ; Wed, 21 Oct 2020 14:36:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9A27D61E32; Wed, 21 Oct 2020 16:36:47 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C55661DE9 for ; Wed, 21 Oct 2020 16:36:45 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 7031FC0015; Wed, 21 Oct 2020 14:36:44 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:23 +0200 Message-Id: <20201021143635.22846-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 02/14] libcamera: control_ids: Define draft controls 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" libcamera is in the process of defining its own set of controls to enable applications to control the image capture process and return information on the captured frames. To temporarily close the gap in the Android camera HAL and support all controls required in the LIMITED hardware level, define a set of Draft controls whose values are taken from their Android definition, in order to allow pipeline handlers to support Android. Acked-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/libcamera/control_ids.yaml | 257 +++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 4c415545dcae..2fca88e36635 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -284,4 +284,261 @@ controls: order in an array of 9 floating point values. size: [3x3] + + - AePrecaptureTrigger: + type: int32_t + draft: true + description: | + Control for AE metering trigger. Currently identical to + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER. + + Whether the camera device will trigger a precapture metering sequence + when it processes this request. + enum: + - name: AePrecaptureTriggerIdle + value: 0 + description: The trigger is idle. + - name: AePrecaptureTriggerStart + value: 1 + description: The pre-capture AE metering is started by the camera. + - name: AePrecaptureTriggerCancel + value: 2 + description: | + The camera will cancel any active or completed metering sequence. + The AE algorithm is reset to its initial state. + + - AfTrigger: + type: int32_t + draft: true + description: | + Control for AF trigger. Currently identical to + ANDROID_CONTROL_AF_TRIGGER. + + Whether the camera device will trigger autofocus for this request. + enum: + - name: AfTriggerIdle + value: 0 + description: The trigger is idle. + - name: AfTriggerStart + value: 1 + description: The AF routine is started by the camera. + - name: AfTriggerCancel + value: 2 + description: | + The camera will cancel any active trigger and the AF routine is + reset to its initial state. + + - NoiseReductionMode: + type: int32_t + draft: true + description: | + Control to select the noise reduction algorithm mode. Currently + identical to ANDROID_NOISE_REDUCTION_MODE. + + Mode of operation for the noise reduction algorithm. + enum: + - name: NoiseReductionModeOff + value: 0 + description: No noise reduction is applied + - name: NoiseReductionModeFast + value: 1 + description: | + Noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeHighQuality + value: 2 + description: | + High quality noise reduction at the expense of frame rate. + - name: NoiseReductionModeMinimal + value: 3 + description: | + Minimal noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeZSL + value: 4 + description: | + Noise reduction is applied at different levels to different streams. + + - ColorCorrectionAberrationMode: + type: int32_t + draft: true + description: | + Control to select the color correction aberration mode. Currently + identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE. + + Mode of operation for the chromatic aberration correction algorithm. + enum: + - name: ColorCorrectionAberrationOff + value: 0 + description: No aberration correction is applied. + - name: ColorCorrectionAberrationFast + value: 1 + description: Aberration correction will not slow down the frame rate. + - name: ColorCorrectionAberrationHighQuality + value: 2 + description: | + High quality aberration correction which might reduce the frame + rate. + + - AeState: + type: int32_t + draft: true + description: | + Control to report the current AE algorithm state. Currently identical to + ANDROID_CONTROL_AE_STATE. + + Current state of the AE algorithm. + enum: + - name: AeStateInactive + value: 0 + description: The AE algorithm is inactive. + - name: AeStateSearching + value: 1 + description: The AE algorithm has not converged yet. + - name: AeStateConverged + value: 2 + description: The AE algorithm has converged. + - name: AeStateLocked + value: 3 + description: The AE algorithm is locked. + - name: AeStateFlashRequired + value: 4 + description: The AE algorithm would need a flash for good results + - name: AeStatePrecapture + value: 5 + description: | + The AE algorithm has started a pre-capture metering session. + \sa AePrecaptureTrigger + + - AfState: + type: int32_t + draft: true + description: | + Control to report the current AF algorithm state. Currently identical to + ANDROID_CONTROL_AF_STATE. + + Current state of the AF algorithm. + enum: + - name: AfStateInactive + value: 0 + description: The AF algorithm is inactive. + - name: AfStatePassiveScan + value: 1 + description: | + AF is performing a passive scan of the scene in continuous + auto-focus mode. + - name: AfStatePassiveFocused + value: 2 + description: | + AF believes the scene is in focus, but might restart scanning. + - name: AfStateActiveScan + value: 3 + description: | + AF is performing a scan triggered by an AF trigger request. + \sa AfTrigger + - name: AfStateFocusedLock + value: 4 + description: | + AF believes has focused correctly and has locked focus. + - name: AfStateNotFocusedLock + value: 5 + description: | + AF has not been able to focus and has locked. + - name: AfStatePassiveUnfocused + value: 6 + description: | + AF has completed a passive scan without finding focus. + + - AwbState: + type: int32_t + draft: true + 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. + + - ScalerCropRegion: + type: Rectangle + draft: true + description: | + Control to report the region of the sensor that has been read-out. + Currently identical to ANDROID_SCALER_CROP_REGION. + + The area of the sensor that has been read out, defined relatively to + the active pixel array size. + + \sa properties::PixelArrayActiveAreas + + - SensorTimestamp: + type: int64_t + draft: true + description: | + Control to report the start of exposure of the first row of the captured + image. Currently identical to ANDROID_SENSOR_TIMESTAMP. + + - SensorRollingShutterSkew: + type: int64_t + draft: true + 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 + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW + + - LensShadingMapMode: + type: int32_t + draft: true + description: | + Control to report if the lens shading map is available. Currently + identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE. + enum: + - name: LensShadingMapModeOff + value: 0 + description: No lens shading map mode is available. + - name: LensShadingMapModeOn + value: 1 + description: The lens shading map mode is available. + + - SceneFlicker: + type: int32_t + draft: true + description: | + Control to report the detected scene light frequency. Currently + identical to ANDROID_STATISTICS_SCENE_FLICKER. + enum: + - name: SceneFickerOff + value: 0 + description: No flickering detected. + - name: SceneFicker50Hz + value: 1 + description: 50Hz flickering detected. + - name: SceneFicker60Hz + value: 2 + description: 60Hz flickering detected. + + - PipelineDepth: + type: int32_t + draft: true + 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 + framework. Always less than or equal to PipelineMaxDepth. Currently + identical to ANDROID_REQUEST_PIPELINE_DEPTH. + + The typical value for this control is 3 as a frame is first exposed, + captured and then processed in a single pass through the ISP. Any + additional processing step performed after the ISP pass (in example face + detection, additional format conversions etc) count as an additional + pipeline stage. ... From patchwork Wed Oct 21 14:36:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10164 X-Patchwork-Delegate: jacopo@jmondi.org 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 52359BDB13 for ; Wed, 21 Oct 2020 14:36:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC65E61E45; Wed, 21 Oct 2020 16:36:47 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC7D061DE9 for ; Wed, 21 Oct 2020 16:36:45 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 60F53C000F; Wed, 21 Oct 2020 14:36:45 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:24 +0200 Message-Id: <20201021143635.22846-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 03/14] libcamera: controls: Add supported values to ControlInfo 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" Add to the ControlInfo class a list of supported values that can be provided at construction time and retrieved through an accessor method. This is meant to support controls that have an enumerated list of supported values. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- include/libcamera/controls.h | 5 ++++- src/libcamera/controls.cpp | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 80944efc133a..d1f6d4490c35 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -267,11 +267,13 @@ class ControlInfo public: explicit ControlInfo(const ControlValue &min = 0, const ControlValue &max = 0, - const ControlValue &def = 0); + const ControlValue &def = 0, + const std::vector &values = {}); const ControlValue &min() const { return min_; } const ControlValue &max() const { return max_; } const ControlValue &def() const { return def_; } + const std::vector &values() const { return values_; } std::string toString() const; @@ -289,6 +291,7 @@ private: ControlValue min_; ControlValue max_; ControlValue def_; + std::vector values_; }; using ControlIdMap = std::unordered_map; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index dca782667d88..61feee37a1b8 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -479,15 +479,17 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen */ /** - * \brief Construct a ControlInfo with minimum and maximum range parameters + * \brief Construct a ControlInfo with parameters * \param[in] min The control minimum value * \param[in] max The control maximum value * \param[in] def The control default value + * \param[in] values The control supported values */ ControlInfo::ControlInfo(const ControlValue &min, const ControlValue &max, - const ControlValue &def) - : min_(min), max_(max), def_(def) + const ControlValue &def, + const std::vector &values) + : min_(min), max_(max), def_(def), values_(values) { } @@ -519,6 +521,20 @@ ControlInfo::ControlInfo(const ControlValue &min, * \return A ControlValue with the default value for the control */ +/** + * \fn ControlInfo::values() + * \brief Retrieve the values supported by the control + * + * For controls that support a pre-defined number of values, the enumeration of + * those is reported through a vector of ControlValue instances accessible with + * this method. + * + * If the control reports a list of supported values, setting values outside + * of the reported ones results in undefined behaviour. + * + * \return A vector of ControlValue instances with the supported values + */ + /** * \brief Provide a string representation of the ControlInfo */ From patchwork Wed Oct 21 14:36:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10165 X-Patchwork-Delegate: jacopo@jmondi.org 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 EB777BDB13 for ; Wed, 21 Oct 2020 14:36:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 886B261E26; Wed, 21 Oct 2020 16:36:48 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A665361DFC for ; Wed, 21 Oct 2020 16:36:46 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 1C00EC0015; Wed, 21 Oct 2020 14:36:45 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:25 +0200 Message-Id: <20201021143635.22846-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 04/14] libcamera: controls: Construct from values list 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" Add two constructors to the ControlInfo class that allows creating a class instance from the list of the control supported values with an optional default value. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 3 +++ src/libcamera/controls.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index d1f6d4490c35..0099b6329026 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -269,6 +269,9 @@ public: const ControlValue &max = 0, const ControlValue &def = 0, const std::vector &values = {}); + explicit ControlInfo(const std::vector &values, + const ControlValue &def); + explicit ControlInfo(const std::vector &values); const ControlValue &min() const { return min_; } const ControlValue &max() const { return max_; } diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 61feee37a1b8..389ecd5c519c 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -493,6 +493,37 @@ ControlInfo::ControlInfo(const ControlValue &min, { } +/** + * \brief Construct a ControlInfo from the list of supported values and a default + * \param[in] values The control supported values + * \param[in] def The control default value + * + * Construct a ControlInfo from a list of supported values. The ControlInfo + * minimum and maximum values are assigned to the first and last members of + * the values list respectively. + */ +ControlInfo::ControlInfo(const std::vector &values, + const ControlValue &def) + : def_(def), values_(values) +{ + min_ = values_.front(); + max_ = values_.back(); +} + +/** + * \brief Construct a ControlInfo from the list of supported values + * \param[in] values The control supported values + * + * Construct a ControlInfo from a list of supported values. The ControlInfo + * minimum and maximum values are assigned to the first and last members of + * the values list respectively. The ControlInfo default value is set to be + * equal to the minimum one. + */ +ControlInfo::ControlInfo(const std::vector &values) + : ControlInfo(values, values.front()) +{ +} + /** * \fn ControlInfo::min() * \brief Retrieve the minimum value of the control From patchwork Wed Oct 21 14:36:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10166 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 785D7BDB13 for ; Wed, 21 Oct 2020 14:36:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2415C61E4E; Wed, 21 Oct 2020 16:36:49 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F2FF861DE9 for ; Wed, 21 Oct 2020 16:36:46 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 996BEC0005; Wed, 21 Oct 2020 14:36:46 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:26 +0200 Message-Id: <20201021143635.22846-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 05/14] libcamera: controls: Rename enumerate values 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" Rename the enumeration of supported values with the suffix "Enum" in place of "Values" to prepare to re-use the suffix "Values" for the vector of Control's value introduced by the next patch. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- utils/gen-controls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 93cb3885c3da..bf681503f86a 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -24,9 +24,9 @@ def format_description(description): def generate_cpp(controls): enum_doc_start_template = string.Template('''/** - * \\enum ${name}Values + * \\enum ${name}Enum * \\brief Supported ${name} values''') - enum_doc_value_template = string.Template(''' * \\var ${name}Values::${value} + enum_doc_value_template = string.Template(''' * \\var ${name}Enum::${value} ${description}''') doc_template = string.Template('''/** * \\var ${name} @@ -98,7 +98,7 @@ ${description} def generate_h(controls): - enum_template_start = string.Template('''enum ${name}Values {''') + enum_template_start = string.Template('''enum ${name}Enum {''') enum_value_template = string.Template('''\t${name} = ${value},''') template = string.Template('''extern const Control<${type}> ${name};''') From patchwork Wed Oct 21 14:36:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10167 X-Patchwork-Delegate: jacopo@jmondi.org 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 272A4BDB13 for ; Wed, 21 Oct 2020 14:36:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0123C61E45; Wed, 21 Oct 2020 16:36:52 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B2F8761E1E for ; Wed, 21 Oct 2020 16:36:47 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 2573AC000F; Wed, 21 Oct 2020 14:36:46 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:27 +0200 Message-Id: <20201021143635.22846-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 06/14] libcamera: controls: Generate a vector of enumerated values 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" For each Control that support enumerated values generate a vector of ControlValues which contains the full list of values. At the expense of a slight increase in memory occupation this change allows the construction of the ControlInfo associated with a Control from the values list, defaulting the minimum and maximum values reported by the ControlInfo. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/libcamera/control_ids.cpp.in | 2 ++ utils/gen-controls.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index 056645cfbdfb..ca0b5b22f899 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -6,8 +6,10 @@ * * This file is auto-generated. Do not edit. */ +#include #include +#include /** * \file control_ids.h diff --git a/utils/gen-controls.py b/utils/gen-controls.py index bf681503f86a..23aace50f666 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -100,6 +100,8 @@ ${description} def generate_h(controls): enum_template_start = string.Template('''enum ${name}Enum {''') enum_value_template = string.Template('''\t${name} = ${value},''') + enum_list_start = string.Template('''static const std::vector ${name}Values = {''') + enum_list_values = string.Template('''\tstatic_cast(${name}),''') template = string.Template('''extern const Control<${type}> ${name};''') ctrls = [] @@ -140,6 +142,14 @@ def generate_h(controls): target_ctrls.append(enum_value_template.substitute(value_info)) target_ctrls.append("};") + target_ctrls.append(enum_list_start.substitute(info)) + for entry in enum: + value_info = { + 'name': entry['name'], + } + target_ctrls.append(enum_list_values.substitute(value_info)) + target_ctrls.append("};") + target_ctrls.append(template.substitute(info)) id_value += 1 From patchwork Wed Oct 21 14:36:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10168 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 8500DC3D3D for ; Wed, 21 Oct 2020 14:36:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4710061E76; Wed, 21 Oct 2020 16:36:52 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6970861E2A for ; Wed, 21 Oct 2020 16:36:48 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id D2A0FC0007; Wed, 21 Oct 2020 14:36:47 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:28 +0200 Message-Id: <20201021143635.22846-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 07/14] ipa: raspberry: Initialize ControlInfo with values list 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" Initialize the ControlInfoMap of controls supported by the Raspberry pipeline handler and IPA using the list of the enumerated values instead of specifying them manually. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Naushir Patuck --- include/libcamera/ipa/raspberrypi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index b23baf2f1330..4ca1528ad097 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -50,13 +50,13 @@ static const ControlInfoMap Controls = { { &controls::AeEnable, ControlInfo(false, true) }, { &controls::ExposureTime, ControlInfo(0, 999999) }, { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, - { &controls::AeMeteringMode, ControlInfo(0, static_cast(controls::MeteringModeMax)) }, - { &controls::AeConstraintMode, ControlInfo(0, static_cast(controls::ConstraintModeMax)) }, - { &controls::AeExposureMode, ControlInfo(0, static_cast(controls::ExposureModeMax)) }, + { &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) }, + { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) }, + { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, { &controls::AwbEnable, ControlInfo(false, true) }, { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, - { &controls::AwbMode, ControlInfo(0, static_cast(controls::AwbModeMax)) }, + { &controls::AwbMode, ControlInfo(controls::AwbModeValues) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, From patchwork Wed Oct 21 14:36:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10169 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 1A51CBDB13 for ; Wed, 21 Oct 2020 14:36:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D5FD161E0D; Wed, 21 Oct 2020 16:36:52 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2887361E57 for ; Wed, 21 Oct 2020 16:36:49 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 926D2C0015; Wed, 21 Oct 2020 14:36:48 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:29 +0200 Message-Id: <20201021143635.22846-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 08/14] libcamera: control_ids: Remove max values in enumerations 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" The libcamera control definition schema includes a placeholder maximum value for each enumeration of supported values. As it is now possible to create ControlInfo from the list of enumerated values, it is not necessary to generate the placeholder value anymore. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 2fca88e36635..637fbace152e 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -48,9 +48,6 @@ controls: - name: MeteringCustom value: 3 description: Custom metering mode. - - name: MeteringModeMax - value: 3 - description: Maximum allowed value (place any new values above here). # AeConstraintMode needs further attention: # - Auto-generate max enum value. @@ -85,9 +82,6 @@ controls: - name: ConstraintCustom value: 3 description: Custom constraint mode. - - name: ConstraintModeMax - value: 3 - description: Maximum allowed value (place any new values above here). # AeExposureMode needs further attention: # - Auto-generate max enum value. @@ -112,9 +106,6 @@ controls: - name: ExposureCustom value: 3 description: Custom exposure mode. - - name: ExposureModeMax - value: 3 - description: Maximum allowed value (place any new values above here). - ExposureValue: type: float @@ -204,9 +195,6 @@ controls: - name: AwbCustom value: 7 description: Custom AWB mode. - - name: AwbModeMax - value: 7 - description: Maximum allowed value (place any new values above here). - AwbLocked: type: bool From patchwork Wed Oct 21 14:36:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10170 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 7D3B7BDB13 for ; Wed, 21 Oct 2020 14:36:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 588E161E6F; Wed, 21 Oct 2020 16:36:55 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D766261E5A for ; Wed, 21 Oct 2020 16:36:49 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 4AE75C0007; Wed, 21 Oct 2020 14:36:49 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:30 +0200 Message-Id: <20201021143635.22846-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 09/14] libcamera: ipu3: Register camera controls 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" Register controls for the IPU3 pipeline handler. The only supported Camera control is currently the pipeline depth control. Report the minimum and maximum values the pipeline handler supports for the pipeline processing stages. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index af47739d8d4f..a90683ea523a 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -40,6 +41,10 @@ static constexpr unsigned int IMGU_OUTPUT_HEIGHT_ALIGN = 4; static constexpr unsigned int IMGU_OUTPUT_WIDTH_MARGIN = 64; static constexpr unsigned int IMGU_OUTPUT_HEIGHT_MARGIN = 32; +static const ControlInfoMap IPU3Controls = { + { &controls::draft::PipelineDepth, ControlInfo(2, 3) }, +}; + class IPU3CameraData : public CameraData { public: @@ -771,6 +776,9 @@ int PipelineHandlerIPU3::registerCameras() /* Initialize the camera properties. */ data->properties_ = cio2->sensor()->properties(); + /* Initialze the camera controls. */ + data->controlInfo_ = IPU3Controls; + /** * \todo Dynamically assign ImgU and output devices to each * stream and camera; as of now, limit support to two cameras From patchwork Wed Oct 21 14:36:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10171 X-Patchwork-Delegate: jacopo@jmondi.org 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 A4EBDC3D3D for ; Wed, 21 Oct 2020 14:36:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7954761E7E; Wed, 21 Oct 2020 16:36:55 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C308B61DF5 for ; Wed, 21 Oct 2020 16:36:50 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 0C11AC0007; Wed, 21 Oct 2020 14:36:49 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:31 +0200 Message-Id: <20201021143635.22846-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 10/14] libcamera: ipu3: Report pipeline depth 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" Report for each request the pipeline depth describing the number of processing steps the frames went through. Acked-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index a90683ea523a..5a6ee1a83e45 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -841,6 +841,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) return; /* Mark the request as complete. */ + request->metadata().set(controls::draft::PipelineDepth, 3); pipe_->completeRequest(camera_, request); } @@ -866,6 +867,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) if (request->findBuffer(&rawStream_)) { bool isComplete = pipe_->completeBuffer(camera_, request, buffer); if (isComplete) { + request->metadata().set(controls::draft::PipelineDepth, 2); pipe_->completeRequest(camera_, request); return; } From patchwork Wed Oct 21 14:36:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10172 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 2DE0ABDB13 for ; Wed, 21 Oct 2020 14:36:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9D33161E88; Wed, 21 Oct 2020 16:36:55 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 722D461DF5 for ; Wed, 21 Oct 2020 16:36:51 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id E5574C000F; Wed, 21 Oct 2020 14:36:50 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:32 +0200 Message-Id: <20201021143635.22846-12-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 11/14] android: camera_device: Report PIPELINE_MAX_DEPTH 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" Register the ANDROID_REQUEST_PIPELINE_MAX_DEPTH static property inspecting the value reported by the pipeline handler. If the Camera does not report any suitable value, default the static property to 2. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index e9404c2f3004..8166b09bb69a 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -591,6 +592,8 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() return nullptr; } + const ControlInfoMap &controlsInfo = camera_->controls(); + /* Color correction static metadata. */ std::vector aberrationModes = { ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, @@ -882,9 +885,15 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &partialResultCount, 1); - uint8_t maxPipelineDepth = 2; - staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, - &maxPipelineDepth, 1); + { + /* Default the value to 2 if not reported by the camera. */ + uint8_t maxPipelineDepth = 2; + const auto &infoMap = controlsInfo.find(&controls::draft::PipelineDepth); + if (infoMap != controlsInfo.end()) + maxPipelineDepth = infoMap->second.max().get(); + staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + &maxPipelineDepth, 1); + } /* LIMITED does not support reprocessing. */ uint32_t maxNumInputStreams = 0; From patchwork Wed Oct 21 14:36:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10173 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 6B6B3C3D3E for ; Wed, 21 Oct 2020 14:36:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BE58761E8C; Wed, 21 Oct 2020 16:36:55 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A40D61E32 for ; Wed, 21 Oct 2020 16:36:52 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 9B77BC000B; Wed, 21 Oct 2020 14:36:51 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:33 +0200 Message-Id: <20201021143635.22846-13-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 12/14] android: camera_device: Handle NOISE_REDUCTION_MODES 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" Register the ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES static metadata property inspecting the values retuned by the pipeline handler. Reserve in the static metadata pack enough space to support all the 5 available noise reduction modes Android defines. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 8166b09bb69a..a4d9e6ddc519 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -553,7 +553,7 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * Currently: 51 entries, 687 bytes of static metadata */ uint32_t numEntries = 51; - uint32_t byteSize = 687; + uint32_t byteSize = 691; /* * Calculate space occupation in bytes for dynamically built metadata @@ -830,9 +830,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() &minFocusDistance, 1); /* Noise reduction modes. */ - uint8_t noiseReductionModes = ANDROID_NOISE_REDUCTION_MODE_OFF; - staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, - &noiseReductionModes, 1); + { + std::vector data(5); + const auto &infoMap = controlsInfo.find(&controls::draft::NoiseReductionMode); + if (infoMap != controlsInfo.end()) { + for (const auto &value : infoMap->second.values()) + data.push_back(value.get()); + } else { + data.push_back(ANDROID_NOISE_REDUCTION_MODE_OFF); + } + staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + data.data(), data.size()); + } /* Scaler static metadata. */ float maxDigitalZoom = 1; From patchwork Wed Oct 21 14:36:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10174 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 C60E3C3D3D for ; Wed, 21 Oct 2020 14:36:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2345561E5A; Wed, 21 Oct 2020 16:36:56 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 01DA261E2A for ; Wed, 21 Oct 2020 16:36:53 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 5ECC1C0005; Wed, 21 Oct 2020 14:36:52 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:34 +0200 Message-Id: <20201021143635.22846-14-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 13/14] android: camera_device: Handle COLOR_CORRECTION_ABERRATION_MODE 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" Register the ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES static metadata property inspecting the values retuned by the pipeline handler. Reserve in the static metadata pack enough space to support all the 3 available color correction aberration modes Android defines. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index a4d9e6ddc519..af26ebce29bb 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -553,7 +553,7 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * Currently: 51 entries, 687 bytes of static metadata */ uint32_t numEntries = 51; - uint32_t byteSize = 691; + uint32_t byteSize = 693; /* * Calculate space occupation in bytes for dynamically built metadata @@ -595,12 +595,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() const ControlInfoMap &controlsInfo = camera_->controls(); /* Color correction static metadata. */ - std::vector aberrationModes = { - ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, - }; - staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, - aberrationModes.data(), - aberrationModes.size()); + { + std::vector data(3); + const auto &infoMap = controlsInfo.find(&controls::draft::ColorCorrectionAberrationMode); + if (infoMap != controlsInfo.end()) { + for (const auto &value : infoMap->second.values()) + data.push_back(value.get()); + } else { + data.push_back(ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF); + } + staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + data.data(), data.size()); + } /* Control static metadata. */ std::vector aeAvailableAntiBandingModes = { From patchwork Wed Oct 21 14:36:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10175 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 08E85C3D3F for ; Wed, 21 Oct 2020 14:36:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A1B6761E90; Wed, 21 Oct 2020 16:36:56 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B2D1261DF5 for ; Wed, 21 Oct 2020 16:36:53 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 27838C000B; Wed, 21 Oct 2020 14:36:52 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 16:36:35 +0200 Message-Id: <20201021143635.22846-15-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021143635.22846-1-jacopo@jmondi.org> References: <20201021143635.22846-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 14/14] android: camera_device: Handle LENS_SHADING_MAP_MODES 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" Register the ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES static metadata property inspecting the values retuned by the pipeline handler. Add one entry and reserve in static metadata pack enough space to support all the 2 available lens shading map modes Android defines. Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index af26ebce29bb..9ec296939122 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -552,8 +552,8 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * \todo Keep this in sync with the actual number of entries. * Currently: 51 entries, 687 bytes of static metadata */ - uint32_t numEntries = 51; - uint32_t byteSize = 693; + uint32_t numEntries = 52; + uint32_t byteSize = 694; /* * Calculate space occupation in bytes for dynamically built metadata @@ -781,6 +781,19 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, &maxFaceCount, 1); + { + std::vector data(2); + const auto &infoMap = controlsInfo.find(&controls::draft::LensShadingMapMode); + if (infoMap != controlsInfo.end()) { + for (const auto &value : infoMap->second.values()) + data.push_back(value.get()); + } else { + data.push_back(ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF); + } + staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + data.data(), data.size()); + } + /* Sync static metadata. */ int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN; staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, &maxLatency, 1);