{"id":12318,"url":"https://patchwork.libcamera.org/api/patches/12318/?format=json","web_url":"https://patchwork.libcamera.org/patch/12318/","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":"<20210519075941.1337388-4-hiroh@chromium.org>","date":"2021-05-19T07:59:39","name":"[libcamera-devel,v5,4/6] libcamera: CameraSensor: Enable retrieving supported test pattern modes","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"1f234dac44ce50de516c1613b7f74a5e7ad90904","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/12318/mbox/","series":[{"id":2037,"url":"https://patchwork.libcamera.org/api/series/2037/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2037","date":"2021-05-19T07:59:36","name":"[libcamera-devel,v5,1/6] libcamera: controls: Add sensor test pattern mode","version":5,"mbox":"https://patchwork.libcamera.org/series/2037/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12318/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12318/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 4E6D4C31FF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 19 May 2021 07:59:56 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D9B068922;\n\tWed, 19 May 2021 09:59:56 +0200 (CEST)","from mail-pl1-x636.google.com (mail-pl1-x636.google.com\n\t[IPv6:2607:f8b0:4864:20::636])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0A90668911\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 May 2021 09:59:54 +0200 (CEST)","by mail-pl1-x636.google.com with SMTP id t4so6561684plc.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 May 2021 00:59:53 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:3948:91a2:b8ec:1976])\n\tby smtp.gmail.com with ESMTPSA id\n\t80sm1160847pfw.200.2021.05.19.00.59.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 19 May 2021 00:59:51 -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=\"Xr1YNuIE\"; 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=ca7p7pwmIpKOHnXcAv//FM45O9IVcfFgEJGNcZtP60A=;\n\tb=Xr1YNuIEUV4IGFyro8BbVnhfRu+bYZ337eb+CMaP8G2kjyrK3QbOdWpWp59NJxIw4u\n\tmgvnxY85H42yfPfTRdjPisWg8KXiinPyNLx4/XCdCt0r2fRf/REptnwNeXIM86KJQ+GD\n\tdfrDysIRxBcJeGElMxwR9V9iODExET9sOXfkU=","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=ca7p7pwmIpKOHnXcAv//FM45O9IVcfFgEJGNcZtP60A=;\n\tb=Yo8OXhpo/OtD6ozlUVSjWcAa1vxdLRq4Z6TN4Dp13K+cZkxFV5hGX/rEdkhh9pqxLJ\n\tA8liouOy1vG56/N7RbIng73EkskoSQlXhRJpc8QTnU9UmcsqFoWDx2HlyW8tta+DiU/r\n\t6iM9JRPGIk2ZiJzx3Yi5sa2RyY2ksom4HKuTLwx+8HO0lIR+2s/sb/MgMHCtV3CRh+xc\n\t7sA/eFsriKipb1Fz1beqt5/JYQgueava3JikwHPgJ51YotqUwwlujma3BfdD3YpFZfD3\n\tf2JJ78/krgYlGHifYmn5q1Sdt14cnrrAqLolDMB+OGCZT2e7SHbk7w/CtoUqI5DCAfDY\n\tqJ0A==","X-Gm-Message-State":"AOAM533Ywaj6Wk7yHw3pdbrTPzQugHGPpT3uaOYsb7gdUkz1843NNaQC\n\tClV70/VgyrTRZ0Ax/ipQo4q74DT3OwPmcQ==","X-Google-Smtp-Source":"ABdhPJzhq3ceDaJyuQWBlGNsQKQpRUD61Pw7l6JZ4N66LiBd9ZUiW+AIudIHEoUfa+ntQ1y8wYS/xg==","X-Received":"by 2002:a17:902:854a:b029:ef:3f99:91a7 with SMTP id\n\td10-20020a170902854ab02900ef3f9991a7mr9628927plo.74.1621411192184; \n\tWed, 19 May 2021 00:59:52 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 19 May 2021 16:59:39 +0900","Message-Id":"<20210519075941.1337388-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.751.gd2f1c929bd-goog","In-Reply-To":"<20210519075941.1337388-1-hiroh@chromium.org>","References":"<20210519075941.1337388-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 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>\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 2a5c51a1..59d1188f 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -58,6 +58,10 @@ public:\n \tV4L2SubdeviceFormat getFormat(const std::vector<unsigned int> &mbusCodes,\n \t\t\t\t      const Size &size) const;\n \tint setFormat(V4L2SubdeviceFormat *format);\n+\tconst std::vector<uint8_t> &testPatternModes() const\n+\t{\n+\t\treturn testPatternModes_;\n+\t}\n \n \tconst ControlInfoMap &controls() const;\n \tControlList getControls(const std::vector<uint32_t> &ids);\n@@ -81,6 +85,8 @@ private:\n \tvoid initVimcDefaultProperties();\n \tvoid initStaticProperties();\n \tint initProperties();\n+\tvoid initTestPatternModes(\n+\t\tconst std::map<uint8_t, uint8_t> &testPatternModeMap);\n \n \tconst MediaEntity *entity_;\n \tstd::unique_ptr<V4L2Subdevice> subdev_;\n@@ -92,6 +98,7 @@ private:\n \tV4L2Subdevice::Formats formats_;\n \tstd::vector<unsigned int> mbusCodes_;\n \tstd::vector<Size> sizes_;\n+\tstd::vector<uint8_t> testPatternModes_;\n \n \tSize pixelArraySize_;\n \tRectangle activeArea_;\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex eb84d9eb..a6aed417 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<uint8_t, uint8_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@@ -767,6 +795,12 @@ int CameraSensor::setControls(ControlList *ctrls)\n  * \\return The list of camera sensor properties\n  */\n \n+/**\n+ * \\fn CameraSensor::testPatternModes()\n+ * \\brief Retrieve all the supported test pattern modes of the camera sensor\n+ * \\return The list of test pattern modes.\n+ */\n+\n /**\n  * \\brief Assemble and return the camera sensor info\n  * \\param[out] info The camera sensor info\n","prefixes":["libcamera-devel","v5","4/6"]}