{"id":12128,"url":"https://patchwork.libcamera.org/api/1.1/patches/12128/?format=json","web_url":"https://patchwork.libcamera.org/patch/12128/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20210428073617.373422-6-hiroh@chromium.org>","date":"2021-04-28T07:36:15","name":"[libcamera-devel,v3,5/7] libcamera: CameraSensor: Enable retrieving supported test pattern modes","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"908b5499373960b74bd8ad00bd7ecdbeeca484fa","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12128/mbox/","series":[{"id":1983,"url":"https://patchwork.libcamera.org/api/1.1/series/1983/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1983","date":"2021-04-28T07:36:10","name":"Report Android HAL client test pattern modes","version":3,"mbox":"https://patchwork.libcamera.org/series/1983/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12128/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12128/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 60A80BDE44\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Apr 2021 07:36:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19B8A688C2;\n\tWed, 28 Apr 2021 09:36:36 +0200 (CEST)","from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com\n\t[IPv6:2607:f8b0:4864:20::102f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3245E688C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Apr 2021 09:36:32 +0200 (CEST)","by mail-pj1-x102f.google.com with SMTP id\n\tk3-20020a17090ad083b0290155b934a295so2181670pju.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Apr 2021 00:36:32 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:489:a5f4:117:7d51])\n\tby smtp.gmail.com with ESMTPSA id\n\tm11sm1661265pgs.4.2021.04.28.00.36.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 28 Apr 2021 00:36:30 -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=\"XnN+XEDX\"; 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=4SL2EcLkX9gZT8o1MSisScpd/e0VL4ERGSUlnE+efPs=;\n\tb=XnN+XEDX7ctn8yiPZ+6hBfHIDmz1CGOQKbgGzEcVZkgMYzGddp+RjKusxXY6x+BVuD\n\tMK+y3E+wM6DPK795LrghneoHY8xnq0iyjAh9YOx6ZEm9AaUnzL0y6VEJHqVLLIdhjIlf\n\tnDr1140/Quie8+wgP048IlubtYjBBG+JzGmrA=","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=4SL2EcLkX9gZT8o1MSisScpd/e0VL4ERGSUlnE+efPs=;\n\tb=DUTaY9x8sMh9wrnzknCHpGZhXd6Lsq8FM0+wTpjJTUmpfIxC7MVj/UnrXgKNH+Psk6\n\tQSjAv6tITMiXmzpDn7Y/NnMA5xU3zXJDy4S6qDZiULlIXt7w9HLTGIINk8fZ7VF7hZhK\n\tW1xxc8dCWTNWJNSSOUezCBPGdqj0ebcl1klMuJ6k41cjpT6UDk4CPmGq2IvMJttU1r6Y\n\tlLLXj4FpRlb7USJFJP4X1iZ9kWnMdswoA449I4COsqVtWfZ+gKsS2je4sXgvNM7zrPu8\n\tcT5lodoTWpLzXGScIE6OY7UFxzAkgbGFlkdl52nw59Pab+VDOa5pBPg3OtvcSn0ut21C\n\tw7bg==","X-Gm-Message-State":"AOAM530oirXob8WTeCgRN+ecdDnlNGuoIBm5E4HrT/HzmbnKLbx3k8mI\n\tLwicTXyu+L5WwHZPSuwqziMsHnhDkSCg2A==","X-Google-Smtp-Source":"ABdhPJxC3VYL7v+CQO456NYpwem7fXvgRRUIxC6gS0nq3U7lRmgOZzvgCfqTItyVpun1n0yYBvseAg==","X-Received":"by 2002:a17:90b:4ac1:: with SMTP id\n\tmh1mr2535892pjb.95.1619595390460; \n\tWed, 28 Apr 2021 00:36:30 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 28 Apr 2021 16:36:15 +0900","Message-Id":"<20210428073617.373422-6-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.1.498.g6c1eba8ee3d-goog","In-Reply-To":"<20210428073617.373422-1-hiroh@chromium.org>","References":"<20210428073617.373422-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 5/7] 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            | 40 ++++++++++++++++++++++\n 2 files changed, 45 insertions(+)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex 3fa3a419..eec37a54 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<std::string, 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 850c94b3..a5c0fff7 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -411,6 +411,42 @@ void CameraSensor::initVimcDefaultProperties()\n \tactiveArea_ = Rectangle(pixelArraySize_);\n }\n \n+void CameraSensor::initTestPatternModes(\n+\tconst std::map<std::string, 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+\tconst std::vector<ControlValue> &indices = v4l2TestPattern->second.values();\n+\tconst std::vector<ControlValue> &names = v4l2TestPattern->second.extraValues();\n+\tif (indices.size() != names.size()) {\n+\t\tLOG(CameraSensor, Error)\n+\t\t\t<< \"The number of indices and names are different\"\n+\t\t\t<< \", indices.size()=\" << indices.size()\n+\t\t\t<< \", names.size()=\" << names.size();\n+\t\treturn;\n+\t}\n+\n+\tfor (const ControlValue &value : names) {\n+\t\tconst std::string &name = value.get<std::string>();\n+\n+\t\tconst auto it = testPatternModeMap.find(name);\n+\t\tif (it != testPatternModeMap.end()) {\n+\t\t\tLOG(CameraSensor, Debug) << \"Test pattern mode named \\'\"\n+\t\t\t\t\t\t << name << \"\\' ignored\";\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tLOG(CameraSensor, Debug) << \"Test pattern mode named \\'\"\n+\t\t\t\t\t << name << \"\\' added\";\n+\t\ttestPatternModes_.push_back(it->second);\n+\t}\n+}\n+\n void CameraSensor::initStaticProperties()\n {\n \tconst SensorInfo *info = SensorDatabase::get(model_);\n@@ -424,6 +460,8 @@ void CameraSensor::initStaticProperties()\n \n \t/* Register the properties retrieved from the sensor database. */\n \tproperties_.set(properties::UnitCellSize, info->unitCellSize);\n+\n+\tinitTestPatternModes(info->testPatternModeMap);\n }\n \n int CameraSensor::initProperties()\n@@ -840,6 +878,8 @@ int CameraSensor::sensorInfo(CameraSensorInfo *info) const\n \tinfo->minFrameLength = info->outputSize.height + vblank.min().get<int32_t>();\n \tinfo->maxFrameLength = info->outputSize.height + vblank.max().get<int32_t>();\n \n+\tinfo->testPatternModes = testPatternModes_;\n+\n \treturn 0;\n }\n \n","prefixes":["libcamera-devel","v3","5/7"]}