From patchwork Tue Jan 5 12:31:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10804 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 E5405C0F1C for ; Tue, 5 Jan 2021 12:31:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9DEB06216C; Tue, 5 Jan 2021 13:31:20 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EA6FC60111 for ; Tue, 5 Jan 2021 13:31:18 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id AFF44E000C for ; Tue, 5 Jan 2021 12:31:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:19 +0100 Message-Id: <20210105123128.617543-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 01/10] libcamera: Document sensor driver requirements 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" Document the feature an image sensor driver has to provide to be fully libcamera-compliant. Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- Documentation/index.rst | 1 + Documentation/meson.build | 1 + Documentation/sensor_driver_requirements.rst | 64 ++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 Documentation/sensor_driver_requirements.rst diff --git a/Documentation/index.rst b/Documentation/index.rst index c49db18d52bd..285ca7c3e5ae 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -18,3 +18,4 @@ Pipeline Handler Writer's Guide Tracing guide Environment variables + Sensor driver requirements diff --git a/Documentation/meson.build b/Documentation/meson.build index b1f5bb52474c..9950465ded6e 100644 --- a/Documentation/meson.build +++ b/Documentation/meson.build @@ -57,6 +57,7 @@ if sphinx.found() 'guides/pipeline-handler.rst', 'guides/tracing.rst', 'index.rst', + 'sensor_driver_requirements.rst', '../README.rst', ] diff --git a/Documentation/sensor_driver_requirements.rst b/Documentation/sensor_driver_requirements.rst new file mode 100644 index 000000000000..0e658aaa03b5 --- /dev/null +++ b/Documentation/sensor_driver_requirements.rst @@ -0,0 +1,64 @@ +.. SPDX-License-Identifier: CC-BY-SA-4.0 + +.. _sensor-driver-requirements: + +Sensor Driver Requirements +========================== + +libcamera handles imaging devices in the CameraSensor class and defines +through its API a consistent interface towards other library components. + +The CameraSensor class uses the V4L2 subdev kernel API to interface with the +camera sensor through one or multiple sub-devices exposed in userspace by +the sensor driver. + +In order for libcamera to be fully operational and provide to applications and +pipeline handlers all the required information to interface with the camera +sensor, a set of mandatory and optional features the driver has to support +has been defined. + +Mandatory Requirements +---------------------- + +The sensor driver is assumed to be fully compliant with the V4L2 specification. + +The sensor driver shall support the following V4L2 controls: + +* `V4L2_CID_HBLANK`_ +* `V4L2_CID_PIXEL_RATE`_ + +.. _V4L2_CID_HBLANK: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-source.html +.. _V4L2_CID_PIXEL_RATE: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html + +Both controls are used to compute the sensor output timings. + +Optional Requirements +--------------------- + +The sensor driver should support the following V4L2 controls: + +* `V4L2_CID_CAMERA_ORIENTATION`_ +* `V4L2_CID_CAMERA_SENSOR_ROTATION`_ + +.. _V4L2_CID_CAMERA_ORIENTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-camera.html +.. _V4L2_CID_CAMERA_SENSOR_ROTATION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/ext-ctrls-image-process.html + +The controls are used to register the camera location and orientation. + +The sensor driver should implement support for the V4L2 Selection API, +specifically it should implement support for the +`VIDIOC_SUBDEV_G_SELECTION`_ ioctl with support for the following selection +targets: + +.. _VIDIOC_SUBDEV_G_SELECTION: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/vidioc-subdev-g-selection.html?highlight=g_selection#c.V4L.VIDIOC_SUBDEV_G_SELECTION + +* `V4L2_SEL_TGT_CROP_BOUNDS`_ to report the readable pixel array area size +* `V4L2_SEL_TGT_CROP_DEFAULT`_ to report the active pixel array area size +* `V4L2_SEL_TGT_CROP`_ to report the analogue selection rectangle + +Support for the selection API is scheduled to become a mandatory feature in +the near future. + +.. _V4L2_SEL_TGT_CROP_BOUNDS: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html +.. _V4L2_SEL_TGT_CROP_DEFAULT: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html +.. _V4L2_SEL_TGT_CROP: https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/v4l2-selection-targets.html From patchwork Tue Jan 5 12:31:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10805 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 05E0BC0F1C for ; Tue, 5 Jan 2021 12:31:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C84B66278D; Tue, 5 Jan 2021 13:31:21 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5B95562016 for ; Tue, 5 Jan 2021 13:31:19 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 204E1E000C for ; Tue, 5 Jan 2021 12:31:18 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:20 +0100 Message-Id: <20210105123128.617543-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 02/10] 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 that 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 validating the sensor driver requirements in a single function Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 84 ++++++++++++++++++++++ 2 files changed, 85 insertions(+) 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 e786821d4ba2..048fcd6a1fae 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,86 @@ 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) + << "The sensor kernel driver needs to be fixed"; + LOG(CameraSensor, Error) + << "See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information"; + return -EINVAL; + } + + /* + * 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, Debug) << "Optional V4L2 controls not supported"; + + /* + * 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. + * + * \todo Make support for selection targets mandatory as soon as all + * test platforms have been updated. + */ + int err = 0; + Rectangle rect; + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); + if (ret) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the readable pixel array size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); + if (ret) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the active pixel array size"; + err = -EINVAL; + } + + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &rect); + if (ret) { + LOG(CameraSensor, Warning) + << "Failed to retrieve the sensor crop rectangle"; + err = -EINVAL; + } + + if (err) { + LOG(CameraSensor, Warning) + << "The sensor kernel driver needs to be fixed"; + LOG(CameraSensor, Warning) + << "See Documentation/sensor_driver_requirements.rst in the libcamera sources for more information"; + } + + return 0; +} + int CameraSensor::initProperties() { /* From patchwork Tue Jan 5 12:31:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10806 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 87876C0F1C for ; Tue, 5 Jan 2021 12:31:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0592E629A6; Tue, 5 Jan 2021 13:31:22 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C472A62015 for ; Tue, 5 Jan 2021 13:31:19 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 8C00EE000E for ; Tue, 5 Jan 2021 12:31:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:21 +0100 Message-Id: <20210105123128.617543-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 03/10] libcamera: camera_sensor: Provide fall-back for sensor 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" Support for the V4L2 selection API is currently optional in the CameraSensor class. Properties registered by using values read through that API are defaulted in several different places (the Android camera HAL or the CameraSensor class). In future support for the selection API will be made mandatory, but to give time to sensor drivers in all test platforms to be updated, use sensor resolution as fallback values for sensor pixel array properties and cache them as class member variables. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/camera_sensor.h | 3 ++ src/libcamera/camera_sensor.cpp | 57 ++++++++-------------- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index aee10aa6e3c7..86902b85ada8 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -84,6 +84,9 @@ private: std::vector mbusCodes_; std::vector sizes_; + Size pixelArraySize_; + Rectangle activeArea_; + ControlList properties_; }; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 048fcd6a1fae..92c90862215d 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -269,15 +269,21 @@ int CameraSensor::validateSensorDriver() Rectangle rect; int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &rect); if (ret) { + rect = Rectangle(resolution()); LOG(CameraSensor, Warning) - << "Failed to retrieve the readable pixel array size"; + << "The PixelArraySize property has been defaulted to " + << rect.toString(); err = -EINVAL; } + pixelArraySize_.width = rect.width; + pixelArraySize_.height = rect.height; - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); + ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &activeArea_); if (ret) { + activeArea_ = Rectangle(pixelArraySize_); LOG(CameraSensor, Warning) - << "Failed to retrieve the active pixel array size"; + << "The PixelArrayActiveAreas property has been defaulted to: " + << activeArea_.toString(); err = -EINVAL; } @@ -373,24 +379,8 @@ int CameraSensor::initProperties() propertyValue = 0; 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()); - - Rectangle crop; - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop); - if (!ret) { - /* - * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are - * defined relatively to the sensor full pixel array size, - * while properties::PixelArrayActiveAreas is defined relatively - * to properties::PixelArraySize. Adjust it. - */ - crop.x -= bounds.x; - crop.y -= bounds.y; - properties_.set(properties::PixelArrayActiveAreas, { crop }); - } + properties_.set(properties::PixelArraySize, pixelArraySize_); + properties_.set(properties::PixelArrayActiveAreas, { activeArea_ }); /* Color filter array pattern, register only for RAW sensors. */ for (const auto &format : formats_) { @@ -646,20 +636,15 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const { info->model = model(); - /* Get the active area size. */ - Rectangle rect; - int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &rect); - if (ret) { - LOG(CameraSensor, Error) - << "Failed to construct camera sensor info: " - << "the camera sensor does not report the active area"; - - return ret; - } - info->activeAreaSize = { rect.width, rect.height }; + /* + * The active area size is a static property, while the crop + * rectangle needs to be re-read as it depends on the sensor + * configuration. + */ + info->activeAreaSize = { activeArea_.width, activeArea_.height }; /* It's mandatory for the subdevice to report its crop rectangle. */ - ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); if (ret) { LOG(CameraSensor, Error) << "Failed to construct camera sensor info: " @@ -672,10 +657,10 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const * are defined relatively to the active pixel area, while V4L2's * TGT_CROP target is defined in respect to the full pixel array. * - * Compensate it by subtracting the active areas offset. + * Compensate it by subtracting the active area offset. */ - info->analogCrop.x -= rect.x; - info->analogCrop.y -= rect.y; + info->analogCrop.x -= activeArea_.x; + info->analogCrop.y -= activeArea_.y; /* The bit depth and image size depend on the currently applied format. */ V4L2SubdeviceFormat format{}; From patchwork Tue Jan 5 12:31:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10807 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 72025C0F1C for ; Tue, 5 Jan 2021 12:31:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 429EC62D3E; Tue, 5 Jan 2021 13:31:23 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4CE326010F for ; Tue, 5 Jan 2021 13:31:20 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 0AACBE000E for ; Tue, 5 Jan 2021 12:31:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:22 +0100 Message-Id: <20210105123128.617543-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 04/10] libcamera: camera_sensor: Default analogue crop rectangle 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" As support for the V4L2_SEL_TGT_CROP selection target, used to read the sensor analogue crop rectangle is schedule to become mandatory but is still optional, cache a default value equal to the sensor's active area size at sensor validation time to allow the creation of the CameraSensorInfo in the case the driver does not support it. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 27 ++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index 86902b85ada8..de6a0202d19a 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -86,6 +86,7 @@ private: Size pixelArraySize_; Rectangle activeArea_; + Rectangle analogueCrop_; ControlList properties_; }; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 92c90862215d..eda41980aa22 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -289,8 +289,10 @@ int CameraSensor::validateSensorDriver() ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &rect); if (ret) { + analogueCrop_ = activeArea_; LOG(CameraSensor, Warning) - << "Failed to retrieve the sensor crop rectangle"; + << "The analogue crop rectangle has been defaulted to: " + << analogueCrop_.toString(); err = -EINVAL; } @@ -643,13 +645,20 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const */ info->activeAreaSize = { activeArea_.width, activeArea_.height }; - /* It's mandatory for the subdevice to report its crop rectangle. */ - int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); - if (ret) { - LOG(CameraSensor, Error) - << "Failed to construct camera sensor info: " - << "the camera sensor does not report the crop rectangle"; - return ret; + /* + * \todo Support for retreiving the crop rectangle is scheduled to + * become mandatory. For the time being use the default value if it has + * been initialized at sensor driver validation time. + */ + if (!analogueCrop_.isNull()) { + info->analogCrop = analogueCrop_; + } else { + int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); + if (ret) { + LOG(CameraSensor, Error) + << "Failed to retrieve the sensor crop rectangle."; + return -EINVAL; + } } /* @@ -664,7 +673,7 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const /* The bit depth and image size depend on the currently applied format. */ V4L2SubdeviceFormat format{}; - ret = subdev_->getFormat(pad_, &format); + int ret = subdev_->getFormat(pad_, &format); if (ret) return ret; info->bitsPerPixel = format.bitsPerPixel(); From patchwork Tue Jan 5 12:31:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10808 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 C7B23C0F1D for ; Tue, 5 Jan 2021 12:31:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 794BD630A2; Tue, 5 Jan 2021 13:31:23 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CE1D362221 for ; Tue, 5 Jan 2021 13:31:20 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 729E4E0003 for ; Tue, 5 Jan 2021 12:31:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:23 +0100 Message-Id: <20210105123128.617543-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 05/10] libcamera: camera_sensor: Default 'location' to External 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" If the sensor driver does not report the camera location default it to 'External' instead of 'Front'. As the camera location is used to construct the camera unique name presented to the user, it makes more sense to report multiple 'External' cameras instead of multiple 'Front' ones. Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index eda41980aa22..205a4ad6085f 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -347,7 +347,6 @@ int CameraSensor::initProperties() const ControlInfoMap &controls = subdev_->controls(); int32_t propertyValue; - /* Camera Location: default is front location. */ const auto &orientation = controls.find(V4L2_CID_CAMERA_ORIENTATION); if (orientation != controls.end()) { int32_t v4l2Orientation = orientation->second.def().get(); @@ -356,20 +355,20 @@ int CameraSensor::initProperties() default: LOG(CameraSensor, Warning) << "Unsupported camera location " - << v4l2Orientation << ", setting to Front"; + << v4l2Orientation << ", setting to External"; /* Fall-through */ + case V4L2_CAMERA_ORIENTATION_EXTERNAL: + propertyValue = properties::CameraLocationExternal; + break; case V4L2_CAMERA_ORIENTATION_FRONT: propertyValue = properties::CameraLocationFront; break; case V4L2_CAMERA_ORIENTATION_BACK: propertyValue = properties::CameraLocationBack; break; - case V4L2_CAMERA_ORIENTATION_EXTERNAL: - propertyValue = properties::CameraLocationExternal; - break; } } else { - propertyValue = properties::CameraLocationFront; + propertyValue = properties::CameraLocationExternal; } properties_.set(properties::Location, propertyValue); From patchwork Tue Jan 5 12:31:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10809 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 C2FB6C0F1C for ; Tue, 5 Jan 2021 12:31:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9FF86631AC; Tue, 5 Jan 2021 13:31:24 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CF2F62012 for ; Tue, 5 Jan 2021 13:31:21 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D41DBE0003 for ; Tue, 5 Jan 2021 12:31:20 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:24 +0100 Message-Id: <20210105123128.617543-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 06/10] libcamera: camera_sensor: Do not default 'rotation' 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 'rotation' property is not critical. Only register it if the sensor driver reports it. Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 205a4ad6085f..0e8aff27b712 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -372,13 +372,11 @@ int CameraSensor::initProperties() } 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 - propertyValue = 0; - properties_.set(properties::Rotation, propertyValue); + properties_.set(properties::Rotation, propertyValue); + } properties_.set(properties::PixelArraySize, pixelArraySize_); properties_.set(properties::PixelArrayActiveAreas, { activeArea_ }); From patchwork Tue Jan 5 12:31:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10810 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 22DE4C0F1D for ; Tue, 5 Jan 2021 12:31:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D8F16631D0; Tue, 5 Jan 2021 13:31:24 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8FAF66010F for ; Tue, 5 Jan 2021 13:31:21 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 4A331E0004 for ; Tue, 5 Jan 2021 12:31:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:25 +0100 Message-Id: <20210105123128.617543-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 07/10] libcamera: uvc: Initialize the pixel array 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" Initialize the pixel array properties in the UVC pipeline handler as they're now initialized in the CameraSensor class, which the UVC pipeline handler does not ue. Signed-off-by: Jacopo Mondi --- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 7cb310e20511..1efced949762 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -509,6 +509,19 @@ int UVCCameraData::init(MediaDevice *media) properties_.set(properties::Location, properties::CameraLocationExternal); properties_.set(properties::Model, utils::toAscii(media->model())); + /* + * Get the current format in order to initialize the sensor array + * properties. + */ + V4L2DeviceFormat format; + ret = video_->getFormat(&format); + if (ret) + return ret; + + properties_.set(properties::PixelArraySize, format.size); + properties_.set(properties::PixelArrayActiveAreas, + { Rectangle(format.size) }); + /* Initialise the supported controls. */ ControlInfoMap::Map ctrls; From patchwork Tue Jan 5 12:31:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10811 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 69E58C0F1C for ; Tue, 5 Jan 2021 12:31:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2078363137; Tue, 5 Jan 2021 13:31:25 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F0B766297D for ; Tue, 5 Jan 2021 13:31:21 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id B729BE0004 for ; Tue, 5 Jan 2021 12:31:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:26 +0100 Message-Id: <20210105123128.617543-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add a const version of dev() 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 const version of the MediaObject::dev() method to be able to retrieve a pointer to a const MediaDevice from a constant instance of a MediaObject sub-class. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/media_object.h | 1 + src/libcamera/media_object.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 43a35bef8f35..2b336961f98d 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -22,6 +22,7 @@ class MediaObject { public: MediaDevice *device() { return dev_; } + const MediaDevice *device() const { return dev_; } unsigned int id() const { return id_; } protected: diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp index 056036635902..cd3cd8ac17a4 100644 --- a/src/libcamera/media_object.cpp +++ b/src/libcamera/media_object.cpp @@ -71,6 +71,12 @@ LOG_DECLARE_CATEGORY(MediaDevice) * \return The MediaDevice */ +/** + * \fn const MediaObject::device() const + * \brief Retrieve the const media device the media object belongs to + * \return The const MediaDevice + */ + /** * \fn MediaObject::id() * \brief Retrieve the media object id From patchwork Tue Jan 5 12:31:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10812 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 A6BFFC0F1D for ; Tue, 5 Jan 2021 12:31:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4CAB0630BB; Tue, 5 Jan 2021 13:31:25 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6991B62015 for ; Tue, 5 Jan 2021 13:31:22 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 28FC0E0003 for ; Tue, 5 Jan 2021 12:31:21 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:27 +0100 Message-Id: <20210105123128.617543-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 09/10] libcamera: camera_sensor: Initialize VIMC 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" The VIMC driver does not yet support all the features required for all sensor drivers. As it is the main testing platforms and the driver changes might take a long time to land in the developments and testing platforms, temporary close the gap by skipping driver validation and initializing properties with static information such as the sensor resolution. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/camera_sensor.h | 1 + src/libcamera/camera_sensor.cpp | 27 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index de6a0202d19a..759a12d16f72 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -70,6 +70,7 @@ protected: private: int generateId(); int validateSensorDriver(); + void initVIMCDefaultProperties(); int initProperties(); const MediaEntity *entity_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0e8aff27b712..046474c03f4a 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -6,6 +6,7 @@ */ #include "libcamera/internal/camera_sensor.h" +#include "libcamera/internal/media_device.h" #include #include @@ -207,6 +208,21 @@ int CameraSensor::init() */ resolution_ = sizes_.back(); + /* + * VIMC is a bit special, as it does not yet support all the + * mandatory requirements regular sensors have to respect. + * + * Do not validate the driver if it's VIMC and initialize the + * the sensor properties with static information. + * + * \todo Remove the special case once the VIMC driver has been + * updated in all test platforms. + */ + if (entity_->device()->driver() == "vimc") { + initVIMCDefaultProperties(); + return initProperties(); + } + ret = validateSensorDriver(); if (ret) return ret; @@ -306,6 +322,17 @@ int CameraSensor::validateSensorDriver() return 0; } +/* + * \brief Initialize properties that cannot be intialized by the + * regular initProperties() function for VIMC + */ +void CameraSensor::initVIMCDefaultProperties() +{ + pixelArraySize_ = resolution(); + activeArea_ = Rectangle(pixelArraySize_); + analogueCrop_ = activeArea_; +} + int CameraSensor::initProperties() { /* From patchwork Tue Jan 5 12:31:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10813 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 D688FC0F1E for ; Tue, 5 Jan 2021 12:31:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 81DF2632EE; Tue, 5 Jan 2021 13:31:25 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA80162012 for ; Tue, 5 Jan 2021 13:31:22 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 916BCE0003 for ; Tue, 5 Jan 2021 12:31:22 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Jan 2021 13:31:28 +0100 Message-Id: <20210105123128.617543-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210105123128.617543-1-jacopo@jmondi.org> References: <20210105123128.617543-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 10/10] android: camera_device: Do not default pixel array 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" Now that the pixel array properties have been defaulted in the CameraSensor class (or in the pipeline handler, for the UVC use case), they will always be reported by the libcamera::Camera and there's no need to default them in the Camera HAL. Remove defaults and assume properties are always there. Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 23be2a593a2a..a136f8e33843 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -851,7 +851,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1); /* Sensor static metadata. */ - if (properties.contains(properties::PixelArraySize)) { + { const Size &size = properties.get(properties::PixelArraySize); std::vector data{ @@ -860,17 +860,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() }; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, data.data(), data.size()); - } else { - /* - * \todo Drop the default once the ov5670 and ov13858 drivers - * are updated to report the pixel array size. - */ - int32_t data[] = { 2592, 1944 }; - staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, - data, 2); } - if (properties.contains(properties::PixelArrayActiveAreas)) { + { const Span &rects = properties.get(properties::PixelArrayActiveAreas); std::vector data{ @@ -881,14 +873,6 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() }; staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, data.data(), data.size()); - } else { - /* - * \todo Drop the default once the ov5670 and ov13858 drivers - * are updated to report the pixel array size. - */ - int32_t data[] = { 0, 0, 2560, 1920 }; - staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, - data, 4); } int32_t sensitivityRange[] = {