From patchwork Thu Jun 30 13:38:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16467 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 3078CC327A for ; Thu, 30 Jun 2022 13:39:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B5542656A1; Thu, 30 Jun 2022 15:39:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656596373; bh=qfkbTfnrg4/rHiitqO5pfDyHxnXcXfcTXHBeAKyDSns=; 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=3CPjN0H1DAV39gwhDxMH0CN2EpjuyyJOKwSzoaTQLg0hoQcmMDs0AyBs6oNhkZz0D X1QowD0ngDSvxiwwMCMTEhyBwRW6ZAZEkBMSPdyQh1n3OSUzyLT85tu9RC87AGyqg/ qN6BkVbI+fmkGwuKpaEO/5i59gh9e8BAAIrYg0d1Sm9JiuOzQEmizCBZMudMAWlyXk lVOP9RNSObHSmFDMLj3uVqdAjwEgxT5MLFh01mD3896a0B6JOi7qfSz7aksYhJBrC5 gtKz4bTzgpvfvLHay4ybjlzvYxbyufTqrav0OeyfCTZ6chgVAJGZTm/mdTQLZYEnIX 5B/Bu0ussFkFA== Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B3C9E65697 for ; Thu, 30 Jun 2022 15:39:29 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id E8AF424000E; Thu, 30 Jun 2022 13:39:28 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 15:38:48 +0200 Message-Id: <20220630133902.321099-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220630133902.321099-1-jacopo@jmondi.org> References: <20220630133902.321099-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 09/23] libcamera: camera_sensor_properties: Add 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 to the camera sensor properties a map of control identifiers to their latencies. Some camera sensor controls take a variable number of frames to take effect, hence they should be set in advance. The newly introduced map records that information as a property of the camera sensor class. Signed-off-by: Jacopo Mondi --- .../internal/camera_sensor_properties.h | 4 ++ .../camera_sensor_properties.cpp | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h index 1ee3cb994106..2404b0674323 100644 --- a/include/libcamera/internal/camera_sensor_properties.h +++ b/include/libcamera/internal/camera_sensor_properties.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -16,10 +17,13 @@ namespace libcamera { struct CameraSensorProperties { + using SensorDelays = std::unordered_map; + static const CameraSensorProperties *get(const std::string &sensor); Size unitCellSize; std::map testPatternModes; + SensorDelays sensorDelays; }; } /* namespace libcamera */ diff --git a/src/libcamera/camera_sensor/camera_sensor_properties.cpp b/src/libcamera/camera_sensor/camera_sensor_properties.cpp index e5f27f06eb1d..4b5ab716abe2 100644 --- a/src/libcamera/camera_sensor/camera_sensor_properties.cpp +++ b/src/libcamera/camera_sensor/camera_sensor_properties.cpp @@ -13,6 +13,8 @@ #include +#include + /** * \file camera_sensor_properties.h * \brief Database of camera sensor properties @@ -41,6 +43,18 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties) * \brief Map that associates the TestPattern control value with the indexes of * the corresponding sensor test pattern modes as returned by * V4L2_CID_TEST_PATTERN. + * + * \var CameraSensorProperties::sensorDelays + * \brief Map that associates control identifiers with their latencies, + * expressed in frame periods. + */ + +/** + * \typedef CameraSensorProperties::SensorDelays + * \brief Camera sensor controls delays + * + * Type to represent a map of camera sensor controls associated with their + * latencies, expressed in frame periods. */ /** @@ -69,6 +83,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * 9: "Resolution Pattern" */ }, + .sensorDelays = { }, } }, { "imx219", { .unitCellSize = { 1120, 1120 }, @@ -79,6 +94,11 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, { controls::draft::TestPatternModePn9, 4 }, }, + .sensorDelays = { + { &controls::internal::FrameDuration, 2 }, + { &controls::internal::ExposureTime, 2 }, + { &controls::internal::AnalogueGain, 1 }, + }, } }, { "imx258", { .unitCellSize = { 1120, 1120 }, @@ -89,18 +109,26 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeColorBarsFadeToGray, 3 }, { controls::draft::TestPatternModePn9, 4 }, }, + .sensorDelays = { }, } }, { "imx290", { .unitCellSize = { 2900, 2900 }, .testPatternModes = {}, + .sensorDelays = { + { &controls::internal::FrameDuration, 2 }, + { &controls::internal::ExposureTime, 2 }, + { &controls::internal::AnalogueGain, 2 }, + }, } }, { "imx296", { .unitCellSize = { 3450, 3450 }, .testPatternModes = {}, + .sensorDelays = { }, } }, { "imx477", { .unitCellSize = { 1550, 1550 }, .testPatternModes = {}, + .sensorDelays = { }, } }, { "ov2740", { .unitCellSize = { 1400, 1400 }, @@ -108,6 +136,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1}, }, + .sensorDelays = { }, } }, { "ov5640", { .unitCellSize = { 1400, 1400 }, @@ -115,10 +144,16 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .sensorDelays = { }, } }, { "ov5647", { .unitCellSize = { 1400, 1400 }, .testPatternModes = {}, + .sensorDelays = { + { &controls::internal::FrameDuration, 2 }, + { &controls::internal::ExposureTime, 2 }, + { &controls::internal::AnalogueGain, 2 }, + }, } }, { "ov5670", { .unitCellSize = { 1120, 1120 }, @@ -126,6 +161,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .sensorDelays = { }, } }, { "ov5675", { .unitCellSize = { 1120, 1120 }, @@ -133,6 +169,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .sensorDelays = { }, } }, { "ov5693", { .unitCellSize = { 1400, 1400 }, @@ -145,6 +182,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * Rolling Bar". */ }, + .sensorDelays = { }, } }, { "ov8865", { .unitCellSize = { 1400, 1400 }, @@ -159,6 +197,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen * 5: "Color squares with rolling bar" */ }, + .sensorDelays = { }, } }, { "ov13858", { .unitCellSize = { 1120, 1120 }, @@ -166,6 +205,7 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen { controls::draft::TestPatternModeOff, 0 }, { controls::draft::TestPatternModeColorBars, 1 }, }, + .sensorDelays = { }, } }, };