{"id":12548,"url":"https://patchwork.libcamera.org/api/patches/12548/?format=json","web_url":"https://patchwork.libcamera.org/patch/12548/","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":"<20210610082539.529739-4-hiroh@chromium.org>","date":"2021-06-10T08:25:37","name":"[libcamera-devel,v8,4/6] libcamera: CameraSensor: Enable retrieving supported test pattern modes","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"bc7912573ff78649a97cb57434fb3822bad9deed","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/12548/mbox/","series":[{"id":2117,"url":"https://patchwork.libcamera.org/api/series/2117/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2117","date":"2021-06-10T08:25:34","name":"[libcamera-devel,v8,1/6] libcamera: controls: Add sensor test pattern mode","version":8,"mbox":"https://patchwork.libcamera.org/series/2117/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12548/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12548/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 8296ABD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 08:25:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 458D468939;\n\tThu, 10 Jun 2021 10:25:53 +0200 (CEST)","from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com\n\t[IPv6:2607:f8b0:4864:20::52d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA36E68935\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 10:25:51 +0200 (CEST)","by mail-pg1-x52d.google.com with SMTP id y11so13856038pgp.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 01:25:51 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:203:98e0:b356:1c8a:25d4])\n\tby smtp.gmail.com with ESMTPSA id\n\tx3sm2087011pgx.8.2021.06.10.01.25.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 10 Jun 2021 01:25:49 -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=\"LCeEBi6c\"; 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=9K5PveEwZBbwwCEIhfIir0TSqZrkTwudduhTEgwn/MQ=;\n\tb=LCeEBi6c2jhhWVy5qCkNDb5KobY9t6hZhyU2F2AJnmQcBPEKf5DKqZR560AqVhQNW0\n\tCJPBUes7Lc/6dcgX0JiL1YhSSNMoBI3CSq4lxWRZyPvm2owM/Xjj9yYI/h/uhcHLInps\n\tdfVT92wyw/3QrleS6CqVspzqmI5sJ297pOP74=","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=9K5PveEwZBbwwCEIhfIir0TSqZrkTwudduhTEgwn/MQ=;\n\tb=tdhfQfKLwSXaKBzQJw5fzuE9B+6yj4y8i7Tv73ANSxOpMSH/zXSrcb2J5M8GnYZEwq\n\tjK1/JTk4omHxk2b853q5PLP+sxLcuZA6Umv+QVljZ9BYShnv1MzMZb2Z3AF/n1+ikBdF\n\tXbroVgOxVBz/J5iYwPUqSzo0RwebWDSoZOwHlqFFM0Z338W1rhtw67L+5kRQQzoZqZxW\n\tWeFXhm3hGb/hVXv4wvKeNtb0AH6Bkw1V9hPFK5tG4byfpENPmBBXGfcjZixy2S9R6Bua\n\tE3wwfVO9pYvtiZQSEiJfwiye62tKqzzg5IKnHMzA/Mc7skP+yTYvZ4WNW2TaE3QEMY6z\n\t7yPg==","X-Gm-Message-State":"AOAM533+6dWk9/3pgFdmZ8F/w8bY199VLQHDlF/3QrHDGh9/gap7fk9r\n\t6yG7JzQRsBKMU56keqscDBESohnpsTnUmQ==","X-Google-Smtp-Source":"ABdhPJx1Glb6NzJ4+eGOAL+2DEl1hcLbjp4oGYv9yS0bkxKvHlFa+b5W7dlBHxmGV1cEWrZM09yp8A==","X-Received":"by 2002:a63:ec03:: with SMTP id j3mr3825560pgh.272.1623313550371;\n\tThu, 10 Jun 2021 01:25:50 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 10 Jun 2021 17:25:37 +0900","Message-Id":"<20210610082539.529739-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.32.0.rc1.229.g3e70b5a671-goog","In-Reply-To":"<20210610082539.529739-1-hiroh@chromium.org>","References":"<20210610082539.529739-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v8 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>","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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/camera_sensor.h |  7 +++++\n src/libcamera/camera_sensor.cpp            | 34 ++++++++++++++++++++++\n 2 files changed, 41 insertions(+)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex cf6c1c1e..e133ebf4 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -39,6 +39,10 @@ public:\n \tconst std::vector<unsigned int> &mbusCodes() const { return mbusCodes_; }\n \tconst std::vector<Size> &sizes() const { return sizes_; }\n \tSize resolution() const;\n+\tconst std::vector<int32_t> &testPatternModes() const\n+\t{\n+\t\treturn testPatternModes_;\n+\t}\n \n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t      const Size &size) const;\n@@ -65,6 +69,8 @@ private:\n \tint validateSensorDriver();\n \tvoid initVimcDefaultProperties();\n \tvoid initStaticProperties();\n+\tvoid initTestPatternModes(\n+\t\tconst std::map<int32_t, int32_t> &testPatternModeMap);\n \tint initProperties();\n \n \tconst MediaEntity *entity_;\n@@ -77,6 +83,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 0fb8a258..3e135353 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -305,6 +305,32 @@ 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->testPatternModes);\n+}\n+\n+void CameraSensor::initTestPatternModes(\n+\tconst std::map<int32_t, int32_t> &testPatternModes)\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 = testPatternModes.find(index);\n+\t\tif (it == testPatternModes.end()) {\n+\t\t\tLOG(CameraSensor, Debug)\n+\t\t\t\t<< \"Test pattern mode \" << index << \" ignored\";\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\ttestPatternModes_.push_back(it->second);\n+\t}\n }\n \n int CameraSensor::initProperties()\n@@ -469,6 +495,14 @@ Size CameraSensor::resolution() const\n \treturn std::min(sizes_.back(), activeArea_.size());\n }\n \n+/**\n+ * \\fn CameraSensor::testPatternModes()\n+ * \\brief Retrieve all the supported test pattern modes of the camera sensor\n+ * The test pattern mode values correspond to the controls::TestPattern control.\n+ *\n+ * \\return The list of test pattern modes\n+ */\n+\n /**\n  * \\brief Retrieve the best sensor format for a desired output\n  * \\param[in] mbusCodes The list of acceptable media bus codes\n","prefixes":["libcamera-devel","v8","4/6"]}