{"id":9934,"url":"https://patchwork.libcamera.org/api/patches/9934/?format=json","web_url":"https://patchwork.libcamera.org/patch/9934/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20201002143154.468162-27-paul.elder@ideasonboard.com>","date":"2020-10-02T14:31:42","name":"[libcamera-devel,v3,26/38] ipa: Add core.mojom","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4c0b80db74fe8a7c15bd3b1f1c0200762644b8c7","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9934/mbox/","series":[{"id":1348,"url":"https://patchwork.libcamera.org/api/series/1348/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1348","date":"2020-10-02T14:31:16","name":"IPA isolation implementation","version":3,"mbox":"https://patchwork.libcamera.org/series/1348/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9934/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9934/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 36EE9C3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Oct 2020 14:33:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 02D3463BCA;\n\tFri,  2 Oct 2020 16:33:11 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 917D763B6A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Oct 2020 16:33:09 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D35A12A2;\n\tFri,  2 Oct 2020 16:33:07 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"iyxn+pWb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601649189;\n\tbh=flR82/ko2y3q0dHo0vSOzCMaGIiLuiuG9kh32ONMbk0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=iyxn+pWbb8qfWooF3hMMyqHmMFW87H/OcJ0NiJQGYKZwKszFcR6bfp66hRZdnNCbo\n\tcos8/GLhdh5s1mOLa6Rv90VJcokDRDP7oe6S2m9D+7YBRu/XbdnT5RHuzxmftkJeJX\n\tDuBi2oUKpJFDp2jP/Udk2t+PmJAqZQE86Aw7qu/c=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Oct 2020 23:31:42 +0900","Message-Id":"<20201002143154.468162-27-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20201002143154.468162-1-paul.elder@ideasonboard.com>","References":"<20201002143154.468162-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 26/38] ipa: Add core.mojom","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":"Add a base mojom file to contain empty mojom definitions of libcamera\nobjects, as well as documentation for the IPA interfaces that need to be\ndefined in the mojom files.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- add doc that structs need to be defined\n- add doc to recommend namespacing\n- change indentation\n- add requirement that base controls *must* be defined in\n  libcamera::{pipeline_name}::Controls\n\nNew in v2\n---\n include/libcamera/ipa/core.mojom       | 83 ++++++++++++++++++++++++++\n include/libcamera/ipa/meson.build      | 18 +++++-\n src/libcamera/proxy/meson.build        |  2 +-\n src/libcamera/proxy/worker/meson.build |  2 +-\n 4 files changed, 100 insertions(+), 5 deletions(-)\n create mode 100644 include/libcamera/ipa/core.mojom","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nnew file mode 100644\nindex 00000000..81d68bae\n--- /dev/null\n+++ b/include/libcamera/ipa/core.mojom\n@@ -0,0 +1,83 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+\n+/*\n+ * Any libcamera objects that are used by any interfaces must be declared\n+ * here, and a de/serializer be implemented in IPADataSerializer. In addition,\n+ * the corresponding header file (or forward-declarations) must be placed in\n+ * {pipeline_name}.h.\n+ *\n+ * For libcamera types, the [hasFd] attribute is needed to notify the compiler\n+ * that the struct has an fd.\n+ */\n+struct CameraSensorInfo {};\n+struct ControlInfoMap {};\n+struct ControlList {};\n+struct FileDescriptor {};\n+[hasFd] struct IPABuffer {};\n+struct IPASettings {};\n+struct IPAStream {};\n+\n+/*\n+ * Any custom structs that the IPA interfaces use must be defined here,\n+ * usin the mojo interface definition language.\n+ *\n+ * It is recommended to use namespacing, to avoid potential collisions with\n+ * libcamera types. Use mojom's module directive for this.\n+ */\n+\n+/*\n+ * \\class IPACoreInterface\n+ *\n+ * This mojo interface describes the main interface of the IPA. It must be\n+ * defined.\n+ *\n+ * The main interface must be named as IPA{pipeline_name}Interface.\n+ * IPACoreInterface serves as an example and documentation, where\n+ * {pipeline_name} is Core.\n+ *\n+ * At minimum, the following three functions must be present (and implemented):\n+ * init(IPASettings settings) => (int32 ret);\n+ * start() => (int32 ret);\n+ * stop();\n+ *\n+ * All input parameters will become const references, except for primitives,\n+ * which will simply become const. Output parameters will become pointers,\n+ * unless there is only one primitive output parameter, in which case it will\n+ * become a regular return value.\n+ *\n+ * const is not allowed inside of arrays and maps. mojo arrays will become C++\n+ * vectors.\n+ *\n+ * By default, all methods defined in the main interface are synchronous. This\n+ * means that in the case of IPC (ie. isolated IPA), the function call will not\n+ * return until the return value or output parameters are ready. To specify an\n+ * asynchronous function, the [async] attribute can be used. Asynchronous\n+ * methods must not have any return value or output parameters, since in the\n+ * case of IPC the call needs to return immediately.\n+ *\n+ * In addition the following must be defined in {pipeline_name}.h in the\n+ * libcamera namespace:\n+ *\n+ * static ControlInfoMap {pipeline_name}::Controls;\n+ *\n+ * It may be empty.\n+ */\n+\n+/*\n+ * \\class IPACoreCallbackInterface\n+ *\n+ * This mojo interface describes the callback interface of the IPA. It must be\n+ * defined. If there are no callback functions, then it may be empty.\n+ *\n+ * The callback interface must be named as IPA{pipeline_name}CallbackInterface.\n+ * IPACoreCallbackInterface serves as an example and documentation, where\n+ * {pipeline_name} is Core.\n+ *\n+ * Methods defined in the callback interface shall not return anything. This\n+ * also means that these methods must be asynchronous and not synchronous.\n+ * Therefore the [async] tag is not necessary.\n+ *\n+ * Methods defined in the callback interface will become Signals in the IPA\n+ * interface. The IPA can emit signals, while the pipeline handler can connect\n+ * slots to them.\n+ */\ndiff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\nindex 337948d2..590a1464 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -13,6 +13,17 @@ install_headers(libcamera_ipa_headers,\n # Prepare IPA/IPC generation components\n #\n \n+core_mojom_file = 'core.mojom'\n+ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n+                               input : core_mojom_file,\n+                               output : core_mojom_file + '-module',\n+                               command : [\n+                                   mojom_parser,\n+                                   '--output-root', meson.build_root(),\n+                                   '--input-root', meson.source_root(),\n+                                   '--mojoms', '@INPUT@'\n+                               ])\n+\n ipa_mojom_files = []\n \n ipa_mojoms = []\n@@ -30,6 +41,7 @@ foreach file : ipa_mojom_files\n     mojom = custom_target(file.split('.')[0] + '_mojom_module',\n                           input : file,\n                           output : file + '-module',\n+                          depends : ipa_mojom_core,\n                           command : [\n                               mojom_parser,\n                               '--output-root', meson.build_root(),\n@@ -41,7 +53,7 @@ foreach file : ipa_mojom_files\n     header = custom_target(name + '_generated_h',\n                            input : mojom,\n                            output : name + '_generated.h',\n-                           depends : mojom_templates,\n+                           depends : [mojom_templates, ipa_mojom_core],\n                            command : [\n                                mojom_generator, 'generate',\n                                '-g', 'libcamera',\n@@ -55,7 +67,7 @@ foreach file : ipa_mojom_files\n     serializer = custom_target(name + '_serializer_h',\n                                input : mojom,\n                                output : name + '_serializer.h',\n-                               depends : mojom_templates,\n+                               depends : [mojom_templates, ipa_mojom_core],\n                                command : [\n                                    mojom_generator, 'generate',\n                                    '-g', 'libcamera',\n@@ -69,7 +81,7 @@ foreach file : ipa_mojom_files\n     proxy_header = custom_target(name + '_proxy_h',\n                                  input : mojom,\n                                  output : 'ipa_proxy_' + name + '.h',\n-                                 depends : mojom_templates,\n+                                 depends : [mojom_templates, ipa_mojom_core],\n                                  command : [\n                                      mojom_generator, 'generate',\n                                      '-g', 'libcamera',\ndiff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build\nindex ac68ad08..f27b453a 100644\n--- a/src/libcamera/proxy/meson.build\n+++ b/src/libcamera/proxy/meson.build\n@@ -10,7 +10,7 @@ foreach mojom : ipa_mojoms\n     proxy = custom_target(mojom['name'] + '_proxy_cpp',\n                           input : mojom['mojom'],\n                           output : 'ipa_proxy_' + mojom['name'] + '.cpp',\n-                          depends : [mojom_templates],\n+                          depends : [mojom_templates, ipa_mojom_core],\n                           command : [\n                               mojom_generator, 'generate',\n                               '-g', 'libcamera',\ndiff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build\nindex 5490811b..353e5cf1 100644\n--- a/src/libcamera/proxy/worker/meson.build\n+++ b/src/libcamera/proxy/worker/meson.build\n@@ -11,7 +11,7 @@ foreach mojom : ipa_mojoms\n     worker = custom_target(mojom['name'] + '_proxy_worker',\n                            input : mojom['mojom'],\n                            output : 'ipa_proxy_' + mojom['name'] + '_worker.cpp',\n-                           depends : [mojom_templates],\n+                           depends : [mojom_templates, ipa_mojom_core],\n                            command : [\n                                mojom_generator, 'generate',\n                                '-g', 'libcamera',\n","prefixes":["libcamera-devel","v3","26/38"]}