Show a patch.

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

{
    "id": 9919,
    "url": "https://patchwork.libcamera.org/api/patches/9919/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9919/",
    "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": "<20201002143154.468162-12-paul.elder@ideasonboard.com>",
    "date": "2020-10-02T14:31:27",
    "name": "[libcamera-devel,v3,11/38] libcamera: Add IPAIPC",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "002ee9415e9e9a57c0ab2b2c91c375535af893d1",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/9919/mbox/",
    "series": [
        {
            "id": 1348,
            "url": "https://patchwork.libcamera.org/api/series/1348/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1348",
            "date": "2020-10-02T14:31:16",
            "name": "IPA isolation implementation",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/1348/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9919/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9919/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 F3492C3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Oct 2020 14:32:34 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB80C63B6E;\n\tFri,  2 Oct 2020 16:32:34 +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 AA6EC63B6E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Oct 2020 16:32:33 +0200 (CEST)",
            "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 E00EE2A2;\n\tFri,  2 Oct 2020 16:32:31 +0200 (CEST)"
        ],
        "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=\"kspCDVoQ\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601649153;\n\tbh=kaNKMD3AjVHE+16afzcqNrZh8mELyQJUprSl13QdFLw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kspCDVoQkVqGr3dZ1H7/goHuUhCBcjVXF4ZH9Tgepwq0SwzQkP9E2KVFsYKj3DIOK\n\tp3FaPAl/esZ9+IcghcswW1+tn/qmgxIJplwDv4agM0YiweGWRVzwxZF3DGmb/sbpq8\n\tSQCcw8dr/ltJw7GG1filREnKIgwImnQT7JfmY8ZU=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  2 Oct 2020 23:31:27 +0900",
        "Message-Id": "<20201002143154.468162-12-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201002143154.468162-1-paul.elder@ideasonboard.com>",
        "References": "<20201002143154.468162-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v3 11/38] libcamera: Add IPAIPC",
        "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=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Create a virtual IPAIPC class that models an IPC/RPC system. IPA proxies\nand proxy workers will call into the IPAIPC, rather than implementing\nthe IPC themselves.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v3:\n- expand documentation a bit\n- move [[maybe_unused]] to after the parameters in the IPAIPC\n  constructor, to appease gcc <= 9.1\n\nChanges in v2:\n- add documentation\n---\n include/libcamera/internal/ipa_ipc.h |  41 ++++++++++\n src/libcamera/ipa_ipc.cpp            | 114 +++++++++++++++++++++++++++\n src/libcamera/meson.build            |   1 +\n 3 files changed, 156 insertions(+)\n create mode 100644 include/libcamera/internal/ipa_ipc.h\n create mode 100644 src/libcamera/ipa_ipc.cpp",
    "diff": "diff --git a/include/libcamera/internal/ipa_ipc.h b/include/libcamera/internal/ipa_ipc.h\nnew file mode 100644\nindex 00000000..09de36a5\n--- /dev/null\n+++ b/include/libcamera/internal/ipa_ipc.h\n@@ -0,0 +1,41 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * ipa_ipc.h - Image Processing Algorithm IPC module for IPA proxies\n+ */\n+#ifndef __LIBCAMERA_INTERNAL_IPA_IPC_H__\n+#define __LIBCAMERA_INTERNAL_IPA_IPC_H__\n+\n+#include <vector>\n+\n+namespace libcamera {\n+\n+class IPAIPC\n+{\n+public:\n+\tIPAIPC(const char *ipa_module_path [[maybe_unused]],\n+\t       const char *ipa_proxy_worker_path [[maybe_unused]]);\n+\tvirtual ~IPAIPC();\n+\n+\tbool isValid() const { return valid_; }\n+\n+\tvirtual int sendSync(uint32_t cmd,\n+\t\t\t     const std::vector<uint8_t> &data_in,\n+\t\t\t     const std::vector<int32_t> &fds_in,\n+\t\t\t     std::vector<uint8_t> *data_out = nullptr,\n+\t\t\t     std::vector<int32_t> *fds_out = nullptr) = 0;\n+\n+\tvirtual int sendAsync(uint32_t cmd,\n+\t\t\t      const std::vector<uint8_t> &data_in,\n+\t\t\t      const std::vector<int32_t> &fds_in) = 0;\n+\n+\tSignal<std::vector<uint8_t> &, std::vector<int32_t> &> recvIPC;\n+\n+protected:\n+\tbool valid_;\n+};\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_INTERNAL_IPA_IPC_H__ */\ndiff --git a/src/libcamera/ipa_ipc.cpp b/src/libcamera/ipa_ipc.cpp\nnew file mode 100644\nindex 00000000..b963351f\n--- /dev/null\n+++ b/src/libcamera/ipa_ipc.cpp\n@@ -0,0 +1,114 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2020, Google Inc.\n+ *\n+ * ipa_ipc.cpp - Image Processing Algorithm IPC module for IPA proxies\n+ */\n+\n+#include <vector>\n+\n+#include \"libcamera/internal/ipc_unixsocket.h\"\n+#include \"libcamera/internal/log.h\"\n+#include \"libcamera/internal/process.h\"\n+#include \"libcamera/internal/thread.h\"\n+\n+#include <libcamera/event_dispatcher.h>\n+#include <libcamera/timer.h>\n+\n+#include \"libcamera/internal/ipa_ipc.h\"\n+\n+/**\n+ * \\file ipa_ipc.h\n+ * \\brief IPC mechanism for IPA isolation\n+ */\n+\n+namespace libcamera {\n+\n+LOG_DEFINE_CATEGORY(IPAIPC)\n+\n+/**\n+ * \\class IPAIPC\n+ * \\brief IPC mechanism for IPA isolation\n+ *\n+ * Virtual class to model an IPC mechanism for use by IPA proxies for IPA\n+ * isolation. sendSync() and sendAsync() must be implemented, and the recvIPC\n+ * signal must be emitted whenever new data is available.\n+ */\n+\n+/**\n+ * \\brief Construct an IPAIPC instance\n+ * \\param[in] ipa_module_path Path to the IPA module shared object\n+ * \\param[in] ipa_proxy_worker_path Path to the IPA proxy worker shared object\n+ */\n+IPAIPC::IPAIPC([[maybe_unused]] const char *ipa_module_path,\n+\t       [[maybe_unused]] const char *ipa_proxy_worker_path)\n+\t: valid_(false)\n+{\n+}\n+\n+IPAIPC::~IPAIPC()\n+{\n+}\n+\n+/**\n+ * \\fn IPAIPC::isValid()\n+ * \\brief Check if the IPAIPC instance is valid\n+ *\n+ * An IPAIPC instance is valid if the IPA interface is successfully created in\n+ * isolation, and IPC is successfully set up.\n+ *\n+ * \\return True if the IPAIPC is valid, false otherwise\n+ */\n+\n+/**\n+ * \\fn IPAIPC::sendSync()\n+ * \\brief Send a message over IPC synchronously\n+ * \\param[in] cmd Command ID\n+ * \\param[in] data_in Data to send, as a byte vector\n+ * \\param[in] fds_in Fds to send, in a vector\n+ * \\param[in] data_out Byte vector in which to receive data, if applicable\n+ * \\param[in] fds_out Fds vector in which to receive fds, if applicable\n+ *\n+ * This function will not return until a response is received. The event loop\n+ * will still continue to execute, however.\n+ *\n+ * \\return Zero on success, negative error code otherwise\n+ */\n+\n+/**\n+ * \\fn IPAIPC::sendAsync()\n+ * \\brief Send a message over IPC asynchronously\n+ * \\param[in] cmd Command ID\n+ * \\param[in] data_in Data to send, as a byte vector\n+ * \\param[in] fds_in Fds to send, in a vector\n+ *\n+ * This function will return immediately after sending the message.\n+ *\n+ * \\return Zero on success, negative error code otherwise\n+ */\n+\n+/**\n+ * \\var IPAIPC::recvIPC\n+ * \\brief Signal to be emitted when data is received over IPC\n+ *\n+ * When data is received over IPC, this signal shall be emitted. Users must\n+ * connect to this to receive new data.\n+ *\n+ * The parameters of the signal are a vector of bytes and a vector of file\n+ * descriptors.\n+ */\n+\n+/**\n+ * \\var IPAIPC::valid_\n+ * \\brief Flag to indicate if the IPAIPC instance is valid\n+ *\n+ * An IPAIPC instance is valid if the IPA interface is successfully created in\n+ * isolation, and IPC is successfully set up.\n+ *\n+ * This flag can be read via IPAIPC::isValid().\n+ *\n+ * Implementations of the IPAIPC class should set this flag upon successful\n+ * construction.\n+ */\n+\n+} /* namespace libcamera */\ndiff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\nindex 190d7490..e0a2ab47 100644\n--- a/src/libcamera/meson.build\n+++ b/src/libcamera/meson.build\n@@ -25,6 +25,7 @@ libcamera_sources = files([\n     'ipa_context_wrapper.cpp',\n     'ipa_controls.cpp',\n     'ipa_data_serializer.cpp',\n+    'ipa_ipc.cpp',\n     'ipa_interface.cpp',\n     'ipa_manager.cpp',\n     'ipa_module.cpp',\n",
    "prefixes": [
        "libcamera-devel",
        "v3",
        "11/38"
    ]
}