Patch Detail
Show a patch.
GET /api/1.1/patches/10582/?format=api
{ "id": 10582, "url": "https://patchwork.libcamera.org/api/1.1/patches/10582/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10582/", "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": "<20201205103106.242080-20-paul.elder@ideasonboard.com>", "date": "2020-12-05T10:31:02", "name": "[libcamera-devel,v5,19/23] libcamera: pipeline, ipa: rkisp1: Support the new IPC mechanism", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "658f4649f079479fcbfd65a44ce2a26ae9963c0c", "submitter": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api", "name": "Paul Elder", "email": "paul.elder@ideasonboard.com" }, "delegate": { "id": 17, "url": "https://patchwork.libcamera.org/api/1.1/users/17/?format=api", "username": "epaul", "first_name": "Paul", "last_name": "Elder", "email": "paul.elder@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/10582/mbox/", "series": [ { "id": 1506, "url": "https://patchwork.libcamera.org/api/1.1/series/1506/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1506", "date": "2020-12-05T10:30:43", "name": "IPA isolation implementation", "version": 5, "mbox": "https://patchwork.libcamera.org/series/1506/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10582/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10582/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 C124EBDB20\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 5 Dec 2020 10:32:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8D7F2635F7;\n\tSat, 5 Dec 2020 11:32:00 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A612635F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 5 Dec 2020 11:31:59 +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 C3DA82A4;\n\tSat, 5 Dec 2020 11:31:57 +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=\"t4BvuejZ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1607164318;\n\tbh=FCh5WyC671ziL+Ng4eCTqejexqv8wG9GgPUICNjA/So=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=t4BvuejZdS6n69JeKbGJRdODpjSu2SCH/T47c0nqr617U5IFLksqorBd8Ljf3dCFL\n\tfsXEJsXrBEtnB6TLvEr/pLR6fmCXAvravx5mhPfSD8UwjEGB02s9RYKfd6Hxorj1+k\n\tSzTuEtf/yGb+D78cpb2jNLrz1wTU5XzfYY3pfUPk=", "From": "Paul Elder <paul.elder@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sat, 5 Dec 2020 19:31:02 +0900", "Message-Id": "<20201205103106.242080-20-paul.elder@ideasonboard.com>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20201205103106.242080-1-paul.elder@ideasonboard.com>", "References": "<20201205103106.242080-1-paul.elder@ideasonboard.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v5 19/23] 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 v5:\n- import the generated header with the new file name\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 816cf4ab..b5b8b0f2 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 10301a19..c88f1271 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 \"libcamera/internal/log.h\"\n@@ -28,7 +29,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@@ -39,13 +40,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@@ -78,10 +77,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@@ -157,12 +154,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@@ -171,17 +168,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@@ -201,8 +198,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@@ -254,13 +251,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@@ -272,9 +269,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@@ -291,9 +288,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 6e74a49a..328161b2 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/rkisp1_ipa_proxy.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@@ -918,12 +922,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@@ -965,11 +967,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@@ -1191,10 +1194,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", "v5", "19/23" ] }