From patchwork Tue Oct 20 18:05: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: 10134 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 E79F0BDB1F for ; Tue, 20 Oct 2020 16:05:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C289161D9E; Tue, 20 Oct 2020 18:05:15 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 22A0B61D8E for ; Tue, 20 Oct 2020 18:05:14 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 3F98C240006; Tue, 20 Oct 2020 16:05:13 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:22 +0200 Message-Id: <20201020180534.36855-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 01/13] 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 Tue Oct 20 18:05: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: 10135 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 1F8B3BDB1F for ; Tue, 20 Oct 2020 16:05:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EC39B61DB2; Tue, 20 Oct 2020 18:05:16 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4602261D9E for ; Tue, 20 Oct 2020 18:05:15 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 59D0E240005; Tue, 20 Oct 2020 16:05:14 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:23 +0200 Message-Id: <20201020180534.36855-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 02/13] 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 Tue Oct 20 18:05: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: 10136 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 90E8CBDB1F for ; Tue, 20 Oct 2020 16:05:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E2C161DD5; Tue, 20 Oct 2020 18:05:19 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 056A061DAB for ; Tue, 20 Oct 2020 18:05:16 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 69B50240012; Tue, 20 Oct 2020 16:05:15 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:24 +0200 Message-Id: <20201020180534.36855-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 03/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 Tue Oct 20 18:05: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: 10137 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 1D350BDB1F for ; Tue, 20 Oct 2020 16:05:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D3AF561DC5; Tue, 20 Oct 2020 18:05:19 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 387B561DCF for ; Tue, 20 Oct 2020 18:05:17 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 507B1240011; Tue, 20 Oct 2020 16:05:15 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:25 +0200 Message-Id: <20201020180534.36855-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 04/13] 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 a constructor to the ControlInfo class that allows creating a class instance from the list of the control supported values. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 1 + src/libcamera/controls.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index d1f6d4490c35..d4fdf5807f1c 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -269,6 +269,7 @@ public: const ControlValue &max = 0, const ControlValue &def = 0, const std::vector &values = {}); + 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..e80f6116a684 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -493,6 +493,23 @@ ControlInfo::ControlInfo(const ControlValue &min, { } +/** + * \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) + : values_(values) +{ + min_ = values_.front(); + max_ = values_.back(); + def_ = min_; +} + /** * \fn ControlInfo::min() * \brief Retrieve the minimum value of the control From patchwork Tue Oct 20 18:05: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: 10138 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 9DE6DBDB20 for ; Tue, 20 Oct 2020 16:05:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3811C61DE0; Tue, 20 Oct 2020 18:05:20 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A1A2D61D8B for ; Tue, 20 Oct 2020 18:05:17 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 33CD1240012; Tue, 20 Oct 2020 16:05:17 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:26 +0200 Message-Id: <20201020180534.36855-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 05/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 93cb3885c3da..87036fe7dec1 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}Values {''') enum_value_template = string.Template('''\t${name} = ${value},''') + enum_list_start = string.Template('''static const std::vector ${name}List = {''') + 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 Tue Oct 20 18:05: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: 10139 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 022E5BDB1F for ; Tue, 20 Oct 2020 16:05:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B694F61DD9; Tue, 20 Oct 2020 18:05:21 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 694B261DD5 for ; Tue, 20 Oct 2020 18:05:18 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id E5F47240006; Tue, 20 Oct 2020 16:05:17 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:27 +0200 Message-Id: <20201020180534.36855-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 06/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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..414d757a06c6 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::AeMeteringModeList) }, + { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeList) }, + { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeList) }, { &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::AwbModeList) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, From patchwork Tue Oct 20 18:05: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: 10140 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 94A8ABDB1F for ; Tue, 20 Oct 2020 16:05:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 57AC961DE2; Tue, 20 Oct 2020 18:05:22 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1DD6961D8B for ; Tue, 20 Oct 2020 18:05:19 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id BA104240006; Tue, 20 Oct 2020 16:05:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:28 +0200 Message-Id: <20201020180534.36855-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 07/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 Tue Oct 20 18:05: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: 10141 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 B6DD9BDB1F for ; Tue, 20 Oct 2020 16:05:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8DCF061DEB; Tue, 20 Oct 2020 18:05:23 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A9A8B61DDD for ; Tue, 20 Oct 2020 18:05:19 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 4658A240009; Tue, 20 Oct 2020 16:05:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:29 +0200 Message-Id: <20201020180534.36855-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 08/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index af47739d8d4f..4cbd7ba3007b 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: @@ -770,6 +775,8 @@ 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 From patchwork Tue Oct 20 18:05: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: 10142 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 0C485BDB20 for ; Tue, 20 Oct 2020 16:05:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D327861DF3; Tue, 20 Oct 2020 18:05:23 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9ABF061DD3 for ; Tue, 20 Oct 2020 18:05:20 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id CDEAD240006; Tue, 20 Oct 2020 16:05:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:30 +0200 Message-Id: <20201020180534.36855-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 09/13] 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 4cbd7ba3007b..ce14e5083ed6 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -840,6 +840,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) return; /* Mark the request as complete. */ + request->metadata().set(controls::draft::PipelineDepth, 3); pipe_->completeRequest(camera_, request); } @@ -865,6 +866,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 Tue Oct 20 18:05: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: 10143 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 7946CBDB1F for ; Tue, 20 Oct 2020 16:05:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F68061DE0; Tue, 20 Oct 2020 18:05:24 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 67C3E61DDB for ; Tue, 20 Oct 2020 18:05:21 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id DD039240006; Tue, 20 Oct 2020 16:05:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:31 +0200 Message-Id: <20201020180534.36855-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 10/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 Tue Oct 20 18:05: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: 10144 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 C65E3BDB1F for ; Tue, 20 Oct 2020 16:05:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A0CCF61DC5; Tue, 20 Oct 2020 18:05:26 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EFD7C61DE6 for ; Tue, 20 Oct 2020 18:05:21 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 9103E240011; Tue, 20 Oct 2020 16:05:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:32 +0200 Message-Id: <20201020180534.36855-12-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 11/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 Tue Oct 20 18:05: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: 10145 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 10846BDB20 for ; Tue, 20 Oct 2020 16:05:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB47561DCD; Tue, 20 Oct 2020 18:05:26 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DC6C61DC5 for ; Tue, 20 Oct 2020 18:05:22 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 2A24F240011; Tue, 20 Oct 2020 16:05:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:33 +0200 Message-Id: <20201020180534.36855-13-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 12/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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 Tue Oct 20 18:05: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: 10146 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 67B58BDB1F for ; Tue, 20 Oct 2020 16:05:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 37A2C61D8E; Tue, 20 Oct 2020 18:05:27 +0200 (CEST) Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D44361DAB for ; Tue, 20 Oct 2020 18:05:23 +0200 (CEST) Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id D3F81240005; Tue, 20 Oct 2020 16:05:22 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 20:05:34 +0200 Message-Id: <20201020180534.36855-14-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201020180534.36855-1-jacopo@jmondi.org> References: <20201020180534.36855-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 13/13] 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. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- 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);