From patchwork Mon Jun 27 16:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16386 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 81502BD808 for ; Mon, 27 Jun 2022 16:27:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 324BF6564C; Mon, 27 Jun 2022 18:27:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656347271; bh=ckO0WIZjO53QzzWM6jMDukqqxc2tn5erdfG9AVHU+UY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=SoqgSVxUvAhzQr86geLRVRaowKvbud6plNRZYOyQW+u5VNFD0ZDhZMZYFszkxQiV8 yBpG9opEWemMT5gzvImatCelFF0M58Zr0n+vSYxvPDhQCRHp4VQJKcmllCpFOM3Zx5 tTNYjui8XNIg0nGD2rP3GkSNzpVPKk24AiJOYaYxkAU/isHy3mRpk6vWoSaqRoMLB0 jYHKmhGt4dom+cvi8Z8TnDxE6Y8qfBZsOc0ipatDDGtJbMJZYXWaMhbFDHgJHB4aI5 pyWTBG3FaCvUhuZetoQHK+HfvYapAWvgqCOxQZaKHGmjaI0YStDFIqy1/c5MiObM6F T+SgKHFCpkx2Q== Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CDE0D65639 for ; Mon, 27 Jun 2022 18:27:44 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 0D35B20009; Mon, 27 Jun 2022 16:27:43 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Jun 2022 18:27:22 +0200 Message-Id: <20220627162732.33160-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627162732.33160-1-jacopo@jmondi.org> References: <20220627162732.33160-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/15] libcamera: camera_sensor: Retrieve sensor delays 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: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a function to the CameraSensor to retrieve the SensorDelay map that associate controls to their latencies. If such information is not provided, return a reference to an empty map. Signed-off-by: Jacopo Mondi --- include/libcamera/internal/camera_sensor.h | 4 +++ src/libcamera/camera_sensor.cpp | 30 ++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index b9f4d7867854..0359d4609517 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -34,6 +35,8 @@ struct CameraSensorProperties; class CameraSensor : protected Loggable { public: + using SensorDelays = std::unordered_map; + explicit CameraSensor(const MediaEntity *entity); ~CameraSensor(); @@ -45,6 +48,7 @@ public: const std::vector &mbusCodes() const { return mbusCodes_; } std::vector sizes(unsigned int mbusCode) const; Size resolution() const; + const SensorDelays &sensorDelays(); const std::vector &testPatternModes() const { return testPatternModes_; diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp index d055c16a4885..5cd33e904174 100644 --- a/src/libcamera/camera_sensor.cpp +++ b/src/libcamera/camera_sensor.cpp @@ -47,6 +47,14 @@ LOG_DEFINE_CATEGORY(CameraSensor) * devices as the needs arise. */ +/** + * \typedef CameraSensor::SensorDelays + * \brief Camera sensor controls delays + * + * Type to represent a map of camera sensor controls associated with their + * latencies, expressed in frame periods. + */ + /** * \brief Construct a CameraSensor * \param[in] entity The media entity backing the camera sensor @@ -561,6 +569,28 @@ Size CameraSensor::resolution() const return std::min(sizes_.back(), activeArea_.size()); } +/** + * \brief Retrieve the map of latencies associated with camera controls + * + * Retrieve the SensorDelays map that associates camera controls with + * their latencies. + * + * If a camera sensor does not provide such information an empty map is + * returned. + * + * \return A map of controls associated with their latencies or an empty map + * if no sensor delays are available. + */ +const CameraSensor::SensorDelays &CameraSensor::sensorDelays() +{ + static SensorDelays emptyDelays{}; + + if (!staticProps_) + return emptyDelays; + + return staticProps_->sensorDelays; +} + /** * \fn CameraSensor::testPatternModes() * \brief Retrieve all the supported test pattern modes of the camera sensor