{"id":11278,"url":"https://patchwork.libcamera.org/api/patches/11278/?format=json","web_url":"https://patchwork.libcamera.org/patch/11278/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210213042143.112361-10-paul.elder@ideasonboard.com>","date":"2021-02-13T04:21:43","name":"[libcamera-devel,v8,9/9] ipa: Add core.mojom","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"ad44f06294a9683117a91eaf8020b3221c0978d2","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11278/mbox/","series":[{"id":1687,"url":"https://patchwork.libcamera.org/api/series/1687/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1687","date":"2021-02-13T04:21:34","name":"IPA isolation: Part 1: Core components","version":8,"mbox":"https://patchwork.libcamera.org/series/1687/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11278/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11278/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 923B1BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 13 Feb 2021 04:22:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60534637B1;\n\tSat, 13 Feb 2021 05:22:23 +0100 (CET)","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 200BA637A1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 13 Feb 2021 05:22:21 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 097FC564;\n\tSat, 13 Feb 2021 05:22:18 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gSaR/K4r\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1613190140;\n\tbh=sJ9mEd2Owt3YLui8yxOnTvVYaV86oHY/9gOt0fJnVxA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gSaR/K4rX0ZvcFwP+ay3Ykqi69kkHsk8homBam2e2kXg+sT3W3YvsqwCMJxm8sqFG\n\tws130HeqbPFjR+aIFON+9YnqX7h1FPeKYdjYoXLc2G8YlrpE7MfPn6fGJ9xhv5YyLK\n\tWWI++2KYmDo5s5GvyOqTilYb59X7Hr8Nx+4/sXRY=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 13 Feb 2021 13:21:43 +0900","Message-Id":"<20210213042143.112361-10-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210213042143.112361-1-paul.elder@ideasonboard.com>","References":"<20210213042143.112361-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v8 9/9] ipa: Add core.mojom","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>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a base mojom file to contain empty mojom definitions of libcamera\nobjects, as well as documentation for the IPA interfaces that need to be\ndefined in the mojom files.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\nNo change in v8\n\nChanges in v7:\n- update documentation and code for the switch from genHeader/genSerdes to\n  skipHeader/skipSerdes\n- rebase on new CameraSensorInfo\n- other cosmetic changes\n\nChanges in v6:\n- expand documentation on what can and can't be done in mojom\n- add definitions for geometry.h structs, and the structs that used to\n  be in ipa_interface.h, including their documentation\n- remove documentation for start()\n\nChanges in v5:\n- add todo for defining some libcamera ipa structs in mojom\n- remove ipa_mojom_core from dependencies of everything in the\n  generator stage\n- add documentation for the base IPA functions (init, stop, start)\n\nChanges in v4:\n- move docs to IPA guide\n\nChanges in v3:\n- add doc that structs need to be defined\n- add doc to recommend namespacing\n- change indentation\n- add requirement that base controls *must* be defined in\n  libcamera::{pipeline_name}::Controls\n\nNew in v2\n---\n include/libcamera/ipa/core.mojom | 191 +++++++++++++++++++++++++++++++\n 1 file changed, 191 insertions(+)\n create mode 100644 include/libcamera/ipa/core.mojom","diff":"diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nnew file mode 100644\nindex 00000000..5236a672\n--- /dev/null\n+++ b/include/libcamera/ipa/core.mojom\n@@ -0,0 +1,191 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+\n+/*\n+ * Things that can be defined here (and in other mojom files):\n+ * - consts\n+ * - enums\n+ * - structs\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+ * - 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+ * - hasFd - struct fields or empty structs only\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+ * - [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 (or the struct forward-declared) in\n+ *   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+ *\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+ * C++ definitions, and the skipSerdes structs in sync with their\n+ * (de)serializers\n+ */\n+[skipSerdes, skipHeader] struct ControlInfoMap {};\n+[skipSerdes, skipHeader] struct ControlList {};\n+[skipSerdes, skipHeader] struct FileDescriptor {};\n+\n+[skipHeader] struct Point {\n+\tint32 x;\n+\tint32 y;\n+};\n+\n+[skipHeader] struct Size {\n+\tuint32 width;\n+\tuint32 height;\n+};\n+\n+[skipHeader] struct SizeRange {\n+\tSize min;\n+\tSize max;\n+\tuint32 hStep;\n+\tuint32 vStep;\n+};\n+\n+[skipHeader] struct Rectangle {\n+\tint32 x;\n+\tint32 y;\n+\tuint32 width;\n+\tuint32 height;\n+};\n+\n+[skipHeader] struct CameraSensorInfo {\n+\tstring model;\n+\n+\tuint32 bitsPerPixel;\n+\n+\tSize activeAreaSize;\n+\tRectangle analogCrop;\n+\tSize outputSize;\n+\n+\tuint64 pixelRate;\n+\tuint32 lineLength;\n+\n+\tuint32 minFrameLength;\n+\tuint32 maxFrameLength;\n+};\n+\n+/**\n+ * \\struct IPABuffer\n+ * \\brief Buffer information for the IPA interface\n+ *\n+ * The IPABuffer structure associates buffer memory with a unique ID. It is\n+ * used to map buffers to the IPA with IPAInterface::mapBuffers(), after which\n+ * buffers will be identified by their ID in the IPA interface.\n+ */\n+\n+/**\n+ * \\var IPABuffer::id\n+ * \\brief The buffer unique ID\n+ *\n+ * Buffers mapped to the IPA are identified by numerical unique IDs. The IDs\n+ * are chosen by the pipeline handler to fulfil the following constraints:\n+ *\n+ * - IDs shall be positive integers different than zero\n+ * - IDs shall be unique among all mapped buffers\n+ *\n+ * When buffers are unmapped with IPAInterface::unmapBuffers() their IDs are\n+ * freed and may be reused for new buffer mappings.\n+ */\n+\n+/**\n+ * \\var IPABuffer::planes\n+ * \\brief The buffer planes description\n+ *\n+ * Stores the dmabuf handle and length for each plane of the buffer.\n+ */\n+\n+struct IPABuffer {\n+\tuint32 id;\n+\t[hasFd] array<FrameBuffer.Plane> planes;\n+};\n+\n+/**\n+ * \\struct IPASettings\n+ * \\brief IPA interface initialization settings\n+ *\n+ * The IPASettings structure stores data passed to the IPAInterface::init()\n+ * function. The data contains settings that don't depend on a particular camera\n+ * or pipeline configuration and are valid for the whole life time of the IPA\n+ * interface.\n+ */\n+\n+/**\n+ * \\var IPASettings::configurationFile\n+ * \\brief The name of the IPA configuration file\n+ *\n+ * This field may be an empty string if the IPA doesn't require a configuration\n+ * file.\n+ */\n+struct IPASettings {\n+\tstring configurationFile;\n+};\n+\n+/**\n+ * \\struct IPAStream\n+ * \\brief Stream configuration for the IPA interface\n+ *\n+ * The IPAStream structure stores stream configuration parameters needed by the\n+ * IPAInterface::configure() method. It mirrors the StreamConfiguration class\n+ * that is not suitable for this purpose due to not being serializable.\n+ */\n+\n+/**\n+ * \\var IPAStream::pixelFormat\n+ * \\brief The stream pixel format\n+ */\n+\n+/**\n+ * \\var IPAStream::size\n+ * \\brief The stream size in pixels\n+ */\n+struct IPAStream {\n+\tuint32 pixelFormat;\n+\tSize size;\n+};\n+\n+/**\n+ * \\fn IPAInterface::init()\n+ * \\brief Initialise the IPAInterface\n+ * \\param[in] settings The IPA initialization settings\n+ *\n+ * This function initializes the IPA interface. It shall be called before any\n+ * other function of the IPAInterface. The \\a settings carry initialization\n+ * parameters that are valid for the whole life time of the IPA interface.\n+ */\n+\n+/**\n+ * \\fn IPAInterface::stop()\n+ * \\brief Stop the IPA\n+ *\n+ * This method informs the IPA module that the camera is stopped. The IPA module\n+ * shall release resources prepared in start().\n+ */\n","prefixes":["libcamera-devel","v8","9/9"]}