{"id":13028,"url":"https://patchwork.libcamera.org/api/1.1/patches/13028/?format=json","web_url":"https://patchwork.libcamera.org/patch/13028/","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":"<20210716121902.48338-1-jacopo@jmondi.org>","date":"2021-07-16T12:19:02","name":"[libcamera-devel,v2] ipa: core.mojom: Rework core file documentation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"308492d00106845510c197f789767939505c6c59","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13028/mbox/","series":[{"id":2245,"url":"https://patchwork.libcamera.org/api/1.1/series/2245/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2245","date":"2021-07-16T12:19:02","name":"[libcamera-devel,v2] ipa: core.mojom: Rework core file documentation","version":2,"mbox":"https://patchwork.libcamera.org/series/2245/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13028/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13028/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 54C8DC3226\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 16 Jul 2021 12:18:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C7B926853C;\n\tFri, 16 Jul 2021 14:18:21 +0200 (CEST)","from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6975768536\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Jul 2021 14:18:20 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 88E301C000C;\n\tFri, 16 Jul 2021 12:18:19 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 16 Jul 2021 14:19:02 +0200","Message-Id":"<20210716121902.48338-1-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.32.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2] ipa: core.mojom: Rework core file\n\tdocumentation","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The comment block at the beginning of the core.mojom file is meant to\nprovide an overview of how to use libcamera defined types in the definition\nof mojom interfaces.\n\nAs the IPA/IPC interface definition mechanism evolved, the documentation\nhas not been updated accordingly.\n\nUpdate the file comments to match the most recent IPA/IPC\ninterface definition and generation mechanism.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nv1->v2:\n- Address Paul's comment and clarify points that were not clear to me when I\n  wrote v1 :)\n  - (de)serializers implementations go in ipa_data_serializer.cpp\n  - types used as array/map members do not require a mojom definition\n  - remove duplications\n  - s/the library/libcamera\n- While at it, make all statements start with a capital letter and end without a\n  full-stop.\n---\n include/libcamera/ipa/core.mojom | 67 +++++++++++++++++++-------------\n 1 file changed, 40 insertions(+), 27 deletions(-)\n\n--\n2.32.0","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nindex b32f30939454..39fac624658a 100644\n--- a/include/libcamera/ipa/core.mojom\n+++ b/include/libcamera/ipa/core.mojom\n@@ -15,40 +15,53 @@ module libcamera;\n  *\n  * Attributes:\n  * - skipHeader - structs only, and only in core.mojom\n- *   - designate that this struct shall not have a C++ header definition\n- *     generated\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 mojo file for the Mojo core to accept it, except for\n+ *     types used as map/array members for which a definition is not required\n+ *   - This attribute allows defining a symbol for the Mojo core that\n+ *     corresponds to a libcamera type without duplicating its definition in the\n+ *     generated C++ headers\n  * - skipSerdes - structs only, and only in core.mojom\n- *   - designate that this struct shall not have a (de)serializer generated\n- *   - all fields need a (de)serializer to be defined, either hand-written\n- *     in ipa_data_serializer.h\n+ *   - Do not generate a (de)serializer for the structure\n+ *     - This attribute instructs the build system that a (de)serializer is\n+ *       available for the type and there's no need to generate one\n+ *   - All types need a (de)serializer to be defined in order to be transported\n+ *     over the IPA protocol. The (de)serializer can be:\n+ *     - Manually implemented as a template specialization in\n+ *       ipa_data_serializer.cpp in the libcamera sources\n+ *     - Generated at build time for types defined in a mojo interfaces\n  * - hasFd - struct fields or empty structs only\n- *   - designate that this field or empty struct contains a FileDescriptor\n+ *   - Designate that this field or empty struct contains a FileDescriptor\n  *\n  * Rules:\n- * - Any struct that is used in a struct definition in mojom must also be\n- *   defined in mojom\n- *   - If the struct has both a definition in a C++ header and a (de)serializer\n- *     in ipa_data_serializer.h, then the struct shall be declared as empty,\n- *     with both the [skipHeader] and [skipSerdes] attributes\n- *   - If the struct only has a definition in a C++ header, but no\n- *     (de)serializer, then the struct definition should have the [skipHeader]\n- *     attribute\n- * - Nested structures (e.g. FrameBuffer::Plane) cannot be defined in mojom.\n- *   - Avoid them, by defining them in a header in C++ and a (de)serializer in\n- *     ipa_data_serializer.h\n- * - If a struct is in an array/map inside a struct, then the struct that is\n- *   the member of the array/map does not need a mojom definition if it is\n- *   defined in a C++ header.\n- *   - This can be used to embed nested structures. The C++ double colon is\n- *     replaced with a dot (e.g. FrameBuffer::Plane -> FrameBuffer.Plane)\n- *   - The struct must still be defined in a header in C++ and a (de)serializer\n- *     implemented in ipa_data_serializer.h, as it cannot be defined in mojom\n+ * - If the type is defined in a libcamera C++ header *and* a (de)serializer is\n+ *   available then the type shall be declared as empty with both attributes\n+ *   associated and specified as: [skipHeader, skipSerdes]\n+ *   - Example: [skipHeader, skipSerdes] ControlList {};\n+ * - If the type is defined in libcamera but no (de)serializer is available\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+ * - 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 contained in an array/map do not require a mojom definition\n+ *   if one exists in libcamera\n+ * - Nested types (e.g. FrameBuffer::Plane) cannot be directly used in mojom\n+ *   - If used directly in mojom, the nested type shall be defined in a C++\n+ *     header and a (de)serializer shall be provided\n+ *   - The C++ namespace separator :: is replaced with a dot\n+ *   - In example, to directly use the FrameBuffer::Plane type:\n+ *     - Provide a definition of the Plane type in a C++ header\n+ *     - Include the header in ipa_interface.h\n+ *     - Provide a (de)serializer implementation ipa_data_serializer.cpp\n+ *     - In mojom, reference the type as FrameBuffer.Plane\n+ *   - Nested types can be used without an associated C++ definition if used\n+ *     as part of an array/map container\n  * - [skipHeader] and [skipSerdes] only work here in core.mojom.\n- * - If a struct definition has [skipHeader], then the header where the\n- *   struct is defined must be #included in ipa_interface.h\n  * - If a field in a struct has a FileDescriptor, but is not explicitly\n  *   defined so in mojom, then the field must be marked with the [hasFd]\n- *   attribute.\n+ *   attribute\n  *\n  * \\todo Generate documentation from Doxygen comments in .mojom files\n  * \\todo Figure out how to keep the skipHeader structs in sync with their\n","prefixes":["libcamera-devel","v2"]}