Show a patch.

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

{
    "id": 1875,
    "url": "https://patchwork.libcamera.org/api/patches/1875/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/1875/",
    "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": "<20190828011710.32128-11-niklas.soderlund@ragnatech.se>",
    "date": "2019-08-28T01:17:07",
    "name": "[libcamera-devel,10/13] libcamera: ipa: Extend to support IPA interactions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9ee0220fa486f62b8b0b9878144fcad871545f7f",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/1875/mbox/",
    "series": [
        {
            "id": 470,
            "url": "https://patchwork.libcamera.org/api/series/470/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=470",
            "date": "2019-08-28T01:16:57",
            "name": "libcamera: ipa: Add basic IPA support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/470/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/1875/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/1875/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09B7E60C42\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 28 Aug 2019 03:17:50 +0200 (CEST)",
            "from bismarck.berto.se (unknown [95.195.154.80])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 9d08ec28-c931-11e9-bdc3-005056917a89;\n\tWed, 28 Aug 2019 03:17:34 +0200 (CEST)"
        ],
        "X-Halon-ID": "9d08ec28-c931-11e9-bdc3-005056917a89",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 28 Aug 2019 03:17:07 +0200",
        "Message-Id": "<20190828011710.32128-11-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.22.1",
        "In-Reply-To": "<20190828011710.32128-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190828011710.32128-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 10/13] libcamera: ipa: Extend to support\n\tIPA interactions",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Wed, 28 Aug 2019 01:17:51 -0000"
    },
    "content": "The IPA interface needs to support interactions with the pipeline, add\ninterfaces to control the sensor and handling of request ISP parameters\nand statistics.\n\nThe interface needs to be extended further to support attaching the\nresult of the statistic analyses to the request before the request\ncompletes to the user. It also needs to modified to allow proper per\nframe control of capture parameters.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/ipa/ipa_interface.h   | 17 +++++-\n src/ipa/ipa_dummy.cpp                   | 11 ++--\n src/ipa/ipa_dummy_isolate.cpp           | 11 ++--\n src/libcamera/ipa_interface.cpp         | 72 ++++++++++++++++++++++++-\n src/libcamera/proxy/ipa_proxy_linux.cpp | 12 ++---\n 5 files changed, 98 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h\nindex 2c5eb1fd524311cb..38e16ff37214f7b9 100644\n--- a/include/libcamera/ipa/ipa_interface.h\n+++ b/include/libcamera/ipa/ipa_interface.h\n@@ -7,14 +7,29 @@\n #ifndef __LIBCAMERA_IPA_INTERFACE_H__\n #define __LIBCAMERA_IPA_INTERFACE_H__\n \n+#include <libcamera/controls.h>\n+#include <libcamera/signal.h>\n+\n+#include \"v4l2_controls.h\"\n+\n namespace libcamera {\n \n+class Buffer;\n+class Request;\n+\n class IPAInterface\n {\n public:\n \tvirtual ~IPAInterface() {}\n \n-\tvirtual int init() = 0;\n+\tvirtual int initSensor(const V4L2ControlInfoMap &controls) = 0;\n+\tvirtual void processRequest(const void *cookie,\n+\t\t\t\t    const ControlList &controls,\n+\t\t\t\t    Buffer &parameters) = 0;\n+\tvirtual void updateStatistics(const void *cookie, Buffer &statistics) = 0;\n+\n+\tSignal<V4L2ControlList> updateSensor;\n+\tSignal<const void *> queueRequest;\n };\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/ipa_dummy.cpp b/src/ipa/ipa_dummy.cpp\nindex b0e944a17fc5cffb..11dcc54ce4ebc6f4 100644\n--- a/src/ipa/ipa_dummy.cpp\n+++ b/src/ipa/ipa_dummy.cpp\n@@ -15,15 +15,12 @@ namespace libcamera {\n class IPADummy : public IPAInterface\n {\n public:\n-\tint init();\n+\tint initSensor(const V4L2ControlInfoMap &controls) { return 0; }\n+\tvoid processRequest(const void *cookie, const ControlList &controls,\n+\t\t\t    Buffer &parameters) {}\n+\tvoid updateStatistics(const void *cookie, Buffer &statistics) {}\n };\n \n-int IPADummy::init()\n-{\n-\tstd::cout << \"initializing dummy IPA!\" << std::endl;\n-\treturn 0;\n-}\n-\n /*\n  * External IPA module interface\n  */\ndiff --git a/src/ipa/ipa_dummy_isolate.cpp b/src/ipa/ipa_dummy_isolate.cpp\nindex 24434e85d31809e2..4d49c0e372466af6 100644\n--- a/src/ipa/ipa_dummy_isolate.cpp\n+++ b/src/ipa/ipa_dummy_isolate.cpp\n@@ -16,15 +16,12 @@ namespace libcamera {\n class IPADummyIsolate : public IPAInterface\n {\n public:\n-\tint init();\n+\tint initSensor(const V4L2ControlInfoMap &controls) { return 0; }\n+\tvoid processRequest(const void *cookie, const ControlList &controls,\n+\t\t\t    Buffer &parameters) {}\n+\tvoid updateStatistics(const void *cookie, Buffer &statistics) {}\n };\n \n-int IPADummyIsolate::init()\n-{\n-\tstd::cout << \"initializing isolated dummy IPA!\" << std::endl;\n-\treturn 0;\n-}\n-\n /*\n  * External IPA module interface\n  */\ndiff --git a/src/libcamera/ipa_interface.cpp b/src/libcamera/ipa_interface.cpp\nindex 9d30da29228fabb7..4edcebbe84d5a0d0 100644\n--- a/src/libcamera/ipa_interface.cpp\n+++ b/src/libcamera/ipa_interface.cpp\n@@ -20,8 +20,76 @@ namespace libcamera {\n  */\n \n /**\n- * \\fn IPAInterface::init()\n- * \\brief Initialise the IPAInterface\n+ * \\fn IPAInterface::initSensor()\n+ * \\brief Initialize the IPA sensor settings\n+ * \\param[in] controls List of controls provided by the sensor\n+ *\n+ * This function is called when a pipeline attaches to an IPA to inform the IPA\n+ * of the controls and limits the sensor in the video pipeline supports. The IPA\n+ * have the option to set controls of the sensor by emitting the updateSensor\n+ * signal.\n+ *\n+ * \\return 0 on success or a negative error code otherwise\n+ */\n+\n+/**\n+ * \\fn IPAInterface::processRequest()\n+ * \\brief Provide IPA with a parameter buffer to fill\n+ * \\param[in] cookie Cookie for the request\n+ * \\param[in] controls List of controls associated with the request\n+ * \\param[in,out] parameters Buffer containing an empty parameters buffer\n+ *\n+ * This function is called by a pipeline handler when it has a request to\n+ * process. The IPA shall fill in the \\a parameters buffer to achieve the\n+ * capture result described in \\a controls. The \\a cookie value identifiers\n+ * the request the controls and parameters buffer corresponds to and can be\n+ * matched in updateStatistics() once the request have been processed by the\n+ * hardware. The cookie value is only valid from that processRequest() is\n+ * called and until updateStatistics() return.\n+ *\n+ * When the \\a parameters buffer is filled in and ready to be queued to hardware\n+ * the IPA shall signal pipeline handler using the queueRequest signal with the\n+ * cookie value corresponding to the request the parameters belong to.\n+ */\n+\n+/**\n+ * \\fn IPAInterface::updateStatistics()\n+ * \\brief Provide IPA with statistic buffer to examine\n+ * \\param[in] cookie Cookie for the request\n+ * \\param[in] statistics Buffer containing a filled in statistic buffer\n+ *\n+ * This function is called once a statistic buffer is completed and have been\n+ * dequeue. The IPA may inspect the buffer and update its internal view of the\n+ * capture conditions. The \\a cookie value can be used to associate the dequeued\n+ * statistics buffer with the parameters buffer filled in by the IPA in\n+ * processRequest().\n+ *\n+ * \\todo Extend this function to return or signal the result of the statistic\n+ * examination by the IPA.\n+ */\n+\n+/**\n+ * \\var IPAInterface::updateSensor\n+ * \\brief Signal emitted when the IPA wish to update sensor V4L2 controls\n+ *\n+ * This signal is emitted when the IPA wish to update one or more V4L2 control\n+ * of the sensor in the video pipeline. The list of controls to modify is passed\n+ * as a parameter.\n+ *\n+ * \\todo Extend this function to work with per-frame control setting of\n+ * controls.\n+ */\n+\n+/**\n+ * \\var IPAInterface::queueRequest\n+ * \\brief Signal emitted when the IPA is done preparing a request\n+ *\n+ * This signal is emitted then the IPA have finished filling in the parameters\n+ * buffer and is ready for the request to be committed to hardware for capture.\n+ * The request cookie is passed as a parameter.\n+ *\n+ * \\todo Extend this function to work with per-frame control setting of\n+ * controls.\n  */\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/proxy/ipa_proxy_linux.cpp b/src/libcamera/proxy/ipa_proxy_linux.cpp\nindex f881aab5b2e1178a..bb7aeedf12779c66 100644\n--- a/src/libcamera/proxy/ipa_proxy_linux.cpp\n+++ b/src/libcamera/proxy/ipa_proxy_linux.cpp\n@@ -26,7 +26,10 @@ public:\n \tIPAProxyLinux(IPAModule *ipam);\n \t~IPAProxyLinux();\n \n-\tint init();\n+\tint initSensor(const V4L2ControlInfoMap &controls) { return 0; }\n+\tvoid processRequest(const void *cookie, const ControlList &controls,\n+\t\t\t    Buffer &parameters) {}\n+\tvoid updateStatistics(const void *cookie, Buffer &statistics) {}\n \n private:\n \tvoid readyRead(IPCUnixSocket *ipc);\n@@ -36,13 +39,6 @@ private:\n \tIPCUnixSocket *socket_;\n };\n \n-int IPAProxyLinux::init()\n-{\n-\tLOG(IPAProxy, Debug) << \"initializing IPA via dummy proxy!\";\n-\n-\treturn 0;\n-}\n-\n IPAProxyLinux::IPAProxyLinux(IPAModule *ipam)\n {\n \tLOG(IPAProxy, Debug)\n",
    "prefixes": [
        "libcamera-devel",
        "10/13"
    ]
}