{"id":9730,"url":"https://patchwork.libcamera.org/api/1.1/patches/9730/?format=json","web_url":"https://patchwork.libcamera.org/patch/9730/","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":"<20200922133537.258098-27-paul.elder@ideasonboard.com>","date":"2020-09-22T13:35:25","name":"[libcamera-devel,26/38] ipa: Add core.mojom","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4e0bd05e9cab7ae332714891665c0409a173c399","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9730/mbox/","series":[{"id":1309,"url":"https://patchwork.libcamera.org/api/1.1/series/1309/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1309","date":"2020-09-22T13:34:59","name":"IPA isolation implementation","version":1,"mbox":"https://patchwork.libcamera.org/series/1309/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9730/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9730/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 22529BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Sep 2020 13:38:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E149B62FDC;\n\tTue, 22 Sep 2020 15:38:57 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21F5260576\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 15:38:56 +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 A95F42D7;\n\tTue, 22 Sep 2020 15:38:49 +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=\"GI0pyqOC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600781931;\n\tbh=Yb5VXqyrP/z/yRC7LxwF7GS3ViMmmtRmeB9/Ii7gGlo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GI0pyqOCpVFOAiQxwk/gBis9RafUtsV8tH/txwUd0WtLED2YB7rmr19aApQhoCym3\n\tWY4gpxXQUV9tNnihudlS2YlV0Ldz28KgBmRC0qXlAOlSIEAj5oG6/J1J9ksG/07LzM\n\tYPSoo/tepwrJQJ1Y6y3S3lA0FfJY1B3TiN+kZvzw=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Sep 2020 22:35:25 +0900","Message-Id":"<20200922133537.258098-27-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20200922133537.258098-1-paul.elder@ideasonboard.com>","References":"<20200922133537.258098-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 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---\nNew in v2\n---\n include/libcamera/ipa/core.mojom       | 74 ++++++++++++++++++++++++++\n include/libcamera/ipa/meson.build      | 17 ++++--\n src/libcamera/proxy/meson.build        |  2 +-\n src/libcamera/proxy/worker/meson.build |  2 +-\n 4 files changed, 90 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..ba04955c\n--- /dev/null\n+++ b/include/libcamera/ipa/core.mojom\n@@ -0,0 +1,74 @@\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+ * \\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:\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 c6231f2c..9ec38198 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -13,6 +13,16 @@ 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 : [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 +40,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 : [mojom_parser,\n                                      '--output-root', meson.build_root(),\n                                      '--input-root', meson.source_root(),\n@@ -40,7 +51,7 @@ foreach file : ipa_mojom_files\n     header = custom_target(name + '_generated_h',\n                            input : mojom,\n                            output : name + '_generated.h',\n-                           depends : mojom_template,\n+                           depends : [mojom_template, ipa_mojom_core],\n                            command : [mojom_generator, 'generate',\n                                       '-g', 'libcamera',\n                                       '--bytecode_path', mojom_templates_dir,\n@@ -53,7 +64,7 @@ foreach file : ipa_mojom_files\n     serializer = custom_target(name + '_serializer_h',\n                                input : mojom,\n                                output : name + '_serializer.h',\n-                               depends : mojom_template,\n+                               depends : [mojom_template, ipa_mojom_core],\n                                command : [mojom_generator, 'generate',\n                                           '-g', 'libcamera',\n                                           '--bytecode_path', mojom_templates_dir,\n@@ -66,7 +77,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_template,\n+                                 depends : [mojom_template, ipa_mojom_core],\n                                  command : [mojom_generator, 'generate',\n                                             '-g', 'libcamera',\n                                             '--bytecode_path', mojom_templates_dir,\ndiff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build\nindex bacf800f..dbbb5d9a 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_template],\n+                          depends : [mojom_template, ipa_mojom_core],\n                           command : [mojom_generator, 'generate',\n                                      '-g', 'libcamera',\n                                      '--bytecode_path', mojom_templates_dir,\ndiff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build\nindex 836d1759..c3dd2558 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_template],\n+                           depends : [mojom_template, ipa_mojom_core],\n                            command : [mojom_generator, 'generate',\n                                       '-g', 'libcamera',\n                                       '--bytecode_path', mojom_templates_dir,\n","prefixes":["libcamera-devel","26/38"]}