{"id":11902,"url":"https://patchwork.libcamera.org/api/patches/11902/?format=json","web_url":"https://patchwork.libcamera.org/patch/11902/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210413075013.3069213-4-hiroh@chromium.org>","date":"2021-04-13T07:50:11","name":"[libcamera-devel,RFC,v2,3/5] libcamera: SensorDatabase: Adds table of v4l2 name and test pattern","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"aed28a883a4aff9454e6f2e7fc6a52bea555b3c9","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11902/mbox/","series":[{"id":1916,"url":"https://patchwork.libcamera.org/api/series/1916/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1916","date":"2021-04-13T07:50:08","name":"Report available test pattern modes","version":2,"mbox":"https://patchwork.libcamera.org/series/1916/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11902/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11902/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9A92ABD224\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Apr 2021 07:50:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5802068806;\n\tTue, 13 Apr 2021 09:50:31 +0200 (CEST)","from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com\n\t[IPv6:2607:f8b0:4864:20::1031])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 43C9668807\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 09:50:30 +0200 (CEST)","by mail-pj1-x1031.google.com with SMTP id\n\tnm3-20020a17090b19c3b029014e1bbf6c60so4370038pjb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Apr 2021 00:50:30 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:84f5:7981:dfbe:8f02])\n\tby smtp.gmail.com with ESMTPSA id\n\tn25sm11525125pff.154.2021.04.13.00.50.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 13 Apr 2021 00:50:28 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"TwC0j3iP\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=rlsUuEqcdG8AY1Z79fV2Ci85GOWZ0WM8QyxR3iApWQg=;\n\tb=TwC0j3iP7GMddqP7G4IDRT68fxUc7ivUaP89NXGOR0XmImlAwQEeZHpFU1hw3ei9Ck\n\t5ecNVT8R0YRQA2CNgZ8AvCPo3uY6L15w+gffxmUt69xP9LoYWW7wivCXLyaoojIh3Dkg\n\tX8Xpw7eexvgYZYWrUuQdKDuUoCdnyO9tSVy40=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=rlsUuEqcdG8AY1Z79fV2Ci85GOWZ0WM8QyxR3iApWQg=;\n\tb=f1ftk3X/7zaJ7XCs/rpYRuebDN5qkL3kBAV4jrmADYPSgBJpy4Htx6GPmPqAVkVRGC\n\toCeF2XsjZ5TC7TB1I7ZZm4hbtRb/aBxCx/B09zdhZivpfMwd+/O57zLkt5wA77pbIIE5\n\tpvO7aFhNwQJ5q19tCmSmIAf3l1LrJkQGCtDyeScBnJNhLdemaruHuYVDLjFq8s+LZvLz\n\tAhOoRHXdlh0yxitp2ZClfbYEsdltB068gYf4Ol5LaRcAA+IF0cskhixOchcDQLyx2+l9\n\t83rVbusKypxmN4NFFW7q9LmdIpPC+70xdyi6IsdSOrbkKUQrbbe8q2dzHDQezDA4x8CV\n\tpojQ==","X-Gm-Message-State":"AOAM531860bpupAPK2Yvp/MIC2NtQpJisgOCzTm7LtRQYlyLx4OxrpH3\n\tmICyEcTBH0wh1wlwCJQOrQVeB21M7zk18w==","X-Google-Smtp-Source":"ABdhPJyIkl3NS4wKy1q1H8Nox9M0bKnCZ3QdFrAALsPkLbjuGroC4Px0niPk6Qc5lhgeWDWQITeYvw==","X-Received":"by 2002:a17:90a:c3:: with SMTP id\n\tv3mr3633754pjd.55.1618300228720; \n\tTue, 13 Apr 2021 00:50:28 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","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:\n\tAdds table of v4l2 name and test pattern","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"jmondi@jacopo.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In V4L2 API, a driver returns a name to represent a test pattern,\nbut it is a driver specific what test pattern is represented by\nthe name. Therefore, this adds a mapping table from the name to\na test pattern into a static configuration of a sensor.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/sensor_database.h |  2 ++\n src/libcamera/sensor_database.cpp            | 37 ++++++++++++++++++--\n 2 files changed, 36 insertions(+), 3 deletions(-)","diff":"diff --git a/include/libcamera/internal/sensor_database.h b/include/libcamera/internal/sensor_database.h\nindex 7d743e46..c0b181f8 100644\n--- a/include/libcamera/internal/sensor_database.h\n+++ b/include/libcamera/internal/sensor_database.h\n@@ -10,11 +10,13 @@\n #include <string>\n \n #include <libcamera/geometry.h>\n+#include <libcamera/span.h>\n \n namespace libcamera {\n \n struct SensorInfo {\n \tSize unitCellSize;\n+\tSpan<const std::pair<const char *, int32_t>> testPatternModeMap;\n };\n \n class SensorDatabase\ndiff --git a/src/libcamera/sensor_database.cpp b/src/libcamera/sensor_database.cpp\nindex 68e69e8b..a71e8958 100644\n--- a/src/libcamera/sensor_database.cpp\n+++ b/src/libcamera/sensor_database.cpp\n@@ -9,6 +9,8 @@\n \n #include <algorithm>\n \n+#include \"libcamera/control_ids.h\"\n+\n namespace libcamera {\n \n /**\n@@ -43,25 +45,54 @@ namespace libcamera {\n \n namespace {\n \n+constexpr std::pair<const char *, int32_t> imx219TestPatternModeMap[] = {\n+\t{ \"Disabled\", controls::draft::SensorTestPatternModeOff },\n+\t{ \"Color Bars\", controls::draft::SensorTestPatternModeColorBars },\n+\t{ \"Solid Color\", controls::draft::SensorTestPatternModeSolidColor },\n+\t{ \"Grey Color Bars\", controls::draft::SensorTestPatternModeColorBarsFadeToGray },\n+\t{ \"PN9\", controls::draft::SensorTestPatternModePn9 },\n+};\n+\n+constexpr std::pair<const char *, int32_t> ov5670TestPatternModeMap[] = {\n+\t{ \"Disabled\", controls::draft::SensorTestPatternModeOff },\n+\t{ \"Vertical Color Bar Type 1\", controls::draft::SensorTestPatternModeColorBars },\n+};\n+\n+constexpr std::pair<const char *, int32_t> ov13858TestPatternModeMap[] = {\n+\t{ \"Disabled\", controls::draft::SensorTestPatternModeOff },\n+\t{ \"Vertical Color Bar Type 1\", controls::draft::SensorTestPatternModeColorBars },\n+\t{ \"Vertical Color Bar Type 2\", controls::draft::SensorTestPatternModeColorBarsFadeToGray },\n+};\n+\n /**\n  * \\brief Sony IMX219 sensor properties\n  */\n constexpr SensorInfo imx219Info = {\n-\t.unitCellSize = { 1120, 1120 }\n+\t.unitCellSize = { 1120, 1120 },\n+\t.testPatternModeMap =\n+\t\tlibcamera::Span<const std::pair<const char *, int32_t>>(\n+\t\t\timx219TestPatternModeMap),\n };\n \n /**\n  * \\brief Omnivision ov5670 sensor properties\n  */\n constexpr SensorInfo ov5670Info = {\n-\t.unitCellSize = { 1120, 1120 }\n+\t.unitCellSize = { 1120, 1120 },\n+\t.testPatternModeMap =\n+\t\tlibcamera::Span<const std::pair<const char *, int32_t>>(\n+\t\t\tov5670TestPatternModeMap),\n };\n \n /**\n  * \\brief Omnivision 13858 sensor properties\n  */\n constexpr SensorInfo ov13858Info = {\n-\t.unitCellSize = { 1120, 1120 }\n+\t.unitCellSize = { 1120, 1120 },\n+\t.testPatternModeMap =\n+\t\tlibcamera::Span<const std::pair<const char *, int32_t>>(\n+\t\t\tov13858TestPatternModeMap),\n+\n };\n \n #define SENSOR_INFO(_sensor) \\\n","prefixes":["libcamera-devel","RFC","v2","3/5"]}