From patchwork Tue Sep 22 13:35:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 9730 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 22529BF01C for ; Tue, 22 Sep 2020 13:38:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E149B62FDC; Tue, 22 Sep 2020 15:38:57 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GI0pyqOC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 21F5260576 for ; Tue, 22 Sep 2020 15:38:56 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A95F42D7; Tue, 22 Sep 2020 15:38:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1600781931; bh=Yb5VXqyrP/z/yRC7LxwF7GS3ViMmmtRmeB9/Ii7gGlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GI0pyqOCpVFOAiQxwk/gBis9RafUtsV8tH/txwUd0WtLED2YB7rmr19aApQhoCym3 WY4gpxXQUV9tNnihudlS2YlV0Ldz28KgBmRC0qXlAOlSIEAj5oG6/J1J9ksG/07LzM YPSoo/tepwrJQJ1Y6y3S3lA0FfJY1B3TiN+kZvzw= From: Paul Elder 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a base mojom file to contain empty mojom definitions of libcamera objects, as well as documentation for the IPA interfaces that need to be defined in the mojom files. Signed-off-by: Paul Elder --- New in v2 --- include/libcamera/ipa/core.mojom | 74 ++++++++++++++++++++++++++ include/libcamera/ipa/meson.build | 17 ++++-- src/libcamera/proxy/meson.build | 2 +- src/libcamera/proxy/worker/meson.build | 2 +- 4 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 include/libcamera/ipa/core.mojom diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom new file mode 100644 index 00000000..ba04955c --- /dev/null +++ b/include/libcamera/ipa/core.mojom @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +/* + * Any libcamera objects that are used by any interfaces must be declared + * here, and a de/serializer be implemented in IPADataSerializer. In addition, + * the corresponding header file (or forward-declarations) must be placed in + * {pipeline_name}.h. + * + * For libcamera types, the [hasFd] attribute is needed to notify the compiler + * that the struct has an fd. + */ +struct CameraSensorInfo {}; +struct ControlInfoMap {}; +struct ControlList {}; +struct FileDescriptor {}; +[hasFd] struct IPABuffer {}; +struct IPASettings {}; +struct IPAStream {}; + +/* + * \class IPACoreInterface + * + * This mojo interface describes the main interface of the IPA. It must be + * defined. + * + * The main interface must be named as IPA{pipeline_name}Interface. + * IPACoreInterface serves as an example and documentation, where + * {pipeline_name} is Core. + * + * At minimum, the following three functions must be present (and implemented): + * init(IPASettings settings) => (int32 ret); + * start() => (int32 ret); + * stop(); + * + * All input parameters will become const references, except for primitives, + * which will simply become const. Output parameters will become pointers, + * unless there is only one primitive output parameter, in which case it will + * become a regular return value. + * + * const is not allowed inside of arrays and maps. mojo arrays will become C++ + * vectors. + * + * By default, all methods defined in the main interface are synchronous. This + * means that in the case of IPC (ie. isolated IPA), the function call will not + * return until the return value or output parameters are ready. To specify an + * asynchronous function, the [async] attribute can be used. Asynchronous + * methods must not have any return value or output parameters, since in the + * case of IPC the call needs to return immediately. + * + * In addition the following must be defined in {pipeline_name}.h: + * + * static ControlInfoMap {pipeline_name}Controls; + * + * It may be empty. + */ + +/* + * \class IPACoreCallbackInterface + * + * This mojo interface describes the callback interface of the IPA. It must be + * defined. If there are no callback functions, then it may be empty. + * + * The callback interface must be named as IPA{pipeline_name}CallbackInterface. + * IPACoreCallbackInterface serves as an example and documentation, where + * {pipeline_name} is Core. + * + * Methods defined in the callback interface shall not return anything. This + * also means that these methods must be asynchronous and not synchronous. + * Therefore the [async] tag is not necessary. + * + * Methods defined in the callback interface will become Signals in the IPA + * interface. The IPA can emit signals, while the pipeline handler can connect + * slots to them. + */ diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build index c6231f2c..9ec38198 100644 --- a/include/libcamera/ipa/meson.build +++ b/include/libcamera/ipa/meson.build @@ -13,6 +13,16 @@ install_headers(libcamera_ipa_headers, # Prepare IPA/IPC generation components # +core_mojom_file = 'core.mojom' +ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module', + input : core_mojom_file, + output : core_mojom_file + '-module', + command : [mojom_parser, + '--output-root', meson.build_root(), + '--input-root', meson.source_root(), + '--mojoms', '@INPUT@' + ]) + ipa_mojom_files = [] ipa_mojoms = [] @@ -30,6 +40,7 @@ foreach file : ipa_mojom_files mojom = custom_target(file.split('.')[0] + '_mojom_module', input : file, output : file + '-module', + depends : ipa_mojom_core, command : [mojom_parser, '--output-root', meson.build_root(), '--input-root', meson.source_root(), @@ -40,7 +51,7 @@ foreach file : ipa_mojom_files header = custom_target(name + '_generated_h', input : mojom, output : name + '_generated.h', - depends : mojom_template, + depends : [mojom_template, ipa_mojom_core], command : [mojom_generator, 'generate', '-g', 'libcamera', '--bytecode_path', mojom_templates_dir, @@ -53,7 +64,7 @@ foreach file : ipa_mojom_files serializer = custom_target(name + '_serializer_h', input : mojom, output : name + '_serializer.h', - depends : mojom_template, + depends : [mojom_template, ipa_mojom_core], command : [mojom_generator, 'generate', '-g', 'libcamera', '--bytecode_path', mojom_templates_dir, @@ -66,7 +77,7 @@ foreach file : ipa_mojom_files proxy_header = custom_target(name + '_proxy_h', input : mojom, output : 'ipa_proxy_' + name + '.h', - depends : mojom_template, + depends : [mojom_template, ipa_mojom_core], command : [mojom_generator, 'generate', '-g', 'libcamera', '--bytecode_path', mojom_templates_dir, diff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build index bacf800f..dbbb5d9a 100644 --- a/src/libcamera/proxy/meson.build +++ b/src/libcamera/proxy/meson.build @@ -10,7 +10,7 @@ foreach mojom : ipa_mojoms proxy = custom_target(mojom['name'] + '_proxy_cpp', input : mojom['mojom'], output : 'ipa_proxy_' + mojom['name'] + '.cpp', - depends : [mojom_template], + depends : [mojom_template, ipa_mojom_core], command : [mojom_generator, 'generate', '-g', 'libcamera', '--bytecode_path', mojom_templates_dir, diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build index 836d1759..c3dd2558 100644 --- a/src/libcamera/proxy/worker/meson.build +++ b/src/libcamera/proxy/worker/meson.build @@ -11,7 +11,7 @@ foreach mojom : ipa_mojoms worker = custom_target(mojom['name'] + '_proxy_worker', input : mojom['mojom'], output : 'ipa_proxy_' + mojom['name'] + '_worker.cpp', - depends : [mojom_template], + depends : [mojom_template, ipa_mojom_core], command : [mojom_generator, 'generate', '-g', 'libcamera', '--bytecode_path', mojom_templates_dir,