{"id":12466,"url":"https://patchwork.libcamera.org/api/patches/12466/?format=json","web_url":"https://patchwork.libcamera.org/patch/12466/","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":"<20210528030531.189492-4-hiroh@chromium.org>","date":"2021-05-28T03:05:29","name":"[libcamera-devel,v6,4/6] libcamera: CameraSensor: Enable retrieving supported test pattern modes","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"345e99d5ab8c96f15664237341d5716872db1c87","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/12466/mbox/","series":[{"id":2089,"url":"https://patchwork.libcamera.org/api/series/2089/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2089","date":"2021-05-28T03:05:26","name":"[libcamera-devel,v6,1/6] libcamera: controls: Add sensor test pattern mode","version":6,"mbox":"https://patchwork.libcamera.org/series/2089/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12466/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12466/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 9D7CDC3207\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 May 2021 03:05:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5CB3268933;\n\tFri, 28 May 2021 05:05:46 +0200 (CEST)","from mail-pg1-x531.google.com (mail-pg1-x531.google.com\n\t[IPv6:2607:f8b0:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0564868929\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 May 2021 05:05:43 +0200 (CEST)","by mail-pg1-x531.google.com with SMTP id i5so1519963pgm.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 May 2021 20:05:42 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:caec:ab3b:ea16:3d01])\n\tby smtp.gmail.com with ESMTPSA id\n\tl20sm2892051pjq.38.2021.05.27.20.05.39\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 27 May 2021 20:05:40 -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=\"n65a2hhU\"; 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=L7UhLYlZoGGrSQ1X2nz/Pg5KvfexOUFGt+cI8mulf+w=;\n\tb=n65a2hhUPQmec+LMBb5av2t5r8GLQMUO12/3xrFYRRNaIHaf2k0ZBErN6HXoy+XmMj\n\t6L0cKhVVHMxBTbSuk5O6DNZrLhdxrpAFMLSukp/hsuV7kXzgTyGLET68A7YWJISQL67U\n\tCVDDgq4yPQ+5YuRS20YevOPFWxTL3dh1EjT0w=","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=L7UhLYlZoGGrSQ1X2nz/Pg5KvfexOUFGt+cI8mulf+w=;\n\tb=obLiQ/tEvGv1fhUrUFOOcYwLlpStn+gaZUmLIn0iZHbk5vEP7wc9oJ+eamZGZxsju9\n\tc3Mj9czHycp6J802/l71xwjnC/ty8sEQ9I54Yx+jNGMIHhTr5dBRgrytFNhJb2o/jfIL\n\tEaChTnwetYNxFDPn5q+WjwSH5nFq/Fmk2gF5CyqhHTitwtHimsNxF4pia4u99dHIXgOj\n\tidrcmbZPG/oICxlX84pZ+Jxfc5paP9mLGOGVrG15BrdqWeN/rCHCc+8OHOOXQVpQkSgr\n\tIdXFVk7tfnVb3xgcqRh0g77gPv5hXph/deX9Bzg0BUPGtDk2umDL4P+OHTPKffPqZmVC\n\tWg0Q==","X-Gm-Message-State":"AOAM533tSV/5WzOWGp6YRPt3s0EE9/0wNPbMDeps+BuVKRSlRZ7RZTbA\n\tsRL49sEVwufDmsfQti4u3DqnK9foftuoFg==","X-Google-Smtp-Source":"ABdhPJwFhRBNeAswO3LoIYStLkcINQYF4bCGLR1El/53OP39Lm68hOfSgX+HqeGeYmTMV4PpnGYjUA==","X-Received":"by 2002:a63:b64:: with SMTP id a36mr6758171pgl.437.1622171141361;\n\tThu, 27 May 2021 20:05:41 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 28 May 2021 12:05:29 +0900","Message-Id":"<20210528030531.189492-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.32.0.rc0.204.g9fa02ecfa5-goog","In-Reply-To":"<20210528030531.189492-1-hiroh@chromium.org>","References":"<20210528030531.189492-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v6 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>\n---\n include/libcamera/internal/camera_sensor.h |  7 +++++\n src/libcamera/camera_sensor.cpp            | 32 ++++++++++++++++++++++\n 2 files changed, 39 insertions(+)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex cf6c1c1e..dcde647d 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<uint8_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@@ -66,6 +70,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@@ -77,6 +83,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 0fb8a258..44dd5988 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -297,6 +297,30 @@ 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)\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 void CameraSensor::initStaticProperties()\n {\n \tconst CameraSensorProperties *props = CameraSensorProperties::get(model_);\n@@ -305,6 +329,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@@ -469,6 +495,12 @@ 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+ * \\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","v6","4/6"]}