From patchwork Wed Dec 23 18:45: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: 10709 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 97626C0F1A for ; Wed, 23 Dec 2020 18:45:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D4003615D2; Wed, 23 Dec 2020 19:45:08 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0FA2660527 for ; Wed, 23 Dec 2020 19:45:08 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id C5C3020002 for ; Wed, 23 Dec 2020 18:45:07 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Dec 2020 19:45:12 +0100 Message-Id: <20201223184516.58791-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223184516.58791-1-jacopo@jmondi.org> References: <20201223184516.58791-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/5] libcamera: camera_sensor: Validate driver support 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 CameraSensor class requires the sensor driver to report information through V4L2 controls and through the V4L2 selection API, and uses those information to register Camera properties and to construct CameraSensorInfo class instances to provide them to the IPA. Currently, validation of the kernel support happens each time a feature is requested, with slighly similar debug/error messages output to the user in case a feature is not supported. Rationalize this by: - Validate the sensor driver requirements in a single function - Expand the debug output when a property gets defaulted to a value - Be more verbose when constructing CameraSensorInfo is not possible Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 106 +++++++++++++++++++-- 2 files changed, 100 insertions(+), 7 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index f80d836161a5..aee10aa6e3c7 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -69,6 +69,7 @@ protected: private: int generateId(); + int validateSensorDriver(); int initProperties(); const MediaEntity *entity_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index bdf4415fda0e..3a65ac3de5bc 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -207,6 +207,10 @@ int CameraSensor::init() */ resolution_ = sizes_.back(); + ret = validateSensorDriver(); + if (ret) + return ret; + ret = initProperties(); if (ret) return ret; @@ -214,6 +218,81 @@ int CameraSensor::init() return 0; } +int CameraSensor::validateSensorDriver() +{ + /* + * Make sure the sensor driver supports the mandatory controls + * required by the CameraSensor class. + * - V4L2_CID_PIXEL_RATE is used to calculate the sensor timings + * - V4L2_CID_HBLANK is used to calculate the line length + */ + const std::vector mandatoryControls{ + V4L2_CID_PIXEL_RATE, + V4L2_CID_HBLANK, + }; + + ControlList ctrls = subdev_->getControls(mandatoryControls); + if (ctrls.empty()) { + LOG(CameraSensor, Error) + << "Mandatory V4L2 controls not available"; + LOG(CameraSensor, Error) + << "Please consider upgrading the sensor driver"; + return -EINVAL; + } + + int err = 0; + /* + * Optional controls are used to register optional sensor + * properties. If not present, some values will be defaulted. + */ + const std::vector optionalControls{ + V4L2_CID_CAMERA_ORIENTATION, + V4L2_CID_CAMERA_SENSOR_ROTATION, + }; + + ctrls = subdev_->getControls(optionalControls); + if (ctrls.empty()) { + LOG(CameraSensor, Info) + << "Optional V4L2 controls not supported"; + err = -EINVAL; + } + + /* + * Make sure the required selection targets are supported. + * + * Failures in reading any of the targets are not deemed to be fatal, + * but some properties and features, like constructing a + * CameraSensorInfo for the IPA module, won't be supported. + */ + Rectangle rect; + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); + if (ret) { + LOG(CameraSensor, Info) + << "Failed to retrieve the readable pixel area size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); + if (ret) { + LOG(CameraSensor, Info) + << "Failed to retrieve the active pixel area size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &rect); + if (ret) { + LOG(CameraSensor, Info) + << "Failed to retreive the sensor crop rectangle"; + err = -EINVAL; + } + + if (err) + LOG(CameraSensor, Info) + << "Please consider upgrading the sensor driver"; + + return 0; +} + int CameraSensor::initProperties() { /* @@ -278,21 +357,29 @@ int CameraSensor::initProperties() } } else { propertyValue = properties::CameraLocationFront; + LOG(CameraSensor, Debug) + << "Location property defaulted to 'Front Camera'"; } properties_.set(properties::Location, propertyValue); /* Camera Rotation: default is 0 degrees. */ const auto &rotationControl = controls.find(V4L2_CID_CAMERA_SENSOR_ROTATION); - if (rotationControl != controls.end()) + if (rotationControl != controls.end()) { propertyValue = rotationControl->second.def().get(); - else + } else { propertyValue = 0; + LOG(CameraSensor, Debug) + << "Rotation property defaulted to 0 degrees"; + } properties_.set(properties::Rotation, propertyValue); Rectangle bounds; ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds); if (!ret) properties_.set(properties::PixelArraySize, bounds.size()); + else + LOG(CameraSensor, Debug) + << "PixelArraySize property not registered"; Rectangle crop; ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop); @@ -306,6 +393,9 @@ int CameraSensor::initProperties() crop.x -= bounds.x; crop.y -= bounds.y; properties_.set(properties::PixelArrayActiveAreas, { crop }); + } else { + LOG(CameraSensor, Debug) + << "PixelArrayActiveAreas property not registered"; } /* Color filter array pattern, register only for RAW sensors. */ @@ -571,6 +661,8 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const LOG(CameraSensor, Error) << "Failed to construct camera sensor info: " << "the camera sensor does not report the active area"; + LOG(CameraSensor, Error) + << "The IPA might not work correctly"; return ret; } @@ -582,6 +674,8 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const LOG(CameraSensor, Error) << "Failed to construct camera sensor info: " << "the camera sensor does not report the crop rectangle"; + LOG(CameraSensor, Error) + << "The IPA might not work correctly"; return ret; } @@ -603,16 +697,14 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const info->bitsPerPixel = format.bitsPerPixel(); info->outputSize = format.size; - /* - * Retrieve the pixel rate and the line length through V4L2 controls. - * Support for the V4L2_CID_PIXEL_RATE and V4L2_CID_HBLANK controls is - * mandatory. - */ + /* Retrieve the pixel rate and the line length through V4L2 controls. */ ControlList ctrls = subdev_->getControls({ V4L2_CID_PIXEL_RATE, V4L2_CID_HBLANK }); if (ctrls.empty()) { LOG(CameraSensor, Error) << "Failed to retrieve camera info controls"; + LOG(CameraSensor, Error) + << "The IPA might not work correctly"; return -EINVAL; } From patchwork Wed Dec 23 18:45: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: 10710 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5BD02C0F1A for ; Wed, 23 Dec 2020 18:45:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0415B61FF3; Wed, 23 Dec 2020 19:45:11 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7926760527 for ; Wed, 23 Dec 2020 19:45:08 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 3CD2520004 for ; Wed, 23 Dec 2020 18:45:08 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Dec 2020 19:45:13 +0100 Message-Id: <20201223184516.58791-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223184516.58791-1-jacopo@jmondi.org> References: <20201223184516.58791-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/5] libcamera: camera_sensor: Initialize 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" Initialize the ControlInfoMap of sensor available controls by reporting the sensor exposure time range. Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 2 ++ src/libcamera/camera_sensor.cpp | 42 +++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index aee10aa6e3c7..0357b2a630f7 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -71,6 +71,7 @@ private: int generateId(); int validateSensorDriver(); int initProperties(); + int initControls(); const MediaEntity *entity_; std::unique_ptr subdev_; @@ -85,6 +86,7 @@ private: std::vector sizes_; ControlList properties_; + ControlInfoMap controls_; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 3a65ac3de5bc..609f948c56a6 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include "libcamera/internal/bayer_format.h" @@ -215,7 +216,7 @@ int CameraSensor::init() if (ret) return ret; - return 0; + return initControls(); } int CameraSensor::validateSensorDriver() @@ -229,6 +230,7 @@ int CameraSensor::validateSensorDriver() const std::vector mandatoryControls{ V4L2_CID_PIXEL_RATE, V4L2_CID_HBLANK, + V4L2_CID_EXPOSURE, }; ControlList ctrls = subdev_->getControls(mandatoryControls); @@ -430,6 +432,44 @@ int CameraSensor::initProperties() return 0; } +int CameraSensor::initControls() +{ + const ControlInfoMap &v4l2Controls = subdev_->controls(); + + /* Exposure time limits expressed in micro-seconds. */ + + /* Calculate the line length in pixels. */ + ControlList ctrls = subdev_->getControls({ V4L2_CID_HBLANK }); + int32_t hblank = ctrls.get(V4L2_CID_HBLANK).get(); + V4L2SubdeviceFormat format{}; + int ret = subdev_->getFormat(pad_, &format); + if (ret) + return ret; + int32_t ppl = format.size.width + hblank; + + const ControlInfo &v4l2ExposureInfo = v4l2Controls.find(V4L2_CID_EXPOSURE)->second; + int32_t minExposurePixels = v4l2ExposureInfo.min().get() * ppl; + int32_t maxExposurePixels = v4l2ExposureInfo.max().get() * ppl; + int32_t defExposurePixels = v4l2ExposureInfo.max().get() * ppl; + + /* Get the pixel rate (in useconds) and calculate the exposure timings. */ + const ControlInfo &pixelRateInfo = v4l2Controls.find(V4L2_CID_PIXEL_RATE)->second; + float minPixelRate = pixelRateInfo.min().get() / 1e6f; + float maxPixelRate = pixelRateInfo.max().get() / 1e6f; + float defPixelRate = pixelRateInfo.def().get() / 1e6f; + + int32_t minExposure = static_cast(minExposurePixels / maxPixelRate); + int32_t maxExposure = static_cast(maxExposurePixels / minPixelRate); + int32_t defExposure = static_cast(defExposurePixels / defPixelRate); + + ControlInfoMap::Map map; + map[&controls::ExposureTime] = ControlInfo(minExposure, maxExposure, + defExposure); + controls_ = std::move(map); + + return 0; +} + /** * \fn CameraSensor::model() * \brief Retrieve the sensor model name From patchwork Wed Dec 23 18:45: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: 10711 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id BD881C0F1A for ; Wed, 23 Dec 2020 18:45:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7645A62000; Wed, 23 Dec 2020 19:45:11 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 09C79615B0 for ; Wed, 23 Dec 2020 19:45:09 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id A082A20004 for ; Wed, 23 Dec 2020 18:45:08 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Dec 2020 19:45:14 +0100 Message-Id: <20201223184516.58791-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223184516.58791-1-jacopo@jmondi.org> References: <20201223184516.58791-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/5] libcamera: camera_sensor: Rename controls() method 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 CameraSensor::controls() methods returns the information relative to the V4L2 controls registered by the sensor sub-device driver. Its current use is to inform the IPA module of two pipelines (RkISP1 and VIMC) about the V4L2 controls limits. The CameraSensor class has a controls_ field, which is instead the ControlInfoMap of libcamera controls registered by the CameraSensor class and meant to be exported as Camera controls. To prepare to register libcamera controls in the CameraSensor::controls_ info map, and remove any ambiguity on the intended usage of CameraSensor::controls(), rename the method in CameraSensor::subdevControls() and update its users in the code base. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- include/libcamera/internal/camera_sensor.h | 2 +- src/libcamera/camera_sensor.cpp | 6 +++--- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 0357b2a630f7..841c7f4bef0f 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -57,7 +57,7 @@ public: const Size &size) const; int setFormat(V4L2SubdeviceFormat *format); - const ControlInfoMap &controls() const; + const ControlInfoMap &subdevControls() const; ControlList getControls(const std::vector &ids); int setControls(ControlList *ctrls); diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 609f948c56a6..fa85484f6186 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -616,10 +616,10 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format) } /** - * \brief Retrieve the supported V4L2 controls and their information - * \return A map of the V4L2 controls supported by the sensor + * \brief Retrieve the controls supported by the V4L2 subdev and their information + * \return A map of the V4L2 controls supported by the video subdevice */ -const ControlInfoMap &CameraSensor::controls() const +const ControlInfoMap &CameraSensor::subdevControls() const { return subdev_->controls(); } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 021d0ffe3ffb..31c9683f783b 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -906,7 +906,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c } std::map entityControls; - entityControls.emplace(0, data->sensor_->controls()); + entityControls.emplace(0, data->sensor_->subdevControls()); IPAOperationData ipaConfig; data->ipa_->configure(sensorInfo, streamConfig, entityControls, diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 8bda746f3136..e33b2c0823af 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -338,7 +338,7 @@ void PipelineHandlerVimc::stop(Camera *camera) int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request) { - ControlList controls(data->sensor_->controls()); + ControlList controls(data->sensor_->subdevControls()); for (auto it : request->controls()) { unsigned int id = it.first; @@ -480,7 +480,7 @@ int VimcCameraData::init() return -ENODEV; /* Initialise the supported controls. */ - const ControlInfoMap &controls = sensor_->controls(); + const ControlInfoMap &controls = sensor_->subdevControls(); ControlInfoMap::Map ctrls; for (const auto &ctrl : controls) { From patchwork Wed Dec 23 18:45: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: 10712 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0A77DC0F1A for ; Wed, 23 Dec 2020 18:45:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DB45561D64; Wed, 23 Dec 2020 19:45:12 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D25D619E2 for ; Wed, 23 Dec 2020 19:45:09 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 1071C20004 for ; Wed, 23 Dec 2020 18:45:08 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Dec 2020 19:45:15 +0100 Message-Id: <20201223184516.58791-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223184516.58791-1-jacopo@jmondi.org> References: <20201223184516.58791-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/5] libcamera: camera_sensor: Add controls() method 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 controls() method to retrieve the map of libcamera controls registered by the CameraSensor class. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 841c7f4bef0f..10877b9d1d9d 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -62,6 +62,7 @@ public: int setControls(ControlList *ctrls); const ControlList &properties() const { return properties_; } + const ControlInfoMap &controls() const { return controls_; } int sensorInfo(CameraSensorInfo *info) const; protected: diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index fa85484f6186..e95a254c03cc 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -652,6 +652,12 @@ ControlList CameraSensor::getControls(const std::vector &ids) * \return The list of camera sensor properties */ +/** + * \fn CameraSensor::controls() + * \brief Retrieve the camera sensor controls info + * \return The map of camera sensor controls info + */ + /** * \brief Write controls to the sensor * \param[in] ctrls The list of controls to write From patchwork Wed Dec 23 18:45: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: 10713 X-Patchwork-Delegate: jacopo@jmondi.org Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 520AEC0F1C for ; Wed, 23 Dec 2020 18:45:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0B9DB62007; Wed, 23 Dec 2020 19:45:13 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B163E60527 for ; Wed, 23 Dec 2020 19:45:09 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 77B0C20004 for ; Wed, 23 Dec 2020 18:45:09 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 23 Dec 2020 19:45:16 +0100 Message-Id: <20201223184516.58791-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201223184516.58791-1-jacopo@jmondi.org> References: <20201223184516.58791-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/5] libcamera: ipu3: Register sensor 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 the sensor provided controls together with the pipeline handler initialized controls. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/libcamera/pipeline/ipu3/ipu3.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 8a1918d5e4c5..fc5590aaf5a0 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -777,7 +777,12 @@ int PipelineHandlerIPU3::registerCameras() data->properties_ = cio2->sensor()->properties(); /* Initialze the camera controls. */ - data->controlInfo_ = IPU3Controls; + ControlInfoMap::Map controlsMap; + for (const auto &it : IPU3Controls) + controlsMap[it.first] = it.second; + for (const auto &it : cio2->sensor()->controls()) + controlsMap[it.first] = it.second; + data->controlInfo_ = std::move(controlsMap); /** * \todo Dynamically assign ImgU and output devices to each