From patchwork Fri Jan 15 17:00: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: 10867 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 C8E67C3383 for ; Fri, 15 Jan 2021 17:00:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A6B1A680FE; Fri, 15 Jan 2021 18:00:24 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 906B8680ED for ; Fri, 15 Jan 2021 18:00:19 +0100 (CET) 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 relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 61CB524000A for ; Fri, 15 Jan 2021 17:00:19 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 15 Jan 2021 18:00:27 +0100 Message-Id: <20210115170033.27124-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115170033.27124-1-jacopo@jmondi.org> References: <20210115170033.27124-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 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, use the sensor's active area size as fallback value to allow the creation of the CameraSensorInfo in the case the driver does not support it. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/libcamera/camera_sensor.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index 0c9bd4f50cff..e8caa4467643 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -643,13 +643,16 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const */ info->activeAreaSize = { activeArea_.width, activeArea_.height }; - /* It's mandatory for the subdevice to report its crop rectangle. */ + /* + * \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. + */ int ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP, &info->analogCrop); if (ret) { + info->analogCrop = activeArea_; LOG(CameraSensor, Error) - << "Failed to construct camera sensor info: " - << "the camera sensor does not report the crop rectangle"; - return ret; + << "The analogue crop rectangle has been defaulted to the active area size"; } /*