{"id":10279,"url":"https://patchwork.libcamera.org/api/1.1/patches/10279/?format=json","web_url":"https://patchwork.libcamera.org/patch/10279/","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":"<20201028010051.3830668-7-niklas.soderlund@ragnatech.se>","date":"2020-10-28T01:00:48","name":"[libcamera-devel,6/9] libcamera: camera_sensor: Expose a DelayedControls interface","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ee47021f1e884b5288caf4ab35e48294e1b2bccb","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/1.1/people/5/?format=json","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"delegate":{"id":16,"url":"https://patchwork.libcamera.org/api/1.1/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/10279/mbox/","series":[{"id":1423,"url":"https://patchwork.libcamera.org/api/1.1/series/1423/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1423","date":"2020-10-28T01:00:42","name":"libcamera: Add helper for controls that take effect with a delay","version":1,"mbox":"https://patchwork.libcamera.org/series/1423/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10279/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10279/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 F26AEC3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 28 Oct 2020 01:01:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD71862279;\n\tWed, 28 Oct 2020 02:01:19 +0100 (CET)","from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6996462264\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Oct 2020 02:01:16 +0100 (CET)","from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de\n\t[79.202.36.88])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 142dafb7-18b9-11eb-954c-0050569116f7;\n\tWed, 28 Oct 2020 02:01:15 +0100 (CET)"],"X-Halon-ID":"142dafb7-18b9-11eb-954c-0050569116f7","Authorized-sender":"niklas.soderlund@fsdn.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org, david.plowman@raspberrypi.com,\n\tnaush@raspberrypi.com","Date":"Wed, 28 Oct 2020 02:00:48 +0100","Message-Id":"<20201028010051.3830668-7-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.29.1","In-Reply-To":"<20201028010051.3830668-1-niklas.soderlund@ragnatech.se>","References":"<20201028010051.3830668-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 6/9] libcamera: camera_sensor: Expose a\n\tDelayedControls interface","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Expose the optional DelayedControls interface to pipeline handlers. If\nused by a pipeline generic delays are used. In the future the delay\nvalues should be fetched to match the specific sensor module, either\nfrom a new kernel interface or worst case a sensors database.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/internal/camera_sensor.h |  5 ++++\n src/libcamera/camera_sensor.cpp            | 31 ++++++++++++++++++++++\n 2 files changed, 36 insertions(+)","diff":"diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h\nindex b9eba89f00fba882..6be1cfd49134c534 100644\n--- a/include/libcamera/internal/camera_sensor.h\n+++ b/include/libcamera/internal/camera_sensor.h\n@@ -14,6 +14,7 @@\n #include <libcamera/controls.h>\n #include <libcamera/geometry.h>\n \n+#include \"libcamera/internal/delayed_controls.h\"\n #include \"libcamera/internal/formats.h\"\n #include \"libcamera/internal/log.h\"\n #include \"libcamera/internal/v4l2_subdevice.h\"\n@@ -61,6 +62,8 @@ public:\n \tControlList getControls(const std::vector<uint32_t> &ids);\n \tint setControls(ControlList *ctrls);\n \n+\tDelayedControls *delayedContols();\n+\n \tconst ControlList &properties() const { return properties_; }\n \tint sensorInfo(CameraSensorInfo *info) const;\n \n@@ -83,6 +86,8 @@ private:\n \tstd::vector<Size> sizes_;\n \n \tControlList properties_;\n+\n+\tstd::unique_ptr<DelayedControls> delayedControls_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp\nindex 935de528c4963453..6c92c97f4cc2547a 100644\n--- a/src/libcamera/camera_sensor.cpp\n+++ b/src/libcamera/camera_sensor.cpp\n@@ -493,6 +493,37 @@ int CameraSensor::setControls(ControlList *ctrls)\n \treturn subdev_->setControls(ctrls);\n }\n \n+/**\n+ * \\brief Get the sensors delayed controls interface\n+ *\n+ * Access the sensors delayed controls interface. This interface aids pipelines\n+ * keeping tack of controls that needs time to take effect. The interface is\n+ * optional to use and does not interact with setControls() and getControls()\n+ * that operates directly on the sensor device.\n+ *\n+ * \\sa DelayedControls\n+ * \\return The delayed controls interface\n+ */\n+DelayedControls *CameraSensor::delayedContols()\n+{\n+\tif (!delayedControls_) {\n+\t\t/*\n+\t\t * \\todo Read dealy values from the sensor itself or from a\n+\t\t * a sensor database. For now use generic values taken from\n+\t\t * the Raspberry Pi and listed as generic values.\n+\t\t */\n+\t\tstd::unordered_map<uint32_t, unsigned int> delays = {\n+\t\t\t{ V4L2_CID_ANALOGUE_GAIN, 1 },\n+\t\t\t{ V4L2_CID_EXPOSURE, 2 },\n+\t\t};\n+\n+\t\tdelayedControls_ =\n+\t\t\tstd::make_unique<DelayedControls>(subdev_.get(), delays);\n+\t}\n+\n+\treturn delayedControls_.get();\n+}\n+\n /**\n  * \\brief Assemble and return the camera sensor info\n  * \\param[out] info The camera sensor info\n","prefixes":["libcamera-devel","6/9"]}