From patchwork Fri Aug 9 00:59:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20850 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 6E533BE173 for ; Fri, 9 Aug 2024 00:59:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E0AF0633B4; Fri, 9 Aug 2024 02:59:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ZaDg2EMA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E44356337E for ; Fri, 9 Aug 2024 02:59:38 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BAEF383F for ; Fri, 9 Aug 2024 02:58:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1723165124; bh=KGF/ngWMPuNzkAxPzCrMS/T2hzF/2oZAdb/3jTQ3GVQ=; h=From:To:Subject:Date:From; b=ZaDg2EMAVw2R/rAoJiwB0R3Ekfj5gU8ES/Bm85fFyX14IfJzYrLfLtqHII7SabqMu sAAMIM6KJiXqFw/WptZTphjV4CpdT5uSbvYfxpoJSpQLzz/U3VAy7JiJq8Wr6jrY91 p2y/jz7RSKzpmTvEjXGg1VVMwTBx4SCal8qBHD1I= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 00/10] libcamera: Improve code generation for controls Date: Fri, 9 Aug 2024 03:59:04 +0300 Message-ID: <20240809005914.20662-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 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" Hello, This patch series started small by scratching an itch and wanting to have the ability to share some of the code generation code for controls with the upcoming controls support in libcamerasrc. As is too often the case, it then grew to 10 patches long, with a conversion of the templates to jinja2. I don't have much else to add here, the diffstat will hopefully speak by itself. Laurent Pinchart (10): meson: Store controls and properties YAML files in variables meson: Fix mismatch in controls and properties generated file names libcamera: Drop remaining file names from header comment blocks meson: Move all code generation scripts to utils/codegen/ meson: utils: Provide environment for Python scripts utils: codegen: gen-header.sh: Generate libcamera.h based on meson.build utils: codegen: gen-controls.py: Convert to jinja2 templates utils: codegen: gen-controls.py: Move helper classes to separate file py: gen-py-controls: Use Control class py: gen-py-controls: Convert to jinja2 templates include/libcamera/control_ids.h.in | 40 +- include/libcamera/internal/meson.build | 2 +- include/libcamera/ipa/meson.build | 21 +- include/libcamera/meson.build | 31 +- include/libcamera/property_ids.h.in | 34 -- meson.build | 4 +- src/libcamera/control_ids.cpp.in | 101 ++++- src/libcamera/meson.build | 30 +- src/libcamera/property_ids.cpp.in | 48 --- src/libcamera/proxy/meson.build | 3 +- src/libcamera/proxy/worker/meson.build | 3 +- src/py/libcamera/gen-py-controls.py | 122 +++--- src/py/libcamera/meson.build | 27 +- src/py/libcamera/py_controls_generated.cpp.in | 35 +- .../libcamera/py_properties_generated.cpp.in | 30 -- .../include/libcamera/ipa/meson.build | 9 +- utils/codegen/controls.py | 112 +++++ utils/codegen/gen-controls.py | 111 +++++ utils/{ => codegen}/gen-formats.py | 0 utils/{ => codegen}/gen-header.sh | 7 +- utils/{ => codegen}/gen-ipa-pub-key.py | 0 .../{tracepoints => codegen}/gen-tp-header.py | 0 utils/{ => codegen}/ipc/extract-docs.py | 0 utils/{ => codegen}/ipc/generate.py | 3 - .../{ => codegen}/ipc/generators/__init__.py | 0 .../core_ipa_interface.h.tmpl | 0 .../core_ipa_serializer.h.tmpl | 0 .../definition_functions.tmpl | 0 .../libcamera_templates/meson.build | 0 .../module_ipa_interface.h.tmpl | 0 .../module_ipa_proxy.cpp.tmpl | 0 .../module_ipa_proxy.h.tmpl | 0 .../module_ipa_proxy_worker.cpp.tmpl | 0 .../module_ipa_serializer.h.tmpl | 0 .../libcamera_templates/proxy_functions.tmpl | 0 .../libcamera_templates/serializer.tmpl | 0 .../{ => codegen}/ipc/generators/meson.build | 0 .../generators/mojom_libcamera_generator.py | 0 utils/{ => codegen}/ipc/meson.build | 3 +- utils/{ => codegen}/ipc/mojo/README | 0 utils/{ => codegen}/ipc/mojo/public/LICENSE | 0 .../ipc/mojo/public/tools/.style.yapf | 0 .../ipc/mojo/public/tools/BUILD.gn | 0 .../ipc/mojo/public/tools/bindings/BUILD.gn | 0 .../ipc/mojo/public/tools/bindings/README.md | 0 .../public/tools/bindings/checks/__init__.py | 0 .../bindings/checks/mojom_attributes_check.py | 0 .../checks/mojom_attributes_check_unittest.py | 0 .../checks/mojom_definitions_check.py | 0 .../checks/mojom_interface_feature_check.py | 0 .../mojom_interface_feature_check_unittest.py | 0 .../checks/mojom_restrictions_check.py | 0 .../mojom_restrictions_checks_unittest.py | 0 .../tools/bindings/concatenate-files.py | 0 ...concatenate_and_replace_closure_exports.py | 0 .../tools/bindings/gen_data_files_list.py | 0 .../tools/bindings/generate_type_mappings.py | 0 .../tools/bindings/minify_with_terser.py | 0 .../ipc/mojo/public/tools/bindings/mojom.gni | 0 .../bindings/mojom_bindings_generator.py | 0 .../mojom_bindings_generator_unittest.py | 0 .../tools/bindings/validate_typemap_config.py | 0 .../ipc/mojo/public/tools/mojom/BUILD.gn | 0 .../ipc/mojo/public/tools/mojom/README.md | 0 .../mojom/check_stable_mojom_compatibility.py | 0 ...eck_stable_mojom_compatibility_unittest.py | 0 .../mojo/public/tools/mojom/const_unittest.py | 0 .../mojo/public/tools/mojom/enum_unittest.py | 0 .../public/tools/mojom/feature_unittest.py | 0 .../mojo/public/tools/mojom/mojom/BUILD.gn | 0 .../mojo/public/tools/mojom/mojom/__init__.py | 0 .../mojo/public/tools/mojom/mojom/error.py | 0 .../mojo/public/tools/mojom/mojom/fileutil.py | 0 .../tools/mojom/mojom/fileutil_unittest.py | 0 .../tools/mojom/mojom/generate/__init__.py | 0 .../tools/mojom/mojom/generate/check.py | 0 .../tools/mojom/mojom/generate/generator.py | 0 .../mojom/generate/generator_unittest.py | 0 .../tools/mojom/mojom/generate/module.py | 0 .../mojom/mojom/generate/module_unittest.py | 0 .../public/tools/mojom/mojom/generate/pack.py | 0 .../mojom/mojom/generate/pack_unittest.py | 0 .../mojom/mojom/generate/template_expander.py | 0 .../tools/mojom/mojom/generate/translate.py | 0 .../mojom/generate/translate_unittest.py | 0 .../tools/mojom/mojom/parse/__init__.py | 0 .../public/tools/mojom/mojom/parse/ast.py | 0 .../tools/mojom/mojom/parse/ast_unittest.py | 0 .../mojom/mojom/parse/conditional_features.py | 0 .../parse/conditional_features_unittest.py | 0 .../public/tools/mojom/mojom/parse/lexer.py | 0 .../tools/mojom/mojom/parse/lexer_unittest.py | 0 .../public/tools/mojom/mojom/parse/parser.py | 0 .../mojom/mojom/parse/parser_unittest.py | 0 .../mojo/public/tools/mojom/mojom_parser.py | 0 .../tools/mojom/mojom_parser_test_case.py | 0 .../tools/mojom/mojom_parser_unittest.py | 0 .../tools/mojom/stable_attribute_unittest.py | 0 .../mojo/public/tools/mojom/union_unittest.py | 0 .../mojom/version_compatibility_unittest.py | 0 .../public/tools/run_all_python_unittests.py | 0 utils/{ => codegen}/ipc/parser.py | 3 - utils/{ => codegen}/ipc/tools/README | 0 .../ipc/tools/diagnosis/crbug_1001171.py | 0 utils/codegen/meson.build | 18 + utils/gen-controls.py | 389 ------------------ utils/meson.build | 10 +- utils/tracepoints/meson.build | 5 - 108 files changed, 513 insertions(+), 688 deletions(-) delete mode 100644 include/libcamera/property_ids.h.in delete mode 100644 src/libcamera/property_ids.cpp.in delete mode 100644 src/py/libcamera/py_properties_generated.cpp.in create mode 100644 utils/codegen/controls.py create mode 100755 utils/codegen/gen-controls.py rename utils/{ => codegen}/gen-formats.py (100%) rename utils/{ => codegen}/gen-header.sh (76%) rename utils/{ => codegen}/gen-ipa-pub-key.py (100%) rename utils/{tracepoints => codegen}/gen-tp-header.py (100%) rename utils/{ => codegen}/ipc/extract-docs.py (100%) rename utils/{ => codegen}/ipc/generate.py (94%) rename utils/{ => codegen}/ipc/generators/__init__.py (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/core_ipa_serializer.h.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/definition_functions.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/meson.build (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/module_ipa_proxy_worker.cpp.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/module_ipa_serializer.h.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/proxy_functions.tmpl (100%) rename utils/{ => codegen}/ipc/generators/libcamera_templates/serializer.tmpl (100%) rename utils/{ => codegen}/ipc/generators/meson.build (100%) rename utils/{ => codegen}/ipc/generators/mojom_libcamera_generator.py (100%) rename utils/{ => codegen}/ipc/meson.build (86%) rename utils/{ => codegen}/ipc/mojo/README (100%) rename utils/{ => codegen}/ipc/mojo/public/LICENSE (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/.style.yapf (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/BUILD.gn (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/BUILD.gn (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/README.md (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/__init__.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_attributes_check.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_attributes_check_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_definitions_check.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_interface_feature_check.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_interface_feature_check_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_restrictions_check.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/checks/mojom_restrictions_checks_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/concatenate-files.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/concatenate_and_replace_closure_exports.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/gen_data_files_list.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/generate_type_mappings.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/minify_with_terser.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/mojom.gni (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/mojom_bindings_generator.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/mojom_bindings_generator_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/bindings/validate_typemap_config.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/BUILD.gn (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/README.md (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/check_stable_mojom_compatibility.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/check_stable_mojom_compatibility_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/const_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/enum_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/feature_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/BUILD.gn (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/__init__.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/error.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/fileutil.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/fileutil_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/__init__.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/check.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/generator.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/generator_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/module.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/module_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/pack.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/pack_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/template_expander.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/translate.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/generate/translate_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/__init__.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/ast.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/ast_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/conditional_features_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/lexer.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/lexer_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/parser.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom/parse/parser_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom_parser.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom_parser_test_case.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/mojom_parser_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/stable_attribute_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/union_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/mojom/version_compatibility_unittest.py (100%) rename utils/{ => codegen}/ipc/mojo/public/tools/run_all_python_unittests.py (100%) rename utils/{ => codegen}/ipc/parser.py (83%) rename utils/{ => codegen}/ipc/tools/README (100%) rename utils/{ => codegen}/ipc/tools/diagnosis/crbug_1001171.py (100%) create mode 100644 utils/codegen/meson.build delete mode 100755 utils/gen-controls.py delete mode 100644 utils/tracepoints/meson.build base-commit: 1045522af99c9f26e0f583aa2310174f7ff42178