Show a patch.

GET /api/patches/2309/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2309,
    "url": "https://patchwork.libcamera.org/api/patches/2309/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2309/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20191108205409.18845-14-laurent.pinchart@ideasonboard.com>",
    "date": "2019-11-08T20:53:58",
    "name": "[libcamera-devel,v2,13/24] ipa: Define serialized controls",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6237abf99106d6b7a19f0c4999acaa364852dc7f",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2309/mbox/",
    "series": [
        {
            "id": 568,
            "url": "https://patchwork.libcamera.org/api/series/568/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=568",
            "date": "2019-11-08T20:53:45",
            "name": "Control serialization and IPA C API",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/568/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2309/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2309/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<laurent.pinchart@ideasonboard.com>",
        "Received": [
            "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 36E086151D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 Nov 2019 21:54:27 +0100 (CET)",
            "from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BF80D31D;\n\tFri,  8 Nov 2019 21:54:26 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1573246466;\n\tbh=kMklr1t3TFAoq4LOKrvO52dXWss1jMcLkT0p/Hfqflw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UN7W47GAC9IquZzPBLdYQaczK2XxHQkjjLa15VEewcegdH+wSNZiDquUrUH92xsFt\n\t4lAG4nr0vDayf/Eo2lnOd0m6NuvWoUTFjqF5pYibKuV94o4xsTa8wDSJVifw3J2E8F\n\tluQDK19hk2JlpbcscByohZqfti/aHFDtRIOAWNZM=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  8 Nov 2019 22:53:58 +0200",
        "Message-Id": "<20191108205409.18845-14-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.23.0",
        "In-Reply-To": "<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20191108205409.18845-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 13/24] ipa: Define serialized controls",
        "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>",
        "X-List-Received-Date": "Fri, 08 Nov 2019 20:54:27 -0000"
    },
    "content": "From: Jacopo Mondi <jacopo@jmondi.org>\n\nDefine data structures to be used during interaction between IPA modules\nand pipeline handlers to serialize control lists and control info maps.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/ipa/ipa_controls.h     |  54 ++++++++++\n include/ipa/meson.build        |   1 +\n src/libcamera/ipa_controls.cpp | 187 +++++++++++++++++++++++++++++++++\n src/libcamera/meson.build      |   1 +\n 4 files changed, 243 insertions(+)\n create mode 100644 include/ipa/ipa_controls.h\n create mode 100644 src/libcamera/ipa_controls.cpp",
    "diff": "diff --git a/include/ipa/ipa_controls.h b/include/ipa/ipa_controls.h\nnew file mode 100644\nindex 000000000000..de3a017b0179\n--- /dev/null\n+++ b/include/ipa/ipa_controls.h\n@@ -0,0 +1,54 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * ipa_controls.h - IPA Control handling\n+ */\n+#ifndef __LIBCAMERA_IPA_CONTROLS_H__\n+#define __LIBCAMERA_IPA_CONTROLS_H__\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#define IPA_CONTROLS_FORMAT_VERSION\t1\n+\n+struct ipa_controls_header {\n+\tuint32_t version;\n+\tuint32_t handle;\n+\tuint32_t entries;\n+\tuint32_t size;\n+\tuint32_t data_offset;\n+\tuint32_t reserved[3];\n+};\n+\n+struct ipa_control_value_entry {\n+\tuint32_t id;\n+\tuint32_t type;\n+\tuint32_t count;\n+\tuint32_t offset;\n+};\n+\n+struct ipa_control_range_entry {\n+\tuint32_t id;\n+\tuint32_t type;\n+\tuint32_t offset;\n+\tuint32_t padding[1];\n+};\n+\n+union ipa_control_value_data {\n+\tbool b;\n+\tint32_t i32;\n+\tint64_t i64;\n+};\n+\n+struct ipa_control_range_data {\n+\tunion ipa_control_value_data min;\n+\tunion ipa_control_value_data max;\n+};\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* __LIBCAMERA_IPA_CONTROLS_H__ */\ndiff --git a/include/ipa/meson.build b/include/ipa/meson.build\nindex a0ce96ba96c3..695a4183a0e8 100644\n--- a/include/ipa/meson.build\n+++ b/include/ipa/meson.build\n@@ -1,4 +1,5 @@\n libcamera_ipa_api = files([\n+    'ipa_controls.h',\n     'ipa_interface.h',\n     'ipa_module_info.h',\n ])\ndiff --git a/src/libcamera/ipa_controls.cpp b/src/libcamera/ipa_controls.cpp\nnew file mode 100644\nindex 000000000000..bbcc5301cd59\n--- /dev/null\n+++ b/src/libcamera/ipa_controls.cpp\n@@ -0,0 +1,187 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * ipa_controls.h - IPA control handling\n+ */\n+\n+/**\n+ * \\file ipa_controls.h\n+ * \\brief Type definitions for serialized controls\n+ *\n+ * This file defines binary formats to store ControlList and ControlInfoMap\n+ * instances in contiguous, self-contained memory areas called control packets.\n+ * It describes the layout of the packets through a set of C structures. These\n+ * formats shall be used when serializing ControlList and ControlInfoMap to\n+ * transfer them through the IPA C interface and IPA IPC transports.\n+ *\n+ * A control packet contains a list of entries, each of them describing a single\n+ * control range or control value. The packet starts with a fixed-size header\n+ * described by the ipa_controls_header structure, followed by an array of\n+ * fixed-size entries. Each entry is associated with data, stored either\n+ * directly in the entry, or in a data section after the entries array.\n+ *\n+ * The following diagram describes the layout of the ControlList packet.\n+ *\n+ * ~~~~\n+ *           +-------------------------+    .                      .\n+ *  Header / | ipa_controls_header     |    |                      |\n+ *         | |                         |    |                      |\n+ *         \\ |                         |    |                      |\n+ *           +-------------------------+    |                      |\n+ *         / | ipa_control_value_entry |    | hdr.data_offset      |\n+ *         | | #0                      |    |                      |\n+ * Control | +-------------------------+    |                      |\n+ *   value | | ...                     |    |                      |\n+ * entries | +-------------------------+    |                      |\n+ *         | | ipa_control_value_entry |    |             hdr.size |\n+ *         \\ | #hdr.entries - 1        |    |                      |\n+ *           +-------------------------+    |                      |\n+ *           | empty space (optional)  |    |                      |\n+ *           +-------------------------+ <--´  .                   |\n+ *         / | ...                     |       | entry[n].offset   |\n+ *    Data | | ...                     |       |                   |\n+ * section | | value data for entry #n | <-----´                   |\n+ *         \\ | ...                     |                           |\n+ *           +-------------------------+                           |\n+ *           | empty space (optional)  |                           |\n+ *           +-------------------------+ <-------------------------´\n+ * ~~~~\n+ *\n+ * The packet header contains the size of the packet, the number of entries, and\n+ * the offset from the beginning of the packet to the data section. The packet\n+ * entries array immediately follows the header. The data section starts at the\n+ * offset ipa_controls_header::data_offset from the beginning of the packed, and\n+ * shall be aligned to a multiple of 8 bytes.\n+ *\n+ * Entries are described by the ipa_control_value_entry structure. They contain\n+ * the numerical ID of the control, its type, and the number of control values.\n+ * The control values are stored in the platform's native format.\n+ *\n+ * The control values are stored in the data section in the platform's native\n+ * format. The ipa_control_value_entry::offset field stores the offset from the\n+ * beginning of the data section to the values.\n+ *\n+ * All control values in the data section shall be stored in the same order as\n+ * the controls in the entries array, shall be aligned to a multiple of 8 bytes,\n+ * and shall be contiguous in memory.\n+ *\n+ * Empty spaces may be present between the end of the entries array and the\n+ * data section, and after the data section. They shall be ignored when parsing\n+ * the packet.\n+ *\n+ * The following diagram describes the layout of the ControlInfoMap packet.\n+ *\n+ * ~~~~\n+ *           +-------------------------+    .                      .\n+ *  Header / | ipa_controls_header     |    |                      |\n+ *         | |                         |    |                      |\n+ *         \\ |                         |    |                      |\n+ *           +-------------------------+    |                      |\n+ *         / | ipa_control_range_entry |    | hdr.data_offset      |\n+ *         | | #0                      |    |                      |\n+ * Control | +-------------------------+    |                      |\n+ *   range | | ...                     |    |                      |\n+ * entries | +-------------------------+    |                      |\n+ *         | | ipa_control_range_entry |    |             hdr.size |\n+ *         \\ | #hdr.entries - 1        |    |                      |\n+ *           +-------------------------+    |                      |\n+ *           | empty space (optional)  |    |                      |\n+ *           +-------------------------+ <--´  .                   |\n+ *         / | ...                     |       | entry[n].offset   |\n+ *    Data | | ...                     |       |                   |\n+ * section | | range data for entry #n | <-----´                   |\n+ *         \\ | ...                     |                           |\n+ *           +-------------------------+                           |\n+ *           | empty space (optional)  |                           |\n+ *           +-------------------------+ <-------------------------´\n+ * ~~~~\n+ *\n+ * The packet header is identical to the ControlList packet header.\n+ *\n+ * Entries are described by the ipa_control_range_entry structure. They contain\n+ * the numerical ID and type of the control. The control range data is stored\n+ * in the data section as described by the ipa_control_range_data structure.\n+ * The ipa_control_range_entry::offset field stores the offset from the\n+ * beginning of the data section to the range data.\n+ *\n+ * Range data in the data section shall be stored in the same order as the\n+ * entries array, shall be aligned to a multiple of 8 bytes, and shall be\n+ * contiguous in memory.\n+ *\n+ * As for the ControlList packet, empty spaces may be present between the end of\n+ * the entries array and the data section, and after the data section. They\n+ * shall be ignored when parsing the packet.\n+ */\n+\n+/**\n+ * \\def IPA_CONTROLS_FORMAT_VERSION\n+ * \\brief The current control serialization format version\n+ */\n+\n+/**\n+ * \\struct ipa_controls_header\n+ * \\brief Serialized control packet header\n+ * \\var ipa_controls_header::version\n+ * Control packet format version number (shall be IPA_CONTROLS_FORMAT_VERSION)\n+ * \\var ipa_controls_header::handle\n+ * For ControlInfoMap packets, this field contains a unique non-zero handle\n+ * generated when the ControlInfoMap is serialized. For ControlList packets,\n+ * this field contains the handle of the corresponding ControlInfoMap.\n+ * \\var ipa_controls_header::entries\n+ * Number of entries in the packet\n+ * \\var ipa_controls_header::size\n+ * The total packet size in bytes\n+ * \\var ipa_controls_header::data_offset\n+ * Offset in bytes from the beginning of the packet of the data section start\n+ * \\var ipa_controls_header::reserved\n+ * Reserved for future extensions\n+ */\n+\n+/**\n+ * \\struct ipa_control_value_entry\n+ * \\brief Description of a serialized ControlValue entry\n+ * \\var ipa_control_value_entry::id\n+ * The numerical ID of the control\n+ * \\var ipa_control_value_entry::type\n+ * The type of the control (defined by enum ControlType)\n+ * \\var ipa_control_value_entry::count\n+ * The number of control array entries for array controls (1 otherwise)\n+ * \\var ipa_control_value_entry::offset\n+ * The offset in bytes from the beginning of the data section to the control\n+ * value data (shall be a multiple of 8 bytes).\n+ */\n+\n+/**\n+ * \\struct ipa_control_range_entry\n+ * \\brief Description of a serialized ControlRange entry\n+ * \\var ipa_control_range_entry::id\n+ * The numerical ID of the control\n+ * \\var ipa_control_range_entry::type\n+ * The type of the control (defined by enum ControlType)\n+ * \\var ipa_control_range_entry::offset\n+ * The offset in bytes from the beginning of the data section to the control\n+ * range data (shall be a multiple of 8 bytes)\n+ * \\var ipa_control_range_entry::padding\n+ * Padding bytes (shall be set to 0)\n+ */\n+\n+/**\n+ * \\union ipa_control_value_data\n+ * \\brief Serialized control value\n+ * \\var ipa_control_value_data::b\n+ * Value for ControlTypeBool controls\n+ * \\var ipa_control_value_data::i32\n+ * Value for ControlTypeInteger32 controls\n+ * \\var ipa_control_value_data::i64\n+ * Value for ControlTypeInteger64 controls\n+ */\n+\n+/**\n+ * \\struct ipa_control_range_data\n+ * \\brief Serialized control range\n+ * \\var ipa_control_range_data::min\n+ * The control minimum value\n+ * \\var ipa_control_range_data::max\n+ * The control maximum value\n+ */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex afbca76968f9..be0cd53f6f10 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -14,6 +14,7 @@ libcamera_sources = files([\n     'event_notifier.cpp',\n     'formats.cpp',\n     'geometry.cpp',\n+    'ipa_controls.cpp',\n     'ipa_interface.cpp',\n     'ipa_manager.cpp',\n     'ipa_module.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "13/24"
    ]
}