Show a patch.

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

{
    "id": 10376,
    "url": "https://patchwork.libcamera.org/api/patches/10376/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10376/",
    "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": "<20201106103707.49660-29-paul.elder@ideasonboard.com>",
    "date": "2020-11-06T10:36:58",
    "name": "[libcamera-devel,v4,28/37] libcamera: pipeline, ipa: rkisp1: Support the new IPC mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "37c2c4469ad0e910003f89998ae8c8ac0bb51d7e",
    "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/10376/mbox/",
    "series": [
        {
            "id": 1448,
            "url": "https://patchwork.libcamera.org/api/series/1448/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1448",
            "date": "2020-11-06T10:36:30",
            "name": "IPA isolation implementation",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1448/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10376/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10376/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 C34EBBDB89\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Nov 2020 10:38:22 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9420162D40;\n\tFri,  6 Nov 2020 11:38:22 +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 132D462D3E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Nov 2020 11:38: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 96F28A19;\n\tFri,  6 Nov 2020 11:38:19 +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=\"qrXlSDbd\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1604659100;\n\tbh=qXaYGwpBVNv4JDGqcMiM+bDWvem7i2zLG0ykcp3UttI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=qrXlSDbd4Hvn32o3Omr2/NmYi6elDTO/OBnPs7ytYN1m4/DjBHo4Fmnm4VMFvf1Fx\n\tLR2d9piwr0LSslwGWfqAQFlKdTXI3w21mafNzmD90vNbF684ttecXZeXeIc95O/zYc\n\tXmM0fQ1XxbnZN//BOLEpnNNSVlnO4QoGxlYiQ6ZE=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  6 Nov 2020 19:36:58 +0900",
        "Message-Id": "<20201106103707.49660-29-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201106103707.49660-1-paul.elder@ideasonboard.com>",
        "References": "<20201106103707.49660-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 28/37] libcamera: pipeline,\n\tipa: rkisp1: Support the new IPC mechanism",
        "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": "Add support to the rkisp1 pipeline handler and IPA for the new IPC\nmechanism.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nChanges in v4:\n- rename Controls to controls\n- rename IPARkISP1CallbackInterface to IPARkISP1EventInterface\n- rename libcamera_generated_headers to libcamera_generated_ipa_headers\n  in meson\n- use the new header name, rkisp1_ipa_interface.h\n\nChanges in v3:\n- change namespacing of base ControlInfoMap structure\n\nNew in v2\n---\n include/libcamera/ipa/meson.build        |  1 +\n include/libcamera/ipa/rkisp1.h           | 18 ++++----\n include/libcamera/ipa/rkisp1.mojom       | 42 +++++++++++++++++++\n src/ipa/rkisp1/meson.build               |  2 +-\n src/ipa/rkisp1/rkisp1.cpp                | 53 +++++++++++-------------\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 44 +++++++++++---------\n 6 files changed, 104 insertions(+), 56 deletions(-)\n create mode 100644 include/libcamera/ipa/rkisp1.mojom",
    "diff": "diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\nindex 70f5dfc8..84a7f63d 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -26,6 +26,7 @@ ipa_mojom_core = custom_target(core_mojom_file.split('.')[0] + '_mojom_module',\n \n ipa_mojom_files = [\n     'raspberrypi.mojom',\n+    'rkisp1.mojom',\n     'vimc.mojom',\n ]\n \ndiff --git a/include/libcamera/ipa/rkisp1.h b/include/libcamera/ipa/rkisp1.h\nindex bb824f29..35f97ee4 100644\n--- a/include/libcamera/ipa/rkisp1.h\n+++ b/include/libcamera/ipa/rkisp1.h\n@@ -7,15 +7,19 @@\n #ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\n #define __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\n \n+#include <libcamera/controls.h>\n+\n #ifndef __DOXYGEN__\n \n-enum RkISP1Operations {\n-\tRKISP1_IPA_ACTION_V4L2_SET = 1,\n-\tRKISP1_IPA_ACTION_PARAM_FILLED = 2,\n-\tRKISP1_IPA_ACTION_METADATA = 3,\n-\tRKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER = 4,\n-\tRKISP1_IPA_EVENT_QUEUE_REQUEST = 5,\n-};\n+namespace libcamera {\n+\n+namespace RkISP1 {\n+\n+static ControlInfoMap controls;\n+\n+} /* namespace RkISP1 */\n+\n+} /* namespace libcamera */\n \n #endif /* __DOXYGEN__ */\n \ndiff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nnew file mode 100644\nindex 00000000..7f1a4ddd\n--- /dev/null\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -0,0 +1,42 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+\n+import \"include/libcamera/ipa/core.mojom\";\n+\n+interface IPARkISP1Interface {\n+\tinit(IPASettings settings) => (int32 ret);\n+\tstart() => (int32 ret);\n+\tstop();\n+\n+\tconfigure(CameraSensorInfo sensorInfo,\n+\t\t  map<uint32, IPAStream> streamConfig,\n+\t\t  map<uint32, ControlInfoMap> entityControls) => ();\n+\n+\tmapBuffers(array<IPABuffer> buffers);\n+\tunmapBuffers(array<uint32> ids);\n+\n+\t[async] processEvent(RkISP1Event ev);\n+};\n+\n+interface IPARkISP1EventInterface {\n+\tqueueFrameAction(uint32 frame, RkISP1Action action);\n+};\n+\n+enum RkISP1Operations {\n+\tRKISP1_IPA_ACTION_V4L2_SET = 1,\n+\tRKISP1_IPA_ACTION_PARAM_FILLED = 2,\n+\tRKISP1_IPA_ACTION_METADATA = 3,\n+\tRKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER = 4,\n+\tRKISP1_IPA_EVENT_QUEUE_REQUEST = 5,\n+};\n+\n+struct RkISP1Event {\n+\tRkISP1Operations op;\n+\tuint32 frame;\n+\tuint32 bufferId;\n+\tControlList controls;\n+};\n+\n+struct RkISP1Action {\n+\tRkISP1Operations op;\n+\tControlList controls;\n+};\ndiff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build\nindex ed9a6b6b..3061d53c 100644\n--- a/src/ipa/rkisp1/meson.build\n+++ b/src/ipa/rkisp1/meson.build\n@@ -3,7 +3,7 @@\n ipa_name = 'ipa_rkisp1'\n \n mod = shared_module(ipa_name,\n-                    'rkisp1.cpp',\n+                    ['rkisp1.cpp', libcamera_generated_ipa_headers],\n                     name_prefix : '',\n                     include_directories : [ipa_includes, libipa_includes],\n                     dependencies : libcamera_dep,\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 07d7f1b2..7bb261c6 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -20,6 +20,7 @@\n #include <libcamera/ipa/ipa_interface.h>\n #include <libcamera/ipa/ipa_module_info.h>\n #include <libcamera/ipa/rkisp1.h>\n+#include <libcamera/ipa/rkisp1_ipa_interface.h>\n #include <libcamera/request.h>\n \n #include <libipa/ipa_interface_wrapper.h>\n@@ -30,7 +31,7 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(IPARkISP1)\n \n-class IPARkISP1 : public IPAInterface\n+class IPARkISP1 : public IPARkISP1Interface\n {\n public:\n \tint init([[maybe_unused]] const IPASettings &settings) override\n@@ -41,13 +42,11 @@ public:\n \tvoid stop() override {}\n \n \tvoid configure(const CameraSensorInfo &info,\n-\t\t       const std::map<unsigned int, IPAStream> &streamConfig,\n-\t\t       const std::map<unsigned int, const ControlInfoMap &> &entityControls,\n-\t\t       const IPAOperationData &ipaConfig,\n-\t\t       IPAOperationData *response) override;\n+\t\t       const std::map<uint32_t, IPAStream> &streamConfig,\n+\t\t       const std::map<uint32_t, ControlInfoMap> &entityControls) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n-\tvoid processEvent(const IPAOperationData &event) override;\n+\tvoid processEvent(const RkISP1Event &event) override;\n \n private:\n \tvoid queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n@@ -80,10 +79,8 @@ private:\n  * before accessing them.\n  */\n void IPARkISP1::configure([[maybe_unused]] const CameraSensorInfo &info,\n-\t\t\t  [[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,\n-\t\t\t  const std::map<unsigned int, const ControlInfoMap &> &entityControls,\n-\t\t\t  [[maybe_unused]] const IPAOperationData &ipaConfig,\n-\t\t\t  [[maybe_unused]] IPAOperationData *result)\n+\t\t\t  [[maybe_unused]] const std::map<uint32_t, IPAStream> &streamConfig,\n+\t\t\t  const std::map<uint32_t, ControlInfoMap> &entityControls)\n {\n \tif (entityControls.empty())\n \t\treturn;\n@@ -159,12 +156,12 @@ void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids)\n \t}\n }\n \n-void IPARkISP1::processEvent(const IPAOperationData &event)\n+void IPARkISP1::processEvent(const RkISP1Event &event)\n {\n-\tswitch (event.operation) {\n+\tswitch (event.op_) {\n \tcase RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER: {\n-\t\tunsigned int frame = event.data[0];\n-\t\tunsigned int bufferId = event.data[1];\n+\t\tunsigned int frame = event.frame_;\n+\t\tunsigned int bufferId = event.bufferId_;\n \n \t\tconst rkisp1_stat_buffer *stats =\n \t\t\tstatic_cast<rkisp1_stat_buffer *>(buffersMemory_[bufferId]);\n@@ -173,17 +170,17 @@ void IPARkISP1::processEvent(const IPAOperationData &event)\n \t\tbreak;\n \t}\n \tcase RKISP1_IPA_EVENT_QUEUE_REQUEST: {\n-\t\tunsigned int frame = event.data[0];\n-\t\tunsigned int bufferId = event.data[1];\n+\t\tunsigned int frame = event.frame_;\n+\t\tunsigned int bufferId = event.bufferId_;\n \n \t\trkisp1_params_cfg *params =\n \t\t\tstatic_cast<rkisp1_params_cfg *>(buffersMemory_[bufferId]);\n \n-\t\tqueueRequest(frame, params, event.controls[0]);\n+\t\tqueueRequest(frame, params, event.controls_);\n \t\tbreak;\n \t}\n \tdefault:\n-\t\tLOG(IPARkISP1, Error) << \"Unknown event \" << event.operation;\n+\t\tLOG(IPARkISP1, Error) << \"Unknown event \" << event.op_;\n \t\tbreak;\n \t}\n }\n@@ -203,8 +200,8 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n \t\tparams->module_en_update = RKISP1_CIF_ISP_MODULE_AEC;\n \t}\n \n-\tIPAOperationData op;\n-\top.operation = RKISP1_IPA_ACTION_PARAM_FILLED;\n+\tRkISP1Action op;\n+\top.op_ = RKISP1_IPA_ACTION_PARAM_FILLED;\n \n \tqueueFrameAction.emit(frame, op);\n }\n@@ -256,13 +253,13 @@ void IPARkISP1::updateStatistics(unsigned int frame,\n \n void IPARkISP1::setControls(unsigned int frame)\n {\n-\tIPAOperationData op;\n-\top.operation = RKISP1_IPA_ACTION_V4L2_SET;\n+\tRkISP1Action op;\n+\top.op_ = RKISP1_IPA_ACTION_V4L2_SET;\n \n \tControlList ctrls(ctrls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));\n \tctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));\n-\top.controls.push_back(ctrls);\n+\top.controls_ = ctrls;\n \n \tqueueFrameAction.emit(frame, op);\n }\n@@ -274,9 +271,9 @@ void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState)\n \tif (aeState)\n \t\tctrls.set(controls::AeLocked, aeState == 2);\n \n-\tIPAOperationData op;\n-\top.operation = RKISP1_IPA_ACTION_METADATA;\n-\top.controls.push_back(ctrls);\n+\tRkISP1Action op;\n+\top.op_ = RKISP1_IPA_ACTION_METADATA;\n+\top.controls_ = ctrls;\n \n \tqueueFrameAction.emit(frame, op);\n }\n@@ -293,9 +290,9 @@ const struct IPAModuleInfo ipaModuleInfo = {\n \t\"rkisp1\",\n };\n \n-struct ipa_context *ipaCreate()\n+IPAInterface *ipaCreate()\n {\n-\treturn new IPAInterfaceWrapper(std::make_unique<IPARkISP1>());\n+\treturn new IPARkISP1();\n }\n }\n \ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex c74a2e9b..0bf31918 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -19,6 +19,8 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/formats.h>\n #include <libcamera/ipa/rkisp1.h>\n+#include <libcamera/ipa/rkisp1_ipa_interface.h>\n+#include <libcamera/ipa/ipa_proxy_rkisp1.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -144,9 +146,11 @@ public:\n \tRkISP1MainPath *mainPath_;\n \tRkISP1SelfPath *selfPath_;\n \n+\tstd::unique_ptr<IPAProxyRkISP1> ipa_;\n+\n private:\n \tvoid queueFrameAction(unsigned int frame,\n-\t\t\t      const IPAOperationData &action);\n+\t\t\t      const RkISP1Action &action);\n \n \tvoid metadataReady(unsigned int frame, const ControlList &metadata);\n };\n@@ -412,7 +416,7 @@ private:\n \n int RkISP1CameraData::loadIPA()\n {\n-\tipa_ = IPAManager::createIPA(pipe_, 1, 1);\n+\tipa_ = IPAManager::createIPA<IPAProxyRkISP1>(pipe_, 1, 1);\n \tif (!ipa_)\n \t\treturn -ENOENT;\n \n@@ -425,11 +429,11 @@ int RkISP1CameraData::loadIPA()\n }\n \n void RkISP1CameraData::queueFrameAction(unsigned int frame,\n-\t\t\t\t\tconst IPAOperationData &action)\n+\t\t\t\t\tconst RkISP1Action &action)\n {\n-\tswitch (action.operation) {\n+\tswitch (action.op_) {\n \tcase RKISP1_IPA_ACTION_V4L2_SET: {\n-\t\tconst ControlList &controls = action.controls[0];\n+\t\tconst ControlList &controls = action.controls_;\n \t\ttimeline_.scheduleAction(std::make_unique<RkISP1ActionSetSensor>(frame,\n \t\t\t\t\t\t\t\t\t\t sensor_,\n \t\t\t\t\t\t\t\t\t\t controls));\n@@ -442,10 +446,10 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n \t\tbreak;\n \t}\n \tcase RKISP1_IPA_ACTION_METADATA:\n-\t\tmetadataReady(frame, action.controls[0]);\n+\t\tmetadataReady(frame, action.controls_);\n \t\tbreak;\n \tdefault:\n-\t\tLOG(RkISP1, Error) << \"Unknown action \" << action.operation;\n+\t\tLOG(RkISP1, Error) << \"Unknown action \" << action.op_;\n \t\tbreak;\n \t}\n }\n@@ -908,12 +912,10 @@ int PipelineHandlerRkISP1::start(Camera *camera)\n \t\tret = 0;\n \t}\n \n-\tstd::map<unsigned int, const ControlInfoMap &> entityControls;\n+\tstd::map<uint32_t, ControlInfoMap> entityControls;\n \tentityControls.emplace(0, data->sensor_->controls());\n \n-\tIPAOperationData ipaConfig;\n-\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls,\n-\t\t\t      ipaConfig, nullptr);\n+\tdata->ipa_->configure(sensorInfo, streamConfig, entityControls);\n \n \treturn ret;\n }\n@@ -955,11 +957,12 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n \tif (!info)\n \t\treturn -ENOENT;\n \n-\tIPAOperationData op;\n-\top.operation = RKISP1_IPA_EVENT_QUEUE_REQUEST;\n-\top.data = { data->frame_, info->paramBuffer->cookie() };\n-\top.controls = { request->controls() };\n-\tdata->ipa_->processEvent(op);\n+\tRkISP1Event ev;\n+\tev.op_ = RKISP1_IPA_EVENT_QUEUE_REQUEST;\n+\tev.frame_ = data->frame_;\n+\tev.bufferId_ = info->paramBuffer->cookie();\n+\tev.controls_ = request->controls();\n+\tdata->ipa_->processEvent(ev);\n \n \tdata->timeline_.scheduleAction(std::make_unique<RkISP1ActionQueueBuffers>(data->frame_,\n \t\t\t\t\t\t\t\t\t\t  data,\n@@ -1181,10 +1184,11 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n \tif (data->frame_ <= buffer->metadata().sequence)\n \t\tdata->frame_ = buffer->metadata().sequence + 1;\n \n-\tIPAOperationData op;\n-\top.operation = RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER;\n-\top.data = { info->frame, info->statBuffer->cookie() };\n-\tdata->ipa_->processEvent(op);\n+\tRkISP1Event ev;\n+\tev.op_ = RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER;\n+\tev.frame_ = info->frame;\n+\tev.bufferId_ = info->statBuffer->cookie();\n+\tdata->ipa_->processEvent(ev);\n }\n \n REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "28/37"
    ]
}