{"id":12203,"url":"https://patchwork.libcamera.org/api/patches/12203/?format=json","web_url":"https://patchwork.libcamera.org/patch/12203/","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":"<20210506075449.1761752-5-hiroh@chromium.org>","date":"2021-05-06T07:54:47","name":"[libcamera-devel,v4,4/6] libcamera: CameraSensor: Enable retrieving supported test pattern modes","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4cb71756bf1e76c53e3fb604cd8c124c64d285cd","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/12203/mbox/","series":[{"id":2001,"url":"https://patchwork.libcamera.org/api/series/2001/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2001","date":"2021-05-06T07:54:43","name":"[libcamera-devel,v4,1/6] libcamera: controls: Add sensor test pattern mode","version":4,"mbox":"https://patchwork.libcamera.org/series/2001/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12203/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12203/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 3F537BDE7F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 May 2021 07:55:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 03EFD6891A;\n\tThu,  6 May 2021 09:55:06 +0200 (CEST)","from mail-pl1-x631.google.com (mail-pl1-x631.google.com\n\t[IPv6:2607:f8b0:4864:20::631])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 083DC68909\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 May 2021 09:55:04 +0200 (CEST)","by mail-pl1-x631.google.com with SMTP id e2so2963928plh.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 06 May 2021 00:55:03 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:ede4:ae0e:d4a4:c0d3])\n\tby smtp.gmail.com with ESMTPSA id\n\tf201sm1355546pfa.133.2021.05.06.00.55.00\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 06 May 2021 00:55:01 -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=\"Ilmu2rLk\"; 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=Nnxe3t/m2aQ4jveD/IHf+jGScVBJRRDKzf8zxTd2kDs=;\n\tb=Ilmu2rLkjHDIXUntkC/LGsUU+2KzTdL8vVyX2/PWmaXqF5DxtL6d4guO0rjkNRBzzp\n\tGm6VcdTsw2h2FFqPpYEK7Icwf9dUjpnTjhdkKuGqZOqjFhNcJmBwuPlM4b6cg38clGaN\n\t7O00piwp7gXw88MbnzqwpH5ASrRarYc6UbiNw=","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=Nnxe3t/m2aQ4jveD/IHf+jGScVBJRRDKzf8zxTd2kDs=;\n\tb=TOaCxy2+/F5TjUZ1xLwkX57pYAEZDLWJ42eidjmC1rR/e1jxqnlMr0ahE5mFgR2tF2\n\thS5eHdnkpzHB5Bq2DeVqc5G2HqunU1E4bDM4DzBiLyQxLwGsLn6fGBLMH0O7EqH0Hcxd\n\tk19v8xmicJB9W9AOMecyGRb0CxWZfwJLc8ZaE2413nDGIX/EFj+mPekcawxmovSLyr25\n\tExld0qN/PjhztzkNWn13yyPDcaAyEOULTVhXLHw/FhunQKabNpgEuelVHbgPofJZ/J9o\n\tnNhsItgyMbNyW0GTYIV8c3LR72N04Ac5yceuU9V9p2HNtR3KQowzkv4oVpADOe04+Ljq\n\tqSGw==","X-Gm-Message-State":"AOAM533XD6//XxK4Tc2NNcRrNshR3ABxv73QCSHJxLSZxoCh+bA7nLm1\n\t0VPw4oKVZufHvLZ8GymHdyJtCdUwvwlsRw==","X-Google-Smtp-Source":"ABdhPJy53gPvbfGJhsPbWH1pGxLJDyGGhDCljoNxcaqo1GsGYJ8p40E0ICKLFK6Jm5ZlzbN1K3MY1A==","X-Received":"by 2002:a17:902:778d:b029:ee:f821:f56d with SMTP id\n\to13-20020a170902778db02900eef821f56dmr3285525pll.79.1620287701793; \n\tThu, 06 May 2021 00:55:01 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  6 May 2021 16:54:47 +0900","Message-Id":"<20210506075449.1761752-5-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.607.g51e8a6a459-goog","In-Reply-To":"<20210506075449.1761752-1-hiroh@chromium.org>","References":"<20210506075449.1761752-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 4/6] libcamera: CameraSensor: Enable\n\tretrieving supported test pattern modes","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>","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":"This enables retrieving supported test pattern modes through\nCameraSensorInfo.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n include/libcamera/internal/camera_sensor.h |  5 ++++\n src/libcamera/camera_sensor.cpp            | 28 ++++++++++++++++++++++\n 2 files changed, 33 insertions(+)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 3fa3a419..115e266d 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -38,6 +38,8 @@ struct CameraSensorInfo {\n \n \tuint32_t minFrameLength;\n \tuint32_t maxFrameLength;\n+\n+\tstd::vector<int32_t> testPatternModes;\n };\n \n class CameraSensor : protected Loggable\n@@ -79,6 +81,8 @@ private:\n \tvoid initVimcDefaultProperties();\n \tvoid initStaticProperties();\n \tint initProperties();\n+\tvoid initTestPatternModes(\n+\t\tconst std::map<int32_t, int32_t> &testPatternModeMap);\n \n \tconst MediaEntity *entity_;\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\n@@ -90,6 +94,7 @@ private:\n \tV4L2Subdevice::Formats formats_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\tstd::vector<int32_t> testPatternModes_;\n \n \tSize pixelArraySize_;\n \tRectangle activeArea_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 1db263cf..eedd2f89 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -408,6 +408,32 @@ void CameraSensor::initVimcDefaultProperties()\n \tactiveArea_ = Rectangle(pixelArraySize_);\n }\n \n+void CameraSensor::initTestPatternModes(\n+\tconst std::map<int32_t, int32_t> &testPatternModeMap)\n+{\n+\tconst auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);\n+\tif (v4l2TestPattern == controls().end()) {\n+\t\tLOG(CameraSensor, Debug) << \"No static test pattern map for \\'\"\n+\t\t\t\t\t << model() << \"\\'\";\n+\t\treturn;\n+\t}\n+\n+\tfor (const ControlValue &value : v4l2TestPattern->second.values()) {\n+\t\tconst int32_t index = value.get<int32_t>();\n+\n+\t\tconst auto it = testPatternModeMap.find(index);\n+\t\tif (it != testPatternModeMap.end()) {\n+\t\t\tLOG(CameraSensor, Debug) << \"Test pattern mode (index=\"\n+\t\t\t\t\t\t << index << \") ignored\";\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tLOG(CameraSensor, Debug) << \"Test pattern mode (index=\"\n+\t\t\t\t\t << index << \") added\";\n+\t\ttestPatternModes_.push_back(it->second);\n+\t}\n+}\n+\n void CameraSensor::initStaticProperties()\n {\n \tconst CameraSensorProperties *props = CameraSensorProperties::get(model_);\n@@ -416,6 +442,8 @@ void CameraSensor::initStaticProperties()\n \n \t/* Register the properties retrieved from the sensor database. */\n \tproperties_.set(properties::UnitCellSize, props->unitCellSize);\n+\n+\tinitTestPatternModes(props->testPatternModeMap);\n }\n \n int CameraSensor::initProperties()\n","prefixes":["libcamera-devel","v4","4/6"]}