From patchwork Wed Apr 21 04:23:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 12021 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 69AFABDB16 for ; Wed, 21 Apr 2021 04:24:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 293AD68843; Wed, 21 Apr 2021 06:24:04 +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="FfllY6BK"; dkim-atps=neutral Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DCB356884B for ; Wed, 21 Apr 2021 06:24:01 +0200 (CEST) Received: by mail-pf1-x42c.google.com with SMTP id i190so27461086pfc.12 for ; Tue, 20 Apr 2021 21:24:01 -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=HrT9i7XhDSbb+NstUsVDkxKE8NA2VTx4jZnojrfc6r0=; b=FfllY6BKD8QyJ2roNcdIFLR4yEdiQafZx9t816HQEvBC59mfrpU6HmSxBQwaLoZz0Q CzyKAEaJ6GQZBGwEdD3mIil4H2N5zGl9QT0BNsOLVaYwGdDV2gKD1J6ztoP24UsOfuxe 1NvjR6Xds/JMw36m4GFq42ROH0kjXnTGFYib4= 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=HrT9i7XhDSbb+NstUsVDkxKE8NA2VTx4jZnojrfc6r0=; b=lSDRnMWYvpCwVb3XDNYrH3tnMZuqqRGFLwB+d+fudYuWkTSKrDvyib8AFpVkg0dvt0 FQCJKh0KJuqGbGzSDEA+h/PBfFQ/10nozQfm4WmzdaEeFAMeRGIHeJ1r0xKzfqRzJ3IO ZszYywz1wCsdlPbmt8A8EzX1gq1ZHat2PkKFV0LLFKyy6ayEtp6CcY/UXGobz4WhUgEU vUzizKwo2+iXeqLODRUp2mYFEDNKA55sGG2N0JCVCfAh73DSa1WcLAIJnL/1PquUNVTo 2edDZjSqyodob8NhocTFVWY+24VdFKxmVXtqato77j9gH9HHMVJbhJFrc7Bm/aS4Ltis HFXw== X-Gm-Message-State: AOAM5336mcDpo3Du2MQWHcko1NvsqgxEo3UBHew7dlLfiF9yRAsng+Hl wPGl8PXXrBUDx9Ten0XAOqS0yeLhRxrpzw== X-Google-Smtp-Source: ABdhPJwR4OtpYKCfcJbosQ6h8CaY27RPBijXsxAZJM110sXHIQPkPU0i1S4TnnHg7JF8HQY7UENlag== X-Received: by 2002:a65:4486:: with SMTP id l6mr20307671pgq.347.1618979040278; Tue, 20 Apr 2021 21:24:00 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:7aaa:cbeb:5d87:4ab6]) by smtp.gmail.com with ESMTPSA id z18sm461316pfa.39.2021.04.20.21.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 21:23:59 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Apr 2021 13:23:43 +0900 Message-Id: <20210421042346.312854-5-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog In-Reply-To: <20210421042346.312854-1-hiroh@chromium.org> References: <20210421042346.312854-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 | 37 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/include/libcamera/internal/sensor_database.h b/include/libcamera/internal/sensor_database.h index 7d743e46..c0b181f8 100644 --- a/include/libcamera/internal/sensor_database.h +++ b/include/libcamera/internal/sensor_database.h @@ -10,11 +10,13 @@ #include #include +#include namespace libcamera { struct SensorInfo { Size unitCellSize; + Span> testPatternModeMap; }; class SensorDatabase diff --git a/src/libcamera/sensor_database.cpp b/src/libcamera/sensor_database.cpp index 68e69e8b..da469b67 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,54 @@ namespace libcamera { namespace { +constexpr std::pair 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 }, +}; + +constexpr std::pair ov5670TestPatternModeMap[] = { + { "Disabled", controls::draft::TestPatternModeOff }, + { "Vertical Color Bar Type 1", controls::draft::TestPatternModeColorBars }, +}; + +constexpr std::pair 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 } + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = + libcamera::Span>( + imx219TestPatternModeMap), }; /** * \brief Omnivision ov5670 sensor properties */ constexpr SensorInfo ov5670Info = { - .unitCellSize = { 1120, 1120 } + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = + libcamera::Span>( + ov5670TestPatternModeMap), }; /** * \brief Omnivision 13858 sensor properties */ constexpr SensorInfo ov13858Info = { - .unitCellSize = { 1120, 1120 } + .unitCellSize = { 1120, 1120 }, + .testPatternModeMap = + libcamera::Span>( + ov13858TestPatternModeMap), + }; #define SENSOR_INFO(_sensor) \