From patchwork Tue Sep 15 14:20:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 9614 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 5CB08BF01C for ; Tue, 15 Sep 2020 14:21:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2CA0562E1B; Tue, 15 Sep 2020 16:21:09 +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="tRobn0uj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6178E62E17 for ; Tue, 15 Sep 2020 16:21:05 +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 7D912AEA; Tue, 15 Sep 2020 16:21:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1600179665; bh=lyec7IuQNDjIoeYJuLdzbvq+kOvt4iSbPVo3OIP9voA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRobn0ujZ7BPnUTv9fZUj1TXLd7fTkpwM/+cLI+xGcMDjvJEThVqQdY7SkO8ZfQjx xnHe0Voe0CaDB58UPUVPt/q4rBjvvTLTwa7ifQ4R2vwA23gc0NVbu23ilsGgfH1mQQ BOm4euWSR2vAr3lcDSthOn7q80v2qcW28+STJW74= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 15 Sep 2020 23:20:20 +0900 Message-Id: <20200915142038.28757-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200915142038.28757-1-paul.elder@ideasonboard.com> References: <20200915142038.28757-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/23] meson: ipa, proxy: Generate headers and proxy with mojo 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" Run mojo from meson to generate the header, serializer, and proxy files for every pipeline's mojom data definition file. So far we only have the raspberrypi mojom file. Signed-off-by: Paul Elder --- Dictionaries with non-literal keys is apparently a meson 0.53 feature. include/libcamera/ipa/meson.build | 87 ++++++++++++++++++++++++++ src/libcamera/proxy/meson.build | 21 +++++++ src/libcamera/proxy/worker/meson.build | 25 +++++++- 3 files changed, 131 insertions(+), 2 deletions(-) diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build index 508c6bd1..f61a5a8f 100644 --- a/include/libcamera/ipa/meson.build +++ b/include/libcamera/ipa/meson.build @@ -8,3 +8,90 @@ libcamera_ipa_headers = files([ install_headers(libcamera_ipa_headers, subdir: join_paths(libcamera_include_dir, 'ipa')) + +# +# Prepare IPA/IPC generation components +# + +ipa_mojom_files = [] + +mojom_generator = find_program('../../../utils/ipc/generate.py') + +mojom_template = custom_target('mojom_template', + output : 'dummy', + command : [mojom_generator, 'precompile']) + +mojom_parser = find_program('../../../utils/ipc/mojo/public/tools/mojom/mojom_parser.py') + +# {pipeline}.mojom-module +ipa_mojoms = {} + +foreach file : ipa_mojom_files + name = file.split('.')[0] + mojom = custom_target(file.split('.')[0] + '_mojom_module', + input : file, + output : file + '-module', + command : [mojom_parser, + '--output-root', meson.build_root(), + '--input-root', meson.source_root(), + '--mojoms', '@INPUT@' + ]) + ipa_mojoms += { name: mojom } +endforeach + +# +# Generate headers from templates. +# + +# {pipeline}_generated.h +# generate {pipeline}_serializer.h +# generate ipa_proxy_{pipeline}.h +ipa_headers = {} +ipa_serializers = {} +ipa_proxy_headers = {} + +foreach name, mojom : ipa_mojoms + header = custom_target(name + '_generated_h', + input : mojom, + output : name + '_generated.h', + depends : mojom_template, + command : [mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', '.', + '--libcamera_generate_header', + '--libcamera_output_path=@OUTPUT@', + './' +'@INPUT@' + ]) + + serializer = custom_target(name + '_serializer_h', + input : mojom, + output : name + '_serializer.h', + depends : mojom_template, + command : [mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', '.', + '--libcamera_generate_serializer', + '--libcamera_output_path=@OUTPUT@', + './' +'@INPUT@' + ]) + + proxy_header = custom_target(name + '_proxy_h', + input : mojom, + output : 'ipa_proxy_' + name + '.h', + depends : mojom_template, + command : [mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', '.', + '--libcamera_generate_proxy_h', + '--libcamera_output_path=@OUTPUT@', + './' +'@INPUT@' + ]) + + ipa_headers += { name: header } + ipa_serializers += { name: serializer } + ipa_proxy_headers += { name: proxy_header } +endforeach + +libcamera_internal_headers += ipa_proxy_headers +libcamera_internal_headers += ipa_headers +libcamera_internal_headers += ipa_serializers diff --git a/src/libcamera/proxy/meson.build b/src/libcamera/proxy/meson.build index bd804750..b0d35646 100644 --- a/src/libcamera/proxy/meson.build +++ b/src/libcamera/proxy/meson.build @@ -4,3 +4,24 @@ libcamera_sources += files([ 'ipa_proxy_linux.cpp', 'ipa_proxy_thread.cpp', ]) + +# generate ipa_proxy_{pipeline}.cpp +ipa_proxy_sources = [] + +foreach name, mojom : ipa_mojoms + ipa_proxy_sources += custom_target(name + '_proxy_cpp', + input : mojom, + output : 'ipa_proxy_' + name + '.cpp', + depends : [mojom_template, + ipa_headers[name], + ipa_serializers[name], + ipa_proxy_headers[name]], + command : [mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', '.', + '--libcamera_generate_proxy_cpp', + '--libcamera_output_path=@OUTPUT@', + './' + '@INPUT@']) +endforeach + +libcamera_sources += ipa_proxy_sources diff --git a/src/libcamera/proxy/worker/meson.build b/src/libcamera/proxy/worker/meson.build index ac0310a7..c35be70c 100644 --- a/src/libcamera/proxy/worker/meson.build +++ b/src/libcamera/proxy/worker/meson.build @@ -4,10 +4,31 @@ ipa_proxy_sources = [ ['ipa_proxy_linux', 'ipa_proxy_linux_worker.cpp'] ] +# generate ipa_proxy_{pipeline}_worker.cpp +ipa_proxy_sources = {} + +foreach name, mojom : ipa_mojoms + worker = custom_target(name + '_proxy_worker', + input : mojom, + output : 'ipa_proxy_' + name + '_worker.cpp', + depends : [mojom_template, + ipa_headers[name], + ipa_serializers[name], + ipa_proxy_headers[name]], + command : [mojom_generator, 'generate', + '-g', 'libcamera', + '--bytecode_path', '.', + '--libcamera_generate_proxy_worker', + '--libcamera_output_path=@OUTPUT@', + './' + '@INPUT@' + ]) + ipa_proxy_sources += { 'ipa_proxy_' + name : worker } +endforeach + proxy_install_dir = join_paths(get_option('libexecdir'), 'libcamera') -foreach t : ipa_proxy_sources - proxy = executable(t[0], t[1], +foreach k, t : ipa_proxy_sources + proxy = executable(k, t, install : true, install_dir : proxy_install_dir, dependencies : libcamera_dep)