From patchwork Wed Apr 28 07:36:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12127 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 7F6E5BDE44 for ; Wed, 28 Apr 2021 07:36:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E8CF6688CA; Wed, 28 Apr 2021 09:36:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="dm+8N95l"; dkim-atps=neutral Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 94ABD688B7 for ; Wed, 28 Apr 2021 09:36:30 +0200 (CEST) Received: by mail-pg1-x536.google.com with SMTP id q10so44118482pgj.2 for ; Wed, 28 Apr 2021 00:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CTcArTkFMUPimjbWFygFLSHDbZaIwI0tGHz0MD3v2c4=; b=dm+8N95lTeH6yTgiJr9Qo+sijNIpDTr3XSQkZK6gB2cCyoQ9XNujlpPhc1ZZI/xwJ5 TfwAW4EZN3zy4PwohaMP2lsYvjcASqncv6vldjr5xngxKob552OcPNIKHoo7O1VSB9RW P4ay6UIKklJwGXvTrov/muw7YciokgpCi73Mc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CTcArTkFMUPimjbWFygFLSHDbZaIwI0tGHz0MD3v2c4=; b=oK0S9juad0xyc9/Ve0ZanhPzK6WqgvhsMCDiACT5PKDvqenqjDQ4JJnEnH3hGupB9r uzyqnO63nSepah3LjR34OkbOHccozwacSo2bCOQfXeSEjB4TzcN6xfTLWKTYt3yTj3Q5 RdKwrJZgvsDFcgfCZYlewQ0VB5HtX6xKK1Gc0tyGlmqPr+jEG74PwIUlwOnIrWGl8a5p lkmXQi2Q5fWhxFac8Ofj5l6Pw99ZlB645IrcXxWqJD9oaJtcZLFxXjKxL79xWLwlZJ9T MRiE6SadUHkIiFXLBmpzDrjP7Jm8d3uJ+p20sxZtLIGY+2FK2yIDTEIYkiTJpL8hWmPF HtCA== X-Gm-Message-State: AOAM533UXKO/XrPY4d7flv+3UYF+M9PFNsLpix7VplgigyqsfgLemwmw C8R1+Lv3hiU1JHwoOQkWoMKDqrBgrfmGVA== X-Google-Smtp-Source: ABdhPJz57im4klh/Qk0WFqyA94o0ikEvAEIcSGPViIWTFlKiLMJTJN7vds2mNJUQsLViqjIYfILgiw== X-Received: by 2002:aa7:8d03:0:b029:259:f2ed:1849 with SMTP id j3-20020aa78d030000b0290259f2ed1849mr28050908pfe.30.1619595389004; Wed, 28 Apr 2021 00:36:29 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:489:a5f4:117:7d51]) by smtp.gmail.com with ESMTPSA id m11sm1661265pgs.4.2021.04.28.00.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Apr 2021 00:36:28 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 28 Apr 2021 16:36:14 +0900 Message-Id: <20210428073617.373422-5-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog In-Reply-To: <20210428073617.373422-1-hiroh@chromium.org> References: <20210428073617.373422-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/7] libcamera: SensorDatabase: Adds table of v4l2 name and test pattern 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" In V4L2 API, a driver returns a name to represent a test pattern, but it is a driver specific what test pattern is represented by the name. Therefore, this adds a mapping table from the name to a test pattern into a static configuration of a sensor. Signed-off-by: Hirokazu Honda --- include/libcamera/internal/sensor_database.h | 2 + src/libcamera/sensor_database.cpp | 39 ++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/libcamera/internal/sensor_database.h b/include/libcamera/internal/sensor_database.h index 7d743e46..04a5783c 100644 --- a/include/libcamera/internal/sensor_database.h +++ b/include/libcamera/internal/sensor_database.h @@ -7,6 +7,7 @@ #ifndef __LIBCAMERA_SENSOR_DATABASE_H__ #define __LIBCAMERA_SENSOR_DATABASE_H__ +#include #include #include @@ -15,6 +16,7 @@ namespace libcamera { struct SensorInfo { Size unitCellSize; + std::map testPatternModeMap; }; class SensorDatabase diff --git a/src/libcamera/sensor_database.cpp b/src/libcamera/sensor_database.cpp index 68e69e8b..a4d4f686 100644 --- a/src/libcamera/sensor_database.cpp +++ b/src/libcamera/sensor_database.cpp @@ -9,6 +9,8 @@ #include +#include "libcamera/control_ids.h" + namespace libcamera { /** @@ -43,25 +45,48 @@ namespace libcamera { namespace { +const std::map imx219TestPatternModeMap = { + { "Disabled", controls::draft::TestPatternModeOff }, + { "Color Bars", controls::draft::TestPatternModeColorBars }, + { "Solid Color", controls::draft::TestPatternModeSolidColor }, + { "Grey Color Bars", controls::draft::TestPatternModeColorBarsFadeToGray }, + { "PN9", controls::draft::TestPatternModePn9 }, +}; + +const std::map ov5670TestPatternModeMap = { + { "Disabled", controls::draft::TestPatternModeOff }, + { "Vertical Color Bar Type 1", controls::draft::TestPatternModeColorBars }, +}; + +const std::map ov13858TestPatternModeMap = { + { "Disabled", controls::draft::TestPatternModeOff }, + { "Vertical Color Bar Type 1", controls::draft::TestPatternModeColorBars }, + { "Vertical Color Bar Type 2", controls::draft::TestPatternModeColorBarsFadeToGray }, +}; + /** * \brief Sony IMX219 sensor properties */ -constexpr SensorInfo imx219Info = { - .unitCellSize = { 1120, 1120 } +const SensorInfo imx219Info = { + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = imx219TestPatternModeMap, }; /** * \brief Omnivision ov5670 sensor properties */ -constexpr SensorInfo ov5670Info = { - .unitCellSize = { 1120, 1120 } +const SensorInfo ov5670Info = { + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = ov5670TestPatternModeMap, }; /** * \brief Omnivision 13858 sensor properties */ -constexpr SensorInfo ov13858Info = { - .unitCellSize = { 1120, 1120 } +const SensorInfo ov13858Info = { + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = ov13858TestPatternModeMap, + }; #define SENSOR_INFO(_sensor) \ @@ -70,7 +95,7 @@ constexpr SensorInfo ov13858Info = { /* * \brief The database of sensor properties */ -constexpr std::pair sensorDatabase__[] = { +const std::pair sensorDatabase__[] = { SENSOR_INFO(imx219), SENSOR_INFO(ov5670), SENSOR_INFO(ov13858),