{"id":2087,"url":"https://patchwork.libcamera.org/api/1.1/patches/2087/?format=json","web_url":"https://patchwork.libcamera.org/patch/2087/","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":"<20191003174941.1296988-7-niklas.soderlund@ragnatech.se>","date":"2019-10-03T17:49:36","name":"[libcamera-devel,v4,06/11] libcamera: ipa: Extend to support IPA interactions","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"604a2c2c6b9d7950de64c62db76488d7cc2a9185","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/2087/mbox/","series":[{"id":516,"url":"https://patchwork.libcamera.org/api/1.1/series/516/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=516","date":"2019-10-03T17:49:31","name":"libcamera: ipa: Add basic IPA support","version":4,"mbox":"https://patchwork.libcamera.org/series/516/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2087/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2087/checks/","tags":{},"headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17BFE6170D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  3 Oct 2019 19:50:40 +0200 (CEST)","from bismarck.berto.se (unknown [84.172.88.101])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid 32b2c12b-e606-11e9-837a-0050569116f7;\n\tThu, 03 Oct 2019 19:49:50 +0200 (CEST)"],"X-Halon-ID":"32b2c12b-e606-11e9-837a-0050569116f7","Authorized-sender":"niklas@soderlund.pp.se","From":"=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  3 Oct 2019 19:49:36 +0200","Message-Id":"<20191003174941.1296988-7-niklas.soderlund@ragnatech.se>","X-Mailer":"git-send-email 2.23.0","In-Reply-To":"<20191003174941.1296988-1-niklas.soderlund@ragnatech.se>","References":"<20191003174941.1296988-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 06/11] libcamera: ipa: Extend to\n\tsupport IPA interactions","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":"Thu, 03 Oct 2019 17:50:40 -0000"},"content":"The IPA interface needs to support interactions with the pipeline, add\ninterfaces to control the sensor and handling of request ISP parameters\nand statistics.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/ipa/ipa_interface.h             |  37 +++++++\n src/ipa/ipa_dummy.cpp                   |   7 +-\n src/libcamera/ipa_interface.cpp         | 132 ++++++++++++++++++++++++\n src/libcamera/proxy/ipa_proxy_linux.cpp |  14 ++-\n 4 files changed, 181 insertions(+), 9 deletions(-)","diff":"diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h\nindex 2c5eb1fd524311cb..2c715314c7a418f0 100644\n--- a/include/ipa/ipa_interface.h\n+++ b/include/ipa/ipa_interface.h\n@@ -7,14 +7,51 @@\n #ifndef __LIBCAMERA_IPA_INTERFACE_H__\n #define __LIBCAMERA_IPA_INTERFACE_H__\n \n+#include <map>\n+#include <vector>\n+\n+#include <libcamera/buffer.h>\n+#include <libcamera/controls.h>\n+#include <libcamera/geometry.h>\n+#include <libcamera/signal.h>\n+\n+#include \"v4l2_controls.h\"\n+\n namespace libcamera {\n \n+struct IPAStream {\n+\tunsigned int pixelFormat;\n+\tSize size;\n+};\n+\n+struct IPABuffer {\n+\tunsigned int id;\n+\tunsigned int type;\n+\tBufferMemory buffer;\n+};\n+\n+struct IPAOperationData {\n+\tunsigned int operation;\n+\tstd::vector<uint32_t> data;\n+\tstd::vector<ControlList> controls;\n+\t/* \\todo: Add more vectors for data types used in pipa<->IPA interactions. */\n+};\n+\n class IPAInterface\n {\n public:\n \tvirtual ~IPAInterface() {}\n \n \tvirtual int init() = 0;\n+\n+\tvirtual void configure(const std::map<unsigned int, IPAStream> &streamConfig,\n+\t\t\t       const std::map<unsigned int, V4L2ControlInfoMap> &entityControls) = 0;\n+\n+\tvirtual void mapBuffers(const std::vector<IPABuffer> &buffers) = 0;\n+\tvirtual void unmapBuffers(const std::vector<IPABuffer> &buffers) = 0;\n+\n+\tvirtual void processEvent(const IPAOperationData &event) = 0;\n+\tSignal<const IPAOperationData &> queueFrameAction;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/ipa_dummy.cpp b/src/ipa/ipa_dummy.cpp\nindex 9d0cbdc8b1ad5565..08f74c4952f3923a 100644\n--- a/src/ipa/ipa_dummy.cpp\n+++ b/src/ipa/ipa_dummy.cpp\n@@ -15,7 +15,12 @@ namespace libcamera {\n class IPADummy : public IPAInterface\n {\n public:\n-\tint init();\n+\tint init() override;\n+\tvoid configure(const std::map<unsigned int, IPAStream> &streamConfig,\n+\t\t       const std::map<unsigned int, V4L2ControlInfoMap> &entityControls) override {}\n+\tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override {}\n+\tvoid unmapBuffers(const std::vector<IPABuffer> &buffers) override {}\n+\tvoid processEvent(const IPAOperationData &event) override {}\n };\n \n int IPADummy::init()\ndiff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\nindex d7d8ca8881efcf66..c0f2004f3ec993b2 100644\n--- a/src/libcamera/ipa_interface.cpp\n+++ b/src/libcamera/ipa_interface.cpp\n@@ -14,6 +14,68 @@\n \n namespace libcamera {\n \n+\n+/**\n+ * \\struct IPAStream\n+ * \\brief Hold IPA description of a stream.\n+ */\n+\n+/**\n+ * \\var IPAStream::pixelFormat\n+ * \\brief The streams pixel format\n+ */\n+\n+/**\n+ * \\var IPAStream::size\n+ * \\brief The streams size\n+ */\n+\n+/**\n+ * \\struct IPABuffer\n+ * \\brief Hold IPA description of a buffer\n+ */\n+\n+/**\n+ * \\var IPABuffer::id\n+ * \\brief The pipeline to IPA id cookie for the buffer\n+ */\n+\n+/**\n+ * \\var IPABuffer::type\n+ * \\brief The pipeline to IPA type for the buffer\n+ */\n+\n+/**\n+ * \\var IPABuffer::buffer\n+ * \\brief The hardware description of the buffer shared between pipeline and IPA\n+ */\n+\n+/**\n+ * \\struct IPAOperationData\n+ * \\brief Hold data exchanged between pipeline and IPA\n+ *\n+ * This is the information carrier between pipeline and IPA. The is is used\n+ * to transport the pipeline specific protocol between the two. Core libcamera\n+ * components do not try to interpret the protocol and it's up to the pipeline\n+ * handler to uses the members of this struct in any way they see fit, and to\n+ * document it so multiple IPA implementations for the same pipeline may use it.\n+ */\n+\n+/**\n+ * \\var IPAOperationData::operation\n+ * \\brief Intended as the operation code in the pipeline to IPA protocol\n+ */\n+\n+/**\n+ * \\var IPAOperationData::data\n+ * \\brief Intended as the generic data carrier in the pipeline to IPA protocol\n+ */\n+\n+/**\n+ * \\var IPAOperationData::controls\n+ * \\brief Intended as the ControlList carrier in the pipeline to IPA protocol\n+ */\n+\n /**\n  * \\class IPAInterface\n  * \\brief Interface for IPA implementation\n@@ -24,4 +86,74 @@ namespace libcamera {\n  * \\brief Initialise the IPAInterface\n  */\n \n+/**\n+ * \\fn IPAInterface::configure()\n+ * \\brief Configure the IPA stream and sensor settings\n+ * \\param[in] streamConfig List of stream configuration descriptions\n+ * \\param[in] entityControls List of controls provided by the pipeline entities\n+ *\n+ * This function is called when a pipeline attaches to an IPA to inform the IPA\n+ * of the streams and controls limits the entities(s) in the video pipeline\n+ * supports.\n+ */\n+\n+/**\n+ * \\fn IPAInterface::mapBuffers()\n+ * \\brief Map the buffers shared by the pipeline to the IPA\n+ * \\param[in] buffers List of buffers to map\n+ *\n+ * This function is called when a pipeline handler wants to inform the IPA of\n+ * which buffers it has mapped which the IPA can make use of. All buffers shared\n+ * between these two object's needs to be shared using this function prior to\n+ * use.\n+ *\n+ * After the buffers have been initialized a specific buffer can be referenced\n+ * using the numerical \\a type and \\a id provided when the buffers where mapped.\n+ *\n+ * The numerical values for type and id used to describe a buffer have no\n+ * meaning in the core libcamera code and the interface is pipeline handler\n+ * specific.\n+ *\n+ * \\sa unmapBuffers()\n+ * \\todo Can we make this a generic function?\n+ */\n+\n+/**\n+ * \\fn IPAInterface::unmapBuffers()\n+ * \\brief Unmap the buffers shared by the pipeline to the IPA\n+ * \\param[in] buffers List of buffers to unmap\n+ *\n+ * This function is called when a pipeline handler wants to the IPA to unmap\n+ * all or some of the buffer it have mapped.\n+ *\n+ * \\sa mapBuffers()\n+ * \\todo Can we make this a generic function?\n+ */\n+\n+/**\n+ * \\fn IPAInterface::processEvent()\n+ * \\brief Process an event from the pipeline handler\n+ * \\param[in] event Event to process\n+ *\n+ * The pipeline handler can send events to the IPA to notify it of what is\n+ * going on. This is the entry point on the IPA side for those messages.\n+ *\n+ * The protocol between pipeline and IPA are hilly specific for each pipeline\n+ * and needs to be documented separately. Libcamera reserves no operation\n+ * numbers and make no attempt to interpret the protocol.\n+ */\n+\n+/**\n+ * \\fn IPAInterface::queueFrameAction()\n+ * \\brief Signal emitted when the IPA wish to queue a FrameAction\n+ * \\param[in] frame The frame number for the request\n+ * \\param[in] controls List of controls associated with the request\n+ *\n+ * This signal is emitted when the IPA wish to queue a FrameAction on the\n+ * pipeline. The pipeline is still responsible for the scheduling of the action\n+ * on its timeline.\n+ *\n+ * The IPA operation describing the frame action is passed as a parameter.\n+ */\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/proxy/ipa_proxy_linux.cpp b/src/libcamera/proxy/ipa_proxy_linux.cpp\nindex 62fcb529e1c7e4ff..14e8bb6067623fc6 100644\n--- a/src/libcamera/proxy/ipa_proxy_linux.cpp\n+++ b/src/libcamera/proxy/ipa_proxy_linux.cpp\n@@ -26,7 +26,12 @@ public:\n \tIPAProxyLinux(IPAModule *ipam);\n \t~IPAProxyLinux();\n \n-\tint init();\n+\tint init() override { return 0; }\n+\tvoid configure(const std::map<unsigned int, IPAStream> &streamConfig,\n+\t\t       const std::map<unsigned int, V4L2ControlInfoMap> &entityControls) override {}\n+\tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override {}\n+\tvoid unmapBuffers(const std::vector<IPABuffer> &buffers) override {}\n+\tvoid processEvent(const IPAOperationData &event) override {}\n \n private:\n \tvoid readyRead(IPCUnixSocket *ipc);\n@@ -36,13 +41,6 @@ private:\n \tIPCUnixSocket *socket_;\n };\n \n-int IPAProxyLinux::init()\n-{\n-\tLOG(IPAProxy, Debug) << \"initializing IPA via dummy proxy!\";\n-\n-\treturn 0;\n-}\n-\n IPAProxyLinux::IPAProxyLinux(IPAModule *ipam)\n \t: proc_(nullptr), socket_(nullptr)\n {\n","prefixes":["libcamera-devel","v4","06/11"]}