{"id":2635,"url":"https://patchwork.libcamera.org/api/1.1/patches/2635/?format=json","web_url":"https://patchwork.libcamera.org/patch/2635/","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":"<20200113164245.52535-21-jacopo@jmondi.org>","date":"2020-01-13T16:42:42","name":"[libcamera-devel,20/23] DNI: test compound controls","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b405f934f985f1206573fa995ae79f9ba73204c1","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":{"id":15,"url":"https://patchwork.libcamera.org/api/1.1/users/15/?format=json","username":"jmondi","first_name":"Jacopo","last_name":"Mondi","email":"jacopo@jmondi.org"},"mbox":"https://patchwork.libcamera.org/patch/2635/mbox/","series":[{"id":618,"url":"https://patchwork.libcamera.org/api/1.1/series/618/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=618","date":"2020-01-13T16:42:22","name":"Properties and compound controls","version":1,"mbox":"https://patchwork.libcamera.org/series/618/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2635/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2635/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69CC66073E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jan 2020 17:40:39 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id C508A100011;\n\tMon, 13 Jan 2020 16:40:38 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 13 Jan 2020 17:42:42 +0100","Message-Id":"<20200113164245.52535-21-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.24.0","In-Reply-To":"<20200113164245.52535-1-jacopo@jmondi.org>","References":"<20200113164245.52535-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 20/23] DNI: test compound controls","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>","X-List-Received-Date":"Mon, 13 Jan 2020 16:40:41 -0000"},"content":"Define a fictional compound control and register it in  the VIMC\npipeline handler. Add a test to exercize it.\n\nDo not include, just a proof of concept. The test could be included once\nwe'll have real compound controls defined.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/control_ids.yaml      |  5 ++\n src/libcamera/pipeline/vimc.cpp     |  5 ++\n test/controls/compound_controls.cpp | 71 +++++++++++++++++++++++++++++\n test/controls/meson.build           |  1 +\n 4 files changed, 82 insertions(+)\n create mode 100644 test/controls/compound_controls.cpp","diff":"diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 4befec746a59..1bdece651638 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -50,4 +50,9 @@ controls:\n       type: int32_t\n       description: Specify a fixed gain parameter\n \n+  - CompoundControl:\n+      type: int32_t\n+      description: A fictional compound control\n+      compound: true\n+\n ...\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex 2df5447177fa..2bcb9f2248e6 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -453,6 +453,11 @@ int VimcCameraData::init(MediaDevice *media)\n \t\t\t      std::forward_as_tuple(range));\n \t}\n \n+\t/* Register a compound control. */\n+\tctrls.emplace(std::piecewise_construct,\n+\t\t      std::forward_as_tuple(&controls::CompoundControl),\n+\t\t      std::forward_as_tuple(0, 100));\n+\n \tcontrolInfo_ = std::move(ctrls);\n \n \t/* Initialize the camera properties. */\ndiff --git a/test/controls/compound_controls.cpp b/test/controls/compound_controls.cpp\nnew file mode 100644\nindex 000000000000..96d3d9204c74\n--- /dev/null\n+++ b/test/controls/compound_controls.cpp\n@@ -0,0 +1,71 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * compound_controls.cpp - CompoundControls test\n+ */\n+\n+#include <iostream>\n+#include <vector>\n+\n+#include <libcamera/camera.h>\n+#include <libcamera/camera_manager.h>\n+#include <libcamera/control_ids.h>\n+#include <libcamera/controls.h>\n+#include <libcamera/span.h>\n+\n+#include \"camera_controls.h\"\n+\n+#include \"camera_test.h\"\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+class CompoundControlsTest : public CameraTest, public Test\n+{\n+public:\n+\tCompoundControlsTest()\n+\t\t: CameraTest(\"VIMC Sensor B\")\n+\t{\n+\t}\n+\n+protected:\n+\tint init() override\n+\t{\n+\t\treturn status_;\n+\t}\n+\n+\tint run() override\n+\t{\n+\t\tCameraControlValidator validator(camera_.get());\n+\t\tControlList list(controls::controls, &validator);\n+\n+\t\t/*\n+\t\t * Span\n+\t\t *\n+\t\t * A Span can be initialized with an initializer list\n+\t\t * and sequentially or random accessed\n+\t\t */\n+\t\tstd::array<int32_t, 3> array = { 1, 2, 3 };\n+\t\tSpan<int32_t> span{ array };\n+\t\tfor (uint32_t i : span)\n+\t\t\tcout << i << endl;\n+\t\tcout << span[0] << endl;\n+\n+\t\t/*\n+\t\t * Compound Controls: can be set with a span of values\n+\t\t */\n+\t\tstd::vector<int32_t> values = { 0, 125, 253 };\n+\t\tlist.set(controls::CompoundControl, Span<int32_t>{ values });\n+\t\tSpan<int32_t> iSpan = list.get(controls::CompoundControl);\n+\n+\t\tcout << iSpan.size() << endl;\n+\t\tfor (uint32_t i : iSpan)\n+\t\t\tcout << i << endl;\n+\n+\t\treturn TestPass;\n+\t}\n+};\n+\n+TEST_REGISTER(CompoundControlsTest)\ndiff --git a/test/controls/meson.build b/test/controls/meson.build\nindex f0850df28c8a..f4752dcff33b 100644\n--- a/test/controls/meson.build\n+++ b/test/controls/meson.build\n@@ -3,6 +3,7 @@ control_tests = [\n     [ 'control_list',   'control_list.cpp' ],\n     [ 'control_range',  'control_range.cpp' ],\n     [ 'control_value',  'control_value.cpp' ],\n+    [ 'compound_controls', 'compound_controls.cpp'],\n ]\n \n foreach t : control_tests\n","prefixes":["libcamera-devel","20/23"]}