{"id":10404,"url":"https://patchwork.libcamera.org/api/1.1/patches/10404/?format=json","web_url":"https://patchwork.libcamera.org/patch/10404/","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":"<20201110002710.3233696-6-niklas.soderlund@ragnatech.se>","date":"2020-11-10T00:27:07","name":"[libcamera-devel,v2,5/8] 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":null,"mbox":"https://patchwork.libcamera.org/patch/10404/mbox/","series":[{"id":1454,"url":"https://patchwork.libcamera.org/api/1.1/series/1454/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1454","date":"2020-11-10T00:27:02","name":"Add helper for controls that take effect with a delay","version":2,"mbox":"https://patchwork.libcamera.org/series/1454/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10404/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10404/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 264F4BE086\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 Nov 2020 00:28:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D4651630D1;\n\tTue, 10 Nov 2020 01:28:01 +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 C2AAF630C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 Nov 2020 01:28:00 +0100 (CET)","from bismarck.berto.se (p4fca2458.dip0.t-ipconnect.de\n\t[79.202.36.88])\n\tby bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid c60a4651-22ea-11eb-bcc0-005056917f90;\n\tTue, 10 Nov 2020 01:22:10 +0100 (CET)"],"X-Halon-ID":"c60a4651-22ea-11eb-bcc0-005056917f90","Authorized-sender":"niklas.soderlund@fsdn.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org,\n\tnaush@raspberrypi.com","Date":"Tue, 10 Nov 2020 01:27:07 +0100","Message-Id":"<20201110002710.3233696-6-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20201110002710.3233696-1-niklas.soderlund@ragnatech.se>","References":"<20201110002710.3233696-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 5/8] 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","v2","5/8"]}