Show a patch.

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

{
    "id": 9734,
    "url": "https://patchwork.libcamera.org/api/patches/9734/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/9734/",
    "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": "<20200922133537.258098-31-paul.elder@ideasonboard.com>",
    "date": "2020-09-22T13:35:29",
    "name": "[libcamera-devel,30/38] libcamera: pipeline, ipa: rkisp1: Support the new IPC mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "5e31f8376399b0015e38b4da6d14a535de08af9d",
    "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/9734/mbox/",
    "series": [
        {
            "id": 1309,
            "url": "https://patchwork.libcamera.org/api/series/1309/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1309",
            "date": "2020-09-22T13:34:59",
            "name": "IPA isolation implementation",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1309/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/9734/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/9734/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 E2C8FBF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Sep 2020 13:39:25 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B079D62FF4;\n\tTue, 22 Sep 2020 15:39:25 +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 EA00F62FD6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 15:39:24 +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 40A2C2D7;\n\tTue, 22 Sep 2020 15:39:17 +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=\"jnJ7Aqjd\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1600781959;\n\tbh=VNBl61Tr82atc4OeIMNMd9N/cwrJtYDfEcGcU8F7A3g=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=jnJ7AqjdSJn/7QFv2Cn8lQfVc+02FcreF/RdhQNtlFCqFSfXiHnehFu72Pqi1BnWO\n\tIaW3/pptRkI6Rw93Xr1NyrLpAZU+3KP2baFF0ZPYRU0R21uS5FHj6hpEFcCRd1BzUY\n\t1mFamU5snFaJTFLoDJ8cEBXd3872cccaNbvpN+e8=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 22 Sep 2020 22:35:29 +0900",
        "Message-Id": "<20200922133537.258098-31-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20200922133537.258098-1-paul.elder@ideasonboard.com>",
        "References": "<20200922133537.258098-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 30/38] 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---\nNew in v2\n---\n include/libcamera/ipa/meson.build        |  1 +\n include/libcamera/ipa/rkisp1.h           | 14 +++----\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, 100 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 cececee5..b6e725d0 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -25,6 +25,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 4fe0482b..4742654e 100644\n--- a/include/libcamera/ipa/rkisp1.h\n+++ b/include/libcamera/ipa/rkisp1.h\n@@ -7,12 +7,12 @@\n #ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\n #define __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\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+#include <libcamera/controls.h>\n+\n+namespace libcamera {\n+\n+static ControlInfoMap RkISP1Controls;\n+\n+} /* namespace libcamera */\n \n #endif /* __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ */\ndiff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nnew file mode 100644\nindex 00000000..df76ee6f\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 IPARkISP1CallbackInterface {\n+\tqueueFrameAction(uint32 frame, RkISP1Action action);\n+};\n+\n+enum RkISP1Operations {\n+\tRKISP1_IPA_ACTION_V4L2_SET,\n+\tRKISP1_IPA_ACTION_PARAM_FILLED,\n+\tRKISP1_IPA_ACTION_METADATA,\n+\tRKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER,\n+\tRKISP1_IPA_EVENT_QUEUE_REQUEST,\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..30953c13 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_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 d95d902a..9d873740 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -19,6 +19,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_generated.h>\n #include <libcamera/request.h>\n \n #include <libipa/ipa_interface_wrapper.h>\n@@ -29,7 +30,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@@ -40,13 +41,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_isp_params_cfg *params,\n@@ -79,10 +78,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@@ -158,12 +155,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@@ -172,17 +169,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_isp_params_cfg *params =\n \t\t\tstatic_cast<rkisp1_isp_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@@ -202,8 +199,8 @@ void IPARkISP1::queueRequest(unsigned int frame, rkisp1_isp_params_cfg *params,\n \t\tparams->module_en_update = CIFISP_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@@ -255,13 +252,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@@ -273,9 +270,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@@ -292,9 +289,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 a6fc3b8e..6df41ff5 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -18,6 +18,8 @@\n #include <libcamera/control_ids.h>\n #include <libcamera/formats.h>\n #include <libcamera/ipa/rkisp1.h>\n+#include <libcamera/ipa/rkisp1_generated.h>\n+#include <libcamera/ipa/ipa_proxy_rkisp1.h>\n #include <libcamera/request.h>\n #include <libcamera/stream.h>\n \n@@ -137,9 +139,11 @@ public:\n \n \tV4L2VideoDevice *video_;\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@@ -398,7 +402,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@@ -411,11 +415,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@@ -428,10 +432,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@@ -852,12 +856,10 @@ int PipelineHandlerRkISP1::start(Camera *camera)\n \t\t.size = data->stream_.configuration().size,\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@@ -903,11 +905,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@@ -1111,10 +1114,11 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n \tif (!info)\n \t\treturn;\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",
        "30/38"
    ]
}