From patchwork Fri Oct 23 17:11:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10220 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 02274BDB13 for ; Fri, 23 Oct 2020 17:11:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 380676198C; Fri, 23 Oct 2020 19:11:25 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E72B60350 for ; Fri, 23 Oct 2020 19:11:24 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 7B0CC1C0003; Fri, 23 Oct 2020 17:11:23 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:05 +0200 Message-Id: <20201023171116.24899-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 01/12] 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 Fri Oct 23 17:11:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10221 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 E9860BDB13 for ; Fri, 23 Oct 2020 17:11:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C315B619AD; Fri, 23 Oct 2020 19:11:28 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3D2E561994 for ; Fri, 23 Oct 2020 19:11:25 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 62FC81C0004; Fri, 23 Oct 2020 17:11:24 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:06 +0200 Message-Id: <20201023171116.24899-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 02/12] 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 Fri Oct 23 17:11:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10222 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 C0711BDB13 for ; Fri, 23 Oct 2020 17:11:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 122CB615D2; Fri, 23 Oct 2020 19:11:29 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A054E615D2 for ; Fri, 23 Oct 2020 19:11:25 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 454F21C0006; Fri, 23 Oct 2020 17:11:25 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:07 +0200 Message-Id: <20201023171116.24899-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 03/12] libcamera: controls: Construct from valid 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" Add two constructors to the ControlInfo class that allows creating a class instance from the list of the control valid values with an optional default one. Signed-off-by: Jacopo Mondi --- include/libcamera/controls.h | 5 ++++ src/libcamera/controls.cpp | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 80944efc133a..0ae4fd002726 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -268,10 +268,14 @@ public: explicit ControlInfo(const ControlValue &min = 0, const ControlValue &max = 0, const ControlValue &def = 0); + explicit ControlInfo(const ControlValue *values, unsigned int numValues, + const ControlValue &def); + explicit ControlInfo(const ControlValue *values, unsigned int numValues); 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 +293,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..2a2f04a598b6 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -491,6 +491,42 @@ ControlInfo::ControlInfo(const ControlValue &min, { } +/** + * \brief Construct a ControlInfo from the list of values values and a default + * \param[in] values The control valid values + * \param[in] numValues The number or valid values + * \param[in] def The control default value + * + * Construct a ControlInfo from a list of valid values. The ControlInfo + * minimum and maximum values are assigned to the first and last members of + * the values list respectively. + */ +ControlInfo::ControlInfo(const ControlValue *values, unsigned int numValues, + const ControlValue &def) + : def_(def) +{ + min_ = values[0]; + max_ = values[numValues - 1]; + + for (unsigned int i = 0; i < numValues; ++i) + values_.push_back(values[i]); +} + +/** + * \brief Construct a ControlInfo from the list of valid values + * \param[in] values The control valid values + * \param[in] numValues The number or valid values + * + * Construct a ControlInfo from a list of valid 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 ControlValue *values, unsigned int numValues) + : ControlInfo(values, numValues, values[0]) +{ +} + /** * \fn ControlInfo::min() * \brief Retrieve the minimum value of the control @@ -519,6 +555,17 @@ ControlInfo::ControlInfo(const ControlValue &min, * \return A ControlValue with the default value for the control */ +/** + * \fn ControlInfo::values() + * \brief Retrieve the list of valid values + * + * 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. + * + * \return A vector of ControlValue representing the control valid values + */ + /** * \brief Provide a string representation of the ControlInfo */ From patchwork Fri Oct 23 17:11:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10223 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 EB0DCBDB13 for ; Fri, 23 Oct 2020 17:11:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9E53861994; Fri, 23 Oct 2020 19:11:31 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8710460350 for ; Fri, 23 Oct 2020 19:11:26 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id C652B1C0006; Fri, 23 Oct 2020 17:11:25 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:08 +0200 Message-Id: <20201023171116.24899-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 04/12] 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. Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- 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 Fri Oct 23 17:11:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10224 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 89147BDB13 for ; Fri, 23 Oct 2020 17:11:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4CF77619A2; Fri, 23 Oct 2020 19:11:32 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 337D4615D3 for ; Fri, 23 Oct 2020 19:11:27 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id A24BD1C0007; Fri, 23 Oct 2020 17:11:26 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:09 +0200 Message-Id: <20201023171116.24899-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 05/12] libcamera: controls: Generate an array of valid 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 Reviewed-by: Laurent Pinchart --- include/libcamera/control_ids.h.in | 1 + src/libcamera/control_ids.cpp.in | 1 + utils/gen-controls.py | 30 ++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in index baadca83b103..7edeb6b65e32 100644 --- a/include/libcamera/control_ids.h.in +++ b/include/libcamera/control_ids.h.in @@ -10,6 +10,7 @@ #ifndef __LIBCAMERA_CONTROL_IDS_H__ #define __LIBCAMERA_CONTROL_IDS_H__ +#include #include #include diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index 056645cfbdfb..5fb1c2c30558 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -8,6 +8,7 @@ */ #include +#include /** * \file control_ids.h diff --git a/utils/gen-controls.py b/utils/gen-controls.py index bf681503f86a..a0bd43fabc31 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -33,6 +33,12 @@ ${description}''') ${description} */''') def_template = string.Template('extern const Control<${type}> ${name}(${id_name}, "${name}");') + enum_values_doc = string.Template('''/** + * \\var ${name}Values + * \\brief List of all $name supported values + */''') + enum_values_start = string.Template('''extern const std::array ${name}Values = {''') + enum_values_values = string.Template('''\tstatic_cast(${name}),''') ctrls_doc = [] ctrls_def = [] @@ -68,6 +74,7 @@ ${description} enum_doc = [] enum_doc.append(enum_doc_start_template.substitute(info)) + num_entries = 0; for entry in enum: value_info = { 'name' : name, @@ -75,11 +82,25 @@ ${description} 'description': format_description(entry['description']), } enum_doc.append(enum_doc_value_template.substitute(value_info)) + num_entries += 1 enum_doc = '\n *\n'.join(enum_doc) enum_doc += '\n */' target_doc.append(enum_doc) + values_info = { + 'name' : info['name'], + 'size' : num_entries, + } + target_doc.append(enum_values_doc.substitute(values_info)) + target_def.append(enum_values_start.substitute(values_info)) + for entry in enum: + value_info = { + 'name' : entry['name'] + } + target_def.append(enum_values_values.substitute(value_info)) + target_def.append("};") + target_doc.append(doc_template.substitute(info)) target_def.append(def_template.substitute(info)) @@ -100,6 +121,7 @@ ${description} def generate_h(controls): enum_template_start = string.Template('''enum ${name}Enum {''') enum_value_template = string.Template('''\t${name} = ${value},''') + enum_values_template = string.Template('''extern const std::array ${name}Values;''') template = string.Template('''extern const Control<${type}> ${name};''') ctrls = [] @@ -132,14 +154,22 @@ def generate_h(controls): if enum: target_ctrls.append(enum_template_start.substitute(info)) + num_entries = 0 for entry in enum: value_info = { 'name': entry['name'], 'value': entry['value'], } target_ctrls.append(enum_value_template.substitute(value_info)) + num_entries += 1 target_ctrls.append("};") + values_info = { + 'name' : info['name'], + 'size' : num_entries, + } + target_ctrls.append(enum_values_template.substitute(values_info)) + target_ctrls.append(template.substitute(info)) id_value += 1 From patchwork Fri Oct 23 17:11:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10225 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 06C58BDB13 for ; Fri, 23 Oct 2020 17:11:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BBA26619A3; Fri, 23 Oct 2020 19:11:32 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B57C615D4 for ; Fri, 23 Oct 2020 19:11:28 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 55F721C0004; Fri, 23 Oct 2020 17:11:27 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:10 +0200 Message-Id: <20201023171116.24899-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 06/12] 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: Naushir Patuck Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- 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..1d3827404966 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.data(), controls::AeMeteringModeValues.size()) }, + { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues.data(), controls::AeConstraintModeValues.size()) }, + { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues.data(), controls::AeExposureModeValues.size()) }, { &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.data(), controls::AwbModeValues.size()) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, From patchwork Fri Oct 23 17:11:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10226 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 9FE86BDB13 for ; Fri, 23 Oct 2020 17:11:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5F3A961795; Fri, 23 Oct 2020 19:11:33 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1AF6C6195B for ; Fri, 23 Oct 2020 19:11:29 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 622321C0004; Fri, 23 Oct 2020 17:11:28 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:11 +0200 Message-Id: <20201023171116.24899-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 07/12] 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: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- 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 Fri Oct 23 17:11:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10227 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 45003BDB13 for ; Fri, 23 Oct 2020 17:11:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 044DE617E7; Fri, 23 Oct 2020 19:11:34 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F250E61994 for ; Fri, 23 Oct 2020 19:11:29 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 3886C1C0008; Fri, 23 Oct 2020 17:11:29 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:12 +0200 Message-Id: <20201023171116.24899-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 08/12] 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 and 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index af47739d8d4f..5a6ee1a83e45 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 @@ -833,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); } @@ -858,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 Fri Oct 23 17:11:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10228 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 965DCBDB13 for ; Fri, 23 Oct 2020 17:11:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74D2A619BF; Fri, 23 Oct 2020 19:11:35 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C74E16195B for ; Fri, 23 Oct 2020 19:11:30 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 1A7501C0006; Fri, 23 Oct 2020 17:11:29 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:13 +0200 Message-Id: <20201023171116.24899-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 09/12] 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: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- 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 Fri Oct 23 17:11:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10229 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 BE001C3D3D for ; Fri, 23 Oct 2020 17:11:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 95625619E2; Fri, 23 Oct 2020 19:11:35 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DF216195B for ; Fri, 23 Oct 2020 19:11:31 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E7BB91C0004; Fri, 23 Oct 2020 17:11:30 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:14 +0200 Message-Id: <20201023171116.24899-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 10/12] 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: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- 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 Fri Oct 23 17:11:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10230 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 2B229C3D3E for ; Fri, 23 Oct 2020 17:11:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D15B2619F6; Fri, 23 Oct 2020 19:11:35 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7352F6195B for ; Fri, 23 Oct 2020 19:11:32 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BFC3E1C0004; Fri, 23 Oct 2020 17:11:31 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:15 +0200 Message-Id: <20201023171116.24899-12-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 11/12] 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: Laurent Pinchart 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 Fri Oct 23 17:11:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10231 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 7ED11BDB13 for ; Fri, 23 Oct 2020 17:11:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4EC1F619C3; Fri, 23 Oct 2020 19:11:36 +0200 (CEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 51E69618A2 for ; Fri, 23 Oct 2020 19:11:33 +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 relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 912381C0002; Fri, 23 Oct 2020 17:11:32 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 23 Oct 2020 19:11:16 +0200 Message-Id: <20201023171116.24899-13-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201023171116.24899-1-jacopo@jmondi.org> References: <20201023171116.24899-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 12/12] 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: Laurent Pinchart 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);