From patchwork Tue Apr 13 07:50:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11902 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 9A92ABD224 for ; Tue, 13 Apr 2021 07:50:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5802068806; Tue, 13 Apr 2021 09:50:31 +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="TwC0j3iP"; dkim-atps=neutral Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 43C9668807 for ; Tue, 13 Apr 2021 09:50:30 +0200 (CEST) Received: by mail-pj1-x1031.google.com with SMTP id nm3-20020a17090b19c3b029014e1bbf6c60so4370038pjb.4 for ; Tue, 13 Apr 2021 00:50: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=rlsUuEqcdG8AY1Z79fV2Ci85GOWZ0WM8QyxR3iApWQg=; b=TwC0j3iP7GMddqP7G4IDRT68fxUc7ivUaP89NXGOR0XmImlAwQEeZHpFU1hw3ei9Ck 5ecNVT8R0YRQA2CNgZ8AvCPo3uY6L15w+gffxmUt69xP9LoYWW7wivCXLyaoojIh3Dkg X8Xpw7eexvgYZYWrUuQdKDuUoCdnyO9tSVy40= 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=rlsUuEqcdG8AY1Z79fV2Ci85GOWZ0WM8QyxR3iApWQg=; b=f1ftk3X/7zaJ7XCs/rpYRuebDN5qkL3kBAV4jrmADYPSgBJpy4Htx6GPmPqAVkVRGC oCeF2XsjZ5TC7TB1I7ZZm4hbtRb/aBxCx/B09zdhZivpfMwd+/O57zLkt5wA77pbIIE5 pvO7aFhNwQJ5q19tCmSmIAf3l1LrJkQGCtDyeScBnJNhLdemaruHuYVDLjFq8s+LZvLz AhOoRHXdlh0yxitp2ZClfbYEsdltB068gYf4Ol5LaRcAA+IF0cskhixOchcDQLyx2+l9 83rVbusKypxmN4NFFW7q9LmdIpPC+70xdyi6IsdSOrbkKUQrbbe8q2dzHDQezDA4x8CV pojQ== X-Gm-Message-State: AOAM531860bpupAPK2Yvp/MIC2NtQpJisgOCzTm7LtRQYlyLx4OxrpH3 mICyEcTBH0wh1wlwCJQOrQVeB21M7zk18w== X-Google-Smtp-Source: ABdhPJyIkl3NS4wKy1q1H8Nox9M0bKnCZ3QdFrAALsPkLbjuGroC4Px0niPk6Qc5lhgeWDWQITeYvw== X-Received: by 2002:a17:90a:c3:: with SMTP id v3mr3633754pjd.55.1618300228720; Tue, 13 Apr 2021 00:50:28 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:84f5:7981:dfbe:8f02]) by smtp.gmail.com with ESMTPSA id n25sm11525125pff.154.2021.04.13.00.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 00:50:28 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 13 Apr 2021 16:50:11 +0900 Message-Id: <20210413075013.3069213-4-hiroh@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog In-Reply-To: <20210413075013.3069213-1-hiroh@chromium.org> References: <20210413075013.3069213-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2 3/5] 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: , Cc: jmondi@jacopo.org 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..a71e8958 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::SensorTestPatternModeOff }, + { "Color Bars", controls::draft::SensorTestPatternModeColorBars }, + { "Solid Color", controls::draft::SensorTestPatternModeSolidColor }, + { "Grey Color Bars", controls::draft::SensorTestPatternModeColorBarsFadeToGray }, + { "PN9", controls::draft::SensorTestPatternModePn9 }, +}; + +constexpr std::pair ov5670TestPatternModeMap[] = { + { "Disabled", controls::draft::SensorTestPatternModeOff }, + { "Vertical Color Bar Type 1", controls::draft::SensorTestPatternModeColorBars }, +}; + +constexpr std::pair ov13858TestPatternModeMap[] = { + { "Disabled", controls::draft::SensorTestPatternModeOff }, + { "Vertical Color Bar Type 1", controls::draft::SensorTestPatternModeColorBars }, + { "Vertical Color Bar Type 2", controls::draft::SensorTestPatternModeColorBarsFadeToGray }, +}; + /** * \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) \