Patch Detail
Show a patch.
GET /api/1.1/patches/2041/?format=api
{ "id": 2041, "url": "https://patchwork.libcamera.org/api/1.1/patches/2041/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2041/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>", "date": "2019-09-28T04:17:34", "name": "[libcamera-devel] ipa: Allow short-circuiting the ipa_operations", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "99b4e7b1f2e1b76225cc1994426b5733fc75f842", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": { "id": 14, "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api", "username": "pinchartl", "first_name": "Laurent", "last_name": "Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/2041/mbox/", "series": [ { "id": 510, "url": "https://patchwork.libcamera.org/api/1.1/series/510/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=510", "date": "2019-09-28T04:17:34", "name": "[libcamera-devel] ipa: Allow short-circuiting the ipa_operations", "version": 1, "mbox": "https://patchwork.libcamera.org/series/510/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2041/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2041/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 D0A5460BE8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 06:17:48 +0200 (CEST)", "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 338C4593\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 28 Sep 2019 06:17:48 +0200 (CEST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1569644268;\n\tbh=sZSXY2zUgsJ4kyYi113DXGpu68TAg9ARRXbSmO4mgFw=;\n\th=From:To:Subject:Date:From;\n\tb=tgCz+mAict021QF0sVnpvcp1eTXQXBOoyx8oP8DDDtPul4RZF4rIjgPjBConMIw0a\n\tto+VGEfveBVUcK65dBBnoRRDD3QhYJKOcPmVzp7ZSuI6EYNua0+iXr93MqiJbTCW4i\n\tkW1rgqwFPWota4KEdqeHnv3PSjgbRCI8ObJNzoWY=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 28 Sep 2019 07:17:34 +0300", "Message-Id": "<20190928041734.20045-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.21.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] ipa: Allow short-circuiting the\n\tipa_operations", "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": "Sat, 28 Sep 2019 04:17:49 -0000" }, "content": "When an IPA module is loaded without isolation and implements the\nIPAInterface internally, going through ipa_operations is a waste of\ntime. Add an operation to retrieve the IPAInterface, and use it directly\nin the IPAContextWrapper.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/ipa/ipa_interface.h | 1 +\n src/ipa/libipa/ipa_interface_wrapper.cpp | 8 ++++++++\n src/ipa/libipa/ipa_interface_wrapper.h | 1 +\n src/libcamera/include/ipa_context_wrapper.h | 1 +\n src/libcamera/ipa_context_wrapper.cpp | 8 +++++++-\n src/libcamera/ipa_interface.cpp | 15 +++++++++++++++\n 6 files changed, 33 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h\nindex a0dfce96fd1c..7c7771b97e30 100644\n--- a/include/ipa/ipa_interface.h\n+++ b/include/ipa/ipa_interface.h\n@@ -18,6 +18,7 @@ struct ipa_context {\n struct ipa_operations {\n \tvoid (*destroy)(struct ipa_context *ctx);\n \tvoid (*init)(struct ipa_context *ctx);\n+\tvoid *(*get_interface)(struct ipa_context *ctx);\n };\n \n #ifdef __cplusplus\ndiff --git a/src/ipa/libipa/ipa_interface_wrapper.cpp b/src/ipa/libipa/ipa_interface_wrapper.cpp\nindex 0a58b5e8f7e1..a39b699ad600 100644\n--- a/src/ipa/libipa/ipa_interface_wrapper.cpp\n+++ b/src/ipa/libipa/ipa_interface_wrapper.cpp\n@@ -68,6 +68,13 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n \tctx->ipa->init();\n }\n \n+void *IPAInterfaceWrapper::get_interface(struct ipa_context *_ctx)\n+{\n+\tIPAInterfaceWrapper *ctx = static_cast<IPAInterfaceWrapper *>(_ctx);\n+\n+\treturn ctx->ipa;\n+}\n+\n #ifndef __DOXYGEN__\n /*\n * This construct confuses Doygen and makes it believe that all members of the\n@@ -76,6 +83,7 @@ void IPAInterfaceWrapper::init(struct ipa_context *_ctx)\n const struct ipa_operations IPAInterfaceWrapper::operations = {\n \t.destroy = &IPAInterfaceWrapper::destroy,\n \t.init = &IPAInterfaceWrapper::init,\n+\t.get_interface = &IPAInterfaceWrapper::get_interface,\n };\n #endif\n \ndiff --git a/src/ipa/libipa/ipa_interface_wrapper.h b/src/ipa/libipa/ipa_interface_wrapper.h\nindex 582d787d27ed..66aa387ac191 100644\n--- a/src/ipa/libipa/ipa_interface_wrapper.h\n+++ b/src/ipa/libipa/ipa_interface_wrapper.h\n@@ -19,6 +19,7 @@ public:\n private:\n \tstatic void destroy(struct ipa_context *ctx);\n \tstatic void init(struct ipa_context *ctx);\n+\tstatic void *get_interface(struct ipa_context *ctx);\n \n \tstatic const struct ipa_operations operations;\n \ndiff --git a/src/libcamera/include/ipa_context_wrapper.h b/src/libcamera/include/ipa_context_wrapper.h\nindex 879911e8a566..928781429845 100644\n--- a/src/libcamera/include/ipa_context_wrapper.h\n+++ b/src/libcamera/include/ipa_context_wrapper.h\n@@ -21,6 +21,7 @@ public:\n \n private:\n \tstruct ipa_context *ctx_;\n+\tIPAInterface *intf_;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/ipa_context_wrapper.cpp b/src/libcamera/ipa_context_wrapper.cpp\nindex bdd3857731ef..edbfea612515 100644\n--- a/src/libcamera/ipa_context_wrapper.cpp\n+++ b/src/libcamera/ipa_context_wrapper.cpp\n@@ -41,6 +41,10 @@ namespace libcamera {\n IPAContextWrapper::IPAContextWrapper(struct ipa_context *context)\n \t: ctx_(context)\n {\n+\tif (ctx_ && ctx_->ops->get_interface)\n+\t\tintf_ = reinterpret_cast<IPAInterface *>(ctx_->ops->get_interface(ctx_));\n+\telse\n+\t\tintf_ = nullptr;\n }\n \n IPAContextWrapper::~IPAContextWrapper()\n@@ -51,7 +55,9 @@ IPAContextWrapper::~IPAContextWrapper()\n \n int IPAContextWrapper::init()\n {\n-\tif (ctx_)\n+\tif (intf_)\n+\t\tintf_->init();\n+\telse if (ctx_)\n \t\tctx_->ops->init(ctx_);\n \n \treturn 0;\ndiff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\nindex e95ccecda019..38d284cea114 100644\n--- a/src/libcamera/ipa_interface.cpp\n+++ b/src/libcamera/ipa_interface.cpp\n@@ -40,6 +40,12 @@\n * handlers to communicate with IPA modules. IPA modules may use the\n * IPAInterface API internally if they want to benefit from the data and helper\n * classes offered by libcamera.\n+ *\n+ * When an IPA module is loaded directly into the libcamera process and uses\n+ * the IPAInterface API internally, short-circuiting the path to the\n+ * ipa_operations and back to IPAInterface is desirable. To support this, IPA\n+ * modules may implement the ipa_operations::get_interface function to return a\n+ * pointer to their internal IPAInterface.\n */\n \n /**\n@@ -80,6 +86,15 @@\n *\n * \\var ipa_operations::init\n * \\brief Initialise the ipa_context\n+ *\n+ * \\var ipa_operations::get_interface\n+ * \\brief Retrieve the IPAInterface implemented by the ipa_context (optional)\n+ *\n+ * IPA modules may implement this operation to expose their internal\n+ * IPAInterface, if any. When implemented, libcamera may at its sole discretion\n+ * call it and then bypass the ipa_operations API by calling the IPAInterface\n+ * methods directly. IPA modules shall still implement and support the full\n+ * ipa_operations API.\n */\n \n namespace libcamera {\n", "prefixes": [ "libcamera-devel" ] }