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() { /*