{"id":17586,"url":"https://patchwork.libcamera.org/api/1.1/patches/17586/?format=json","web_url":"https://patchwork.libcamera.org/patch/17586/","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":"<20221011105859.457567-9-paul.elder@ideasonboard.com>","date":"2022-10-11T10:58:58","name":"[libcamera-devel,v5,8/9] utils: ipc: Allow the skipHeader attribute on enums","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8fb82886eb601d8813143948832b879f031c6ebc","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/17586/mbox/","series":[{"id":3551,"url":"https://patchwork.libcamera.org/api/1.1/series/3551/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3551","date":"2022-10-11T10:58:50","name":"utils: ipc: Add support for enums and Flags","version":5,"mbox":"https://patchwork.libcamera.org/series/3551/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/17586/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/17586/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 614BDC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Oct 2022 10:59:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D73662D8E;\n\tTue, 11 Oct 2022 12:59:30 +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 7D87762D8B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Oct 2022 12:59:28 +0200 (CEST)","from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp\n\t[175.177.42.159])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3BD6F907;\n\tTue, 11 Oct 2022 12:59:26 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1665485970;\n\tbh=eUWxVu6zA8CheNezZiypVMsU5UjYnbSxlGieicPkHCU=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Roe2wSViy4Mrc3M5Og/9DRa7Xqr7I9Fk15FD2gkFDAhQTo5wkyPtQUUn87v8ycNA8\n\tbKCmDmLuUqlBm7+pYX/fIPlDdJZTLsqPnocwGYGwo0XeWViEz0mIityRUInII6cODi\n\tYHOGFcGzHKqLFh+eFIPKD12Af0EiSiKF9wOUq9ZnhiuPz8g+BO2LhOQ93CoVj4127R\n\tZj1gT4DAu9ghfhTFYeBrHxu5IUAr0XuRHydZYOG0/ReXbtF8o/FoiYEaG+19V/RlHf\n\t+4N2IVompgc+ijYp8WtFajPrwj11FItEwQoGSl9NWNqVLW0KrGeDEw8Z/XBabCdTgu\n\tvp28UmywFjI9Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1665485968;\n\tbh=eUWxVu6zA8CheNezZiypVMsU5UjYnbSxlGieicPkHCU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ffs1ch6uBMj1EtJnX5KiN6GcdBSmSe53nZISrsAGtHVUel0oHAd3b3bemcmfM4ZwZ\n\tpp4w7nLupccXrmoZEEq8TtlzHf98GaUZ4fILvC6Mzyg80ygQ0CPwVqJfhShPaaJ7eW\n\t1vSfMQitgfu+bejHN7jGdYRd7GTvw9a0eq8zjOuY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ffs1ch6u\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 11 Oct 2022 19:58:58 +0900","Message-Id":"<20221011105859.457567-9-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20221011105859.457567-1-paul.elder@ideasonboard.com>","References":"<20221011105859.457567-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 8/9] utils: ipc: Allow the skipHeader\n\tattribute on enums","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>","From":"Paul Elder via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Paul Elder <paul.elder@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Currently, enums that are passed between pipeline handlers and their IPA\nmust be defined in a mojom file. However, there is a use case for\nenum/flags to be defined in a C++ header, such that the enum can be used\nin a component other than the pipeline handler and its IPA.\n\nTo support this, add support for the skipHeader attribute for enums.\nLike structs, it is only allowed in core.mojom.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v5\n---\n include/libcamera/ipa/core.mojom                              | 4 +++-\n include/libcamera/ipa/ipa_interface.h                         | 4 ++--\n .../generators/libcamera_templates/core_ipa_interface.h.tmpl  | 2 +-\n utils/ipc/generators/mojom_libcamera_generator.py             | 2 +-\n 4 files changed, 7 insertions(+), 5 deletions(-)","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nindex ef28ff2d..1ff674b0 100644\n--- a/include/libcamera/ipa/core.mojom\n+++ b/include/libcamera/ipa/core.mojom\n@@ -14,7 +14,7 @@ module libcamera;\n  * - structs\n  *\n  * Attributes:\n- * - skipHeader - structs only, and only in core.mojom\n+ * - skipHeader - allowed only for structs and enums in core.mojom\n  *   - Do not generate a C++ definition for the structure\n  *   - Any type used in a mojom interface definition must have a corresponding\n  *     definition in a mojom file for the code generator to accept it, except\n@@ -52,6 +52,8 @@ module libcamera;\n  *   then the type definition in the core.mojom file should have the\n  *   [skipHeader] attribute only\n  *   - A (de)serializer will be generated for the type\n+ *   - enums that are defined in a libcamera C++ header also fall in this\n+ *     category\n  * - If a type definition has [skipHeader], then the header where the type is\n  *   defined must be included in ipa_interface.h\n  * - Types that are solely used as array/map members do not require a mojom\ndiff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h\nindex 8afcfe21..8884f0ed 100644\n--- a/include/libcamera/ipa/ipa_interface.h\n+++ b/include/libcamera/ipa/ipa_interface.h\n@@ -23,8 +23,8 @@\n namespace libcamera {\n \n /*\n- * Structs that are defined in core.mojom and have the skipHeader tag must be\n- * #included here.\n+ * Structs and enums that are defined in core.mojom that have the skipHeader\n+ * tag must be #included here.\n  */\n \n class IPAInterface\ndiff --git a/utils/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\nindex a565b59a..c60b99b8 100644\n--- a/utils/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n+++ b/utils/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n@@ -26,7 +26,7 @@ namespace libcamera {\n static const {{const.kind|name}} {{const.mojom_name}} = {{const.value}};\n {% endfor %}\n \n-{% for enum in enums %}\n+{% for enum in enums_gen_header %}\n {{funcs.define_enum(enum)}}\n {% endfor %}\n \ndiff --git a/utils/ipc/generators/mojom_libcamera_generator.py b/utils/ipc/generators/mojom_libcamera_generator.py\nindex 6c176aba..64987ccd 100644\n--- a/utils/ipc/generators/mojom_libcamera_generator.py\n+++ b/utils/ipc/generators/mojom_libcamera_generator.py\n@@ -483,7 +483,7 @@ class Generator(generator.Generator):\n     def _GetJinjaExportsForCore(self):\n         return {\n             'consts': self.module.constants,\n-            'enums': self.module.enums,\n+            'enums_gen_header': [x for x in self.module.enums if x.attributes is None or 'skipHeader' not in x.attributes],\n             'has_array': len([x for x in self.module.kinds.keys() if x[0] == 'a']) > 0,\n             'has_map': len([x for x in self.module.kinds.keys() if x[0] == 'm']) > 0,\n             'structs_gen_header': [x for x in self.module.structs if x.attributes is None or 'skipHeader' not in x.attributes],\n","prefixes":["libcamera-devel","v5","8/9"]}