Patch Detail
Show a patch.
GET /api/patches/9938/?format=api
{ "id": 9938, "url": "https://patchwork.libcamera.org/api/patches/9938/?format=api", "web_url": "https://patchwork.libcamera.org/patch/9938/", "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-31-paul.elder@ideasonboard.com>", "date": "2020-10-02T14:31:46", "name": "[libcamera-devel,v3,30/38] libcamera: pipeline, ipa: rkisp1: Support the new IPC mechanism", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b3ce5207567c0d3c971afeec1173609b1973ad64", "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/9938/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/9938/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/9938/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 458A9C3B5C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 2 Oct 2020 14:33:20 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 07BFD63BEB;\n\tFri, 2 Oct 2020 16:33:20 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9D97463B98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 2 Oct 2020 16:33:18 +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 D533D528;\n\tFri, 2 Oct 2020 16:33:16 +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=\"gD32idcq\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1601649198;\n\tbh=Gqh9QvK3Bz3MWys9flkv82+i8FHoEgR802cEUCwnb7k=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gD32idcqsmpIHPXPF0/8Q57jT1QhQEKZTzoqCS8TFEznMdQJKGSQdc+hdRUG7zvDf\n\titvBPP1NBYH6E3vlnnUrLETlJ9aMI44rvlTYAtNh7fExsYE0Ll60hnErwBb/AB73VR\n\t2fG4i5DZ24yAG/RbUQG4jU1wW22D8HVEUQ5uUl7k=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 2 Oct 2020 23:31:46 +0900", "Message-Id": "<20201002143154.468162-31-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 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---\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 886908ad..32f9e321 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 4fe0482b..bbe6e95e 100644\n--- a/include/libcamera/ipa/rkisp1.h\n+++ b/include/libcamera/ipa/rkisp1.h\n@@ -7,12 +7,16 @@\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+namespace RkISP1 {\n+\n+static ControlInfoMap Controls;\n+\n+}\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 07d7f1b2..4fec397b 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_generated.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 aec590ff..74812302 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_generated.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@@ -1178,10 +1181,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", "v3", "30/38" ] }