[{"id":15141,"web_url":"https://patchwork.libcamera.org/comment/15141/","msgid":"<ca49d94f-48ac-d9b4-462b-d31ee525534e@collabora.com>","date":"2021-02-12T12:32:48","subject":"Re: [libcamera-devel] [PATCH v7 11/12] libcamera: pipeline,\n\tipa: rkisp1: Support the new IPC mechanism","submitter":{"id":46,"url":"https://patchwork.libcamera.org/api/people/46/","name":"Dafna Hirschfeld","email":"dafna.hirschfeld@collabora.com"},"content":"Hi,\n\nAm 11.02.21 um 08:18 schrieb Paul Elder:\n> Add support to the rkisp1 pipeline handler and IPA for the new IPC\n> mechanism.\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> ---\n> No change in v7\n> \n> Changes in v6:\n> - move the enum and const from the header to the mojom file\n> - remove the per-pipeline ControlInfoMap\n> - since rkisp1.h has nothing in it anymore, remove it\n> - use the namespace in the pipeline handler and IPA\n> \n> Changes in v5:\n> - import the generated header with the new file name\n> \n> Changes 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> \n> Changes in v3:\n> - change namespacing of base ControlInfoMap structure\n> \n> New in v2\n> ---\n>   include/libcamera/ipa/meson.build        |  1 +\n>   include/libcamera/ipa/rkisp1.h           | 22 -------\n>   include/libcamera/ipa/rkisp1.mojom       | 44 +++++++++++++\n>   src/ipa/rkisp1/meson.build               |  2 +-\n>   src/ipa/rkisp1/rkisp1.cpp                | 61 +++++++++---------\n>   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 79 ++++++++++++------------\n>   6 files changed, 115 insertions(+), 94 deletions(-)\n>   delete mode 100644 include/libcamera/ipa/rkisp1.h\n>   create mode 100644 include/libcamera/ipa/rkisp1.mojom\n> \n> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\n> index 67e3f049..d701bccc 100644\n> --- a/include/libcamera/ipa/meson.build\n> +++ b/include/libcamera/ipa/meson.build\n> @@ -56,6 +56,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',\n>   \n>   ipa_mojom_files = [\n>       'raspberrypi.mojom',\n> +    'rkisp1.mojom',\n>       'vimc.mojom',\n>   ]\n>   \n> diff --git a/include/libcamera/ipa/rkisp1.h b/include/libcamera/ipa/rkisp1.h\n> deleted file mode 100644\n> index bb824f29..00000000\n> --- a/include/libcamera/ipa/rkisp1.h\n> +++ /dev/null\n> @@ -1,22 +0,0 @@\n> -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> -/*\n> - * Copyright (C) 2019, Google Inc.\n> - *\n> - * rkisp1.h - Image Processing Algorithm interface for RkISP1\n> - */\n> -#ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\n> -#define __LIBCAMERA_IPA_INTERFACE_RKISP1_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> -\n> -#endif /* __DOXYGEN__ */\n> -\n> -#endif /* __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ */\n> diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\n> new file mode 100644\n> index 00000000..9270f9c7\n> --- /dev/null\n> +++ b/include/libcamera/ipa/rkisp1.mojom\n> @@ -0,0 +1,44 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +\n> +module ipa.rkisp1;\n> +\n> +import \"include/libcamera/ipa/core.mojom\";\n> +\n> +enum RkISP1Operations {\n> +\tActionV4L2Set = 1,\n> +\tActionParamFilled = 2,\n> +\tActionMetadata = 3,\n> +\tEventSignalStatBuffer = 4,\n> +\tEventQueueRequest = 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> +};\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> diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build\n> index 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,\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index f4812d8d..67bac986 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -19,7 +19,7 @@\n>   #include <libcamera/control_ids.h>\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,25 +28,22 @@ namespace libcamera {\n>   \n>   LOG_DEFINE_CATEGORY(IPARkISP1)\n>   \n> -class IPARkISP1 : public IPAInterface\n> +class IPARkISP1 : public ipa::rkisp1::IPARkISP1Interface\n>   {\n>   public:\n>   \tint init([[maybe_unused]] const IPASettings &settings) override\n>   \t{\n>   \t\treturn 0;\n>   \t}\n> -\tint start([[maybe_unused]] const IPAOperationData &data,\n> -\t\t  [[maybe_unused]] IPAOperationData *result) override { return 0; }\n> +\tint start() override { return 0; }\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 ipa::rkisp1::RkISP1Event &event) override;\n>   \n>   private:\n>   \tvoid queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n> @@ -79,10 +76,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 +153,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 ipa::rkisp1::RkISP1Event &event)\n>   {\n> -\tswitch (event.operation) {\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> +\tswitch (event.op) {\n> +\tcase ipa::rkisp1::EventSignalStatBuffer: {\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,18 +166,18 @@ void IPARkISP1::processEvent(const IPAOperationData &event)\n>   \t\tupdateStatistics(frame, stats);\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> +\tcase ipa::rkisp1::EventQueueRequest: {\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> @@ -202,8 +197,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> +\tipa::rkisp1::RkISP1Action op;\n> +\top.op = ipa::rkisp1::ActionParamFilled;\n>   \n>   \tqueueFrameAction.emit(frame, op);\n>   }\n> @@ -255,13 +250,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> +\tipa::rkisp1::RkISP1Action op;\n> +\top.op = ipa::rkisp1::ActionV4L2Set;\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 +268,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> +\tipa::rkisp1::RkISP1Action op;\n> +\top.op = ipa::rkisp1::ActionMetadata;\n> +\top.controls = ctrls;\n>   \n>   \tqueueFrameAction.emit(frame, op);\n>   }\n> @@ -292,9 +287,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>   \n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index e85979a7..23c95100 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -18,7 +18,9 @@\n>   #include <libcamera/camera.h>\n>   #include <libcamera/control_ids.h>\n>   #include <libcamera/formats.h>\n> -#include <libcamera/ipa/rkisp1.h>\n> +#include <libcamera/ipa/core_ipa_interface.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> @@ -96,9 +98,11 @@ public:\n>   \tRkISP1MainPath *mainPath_;\n>   \tRkISP1SelfPath *selfPath_;\n>   \n> +\tstd::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;\n> +\n>   private:\n>   \tvoid queueFrameAction(unsigned int frame,\n> -\t\t\t      const IPAOperationData &action);\n> +\t\t\t      const ipa::rkisp1::RkISP1Action &action);\n>   \n>   \tvoid metadataReady(unsigned int frame, const ControlList &metadata);\n>   };\n> @@ -298,7 +302,7 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)\n>   \n>   int RkISP1CameraData::loadIPA()\n>   {\n> -\tipa_ = IPAManager::createIPA(pipe_, 1, 1);\n> +\tipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe_, 1, 1);\n>   \tif (!ipa_)\n>   \t\treturn -ENOENT;\n>   \n> @@ -311,15 +315,15 @@ 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 ipa::rkisp1::RkISP1Action &action)\n>   {\n> -\tswitch (action.operation) {\n> -\tcase RKISP1_IPA_ACTION_V4L2_SET: {\n> -\t\tconst ControlList &controls = action.controls[0];\n> +\tswitch (action.op) {\n> +\tcase ipa::rkisp1::ActionV4L2Set: {\n> +\t\tconst ControlList &controls = action.controls;\n>   \t\tdelayedCtrls_->push(controls);\n>   \t\tbreak;\n>   \t}\n> -\tcase RKISP1_IPA_ACTION_PARAM_FILLED: {\n> +\tcase ipa::rkisp1::ActionParamFilled: {\n>   \t\tPipelineHandlerRkISP1 *pipe = static_cast<PipelineHandlerRkISP1 *>(pipe_);\n>   \t\tRkISP1FrameInfo *info = frameInfo_.find(frame);\n>   \t\tif (!info)\n> @@ -336,11 +340,11 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n>   \n>   \t\tbreak;\n>   \t}\n> -\tcase RKISP1_IPA_ACTION_METADATA:\n> -\t\tmetadataReady(frame, action.controls[0]);\n> +\tcase ipa::rkisp1::ActionMetadata:\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> @@ -667,15 +671,15 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n>   \n>   \tfor (std::unique_ptr<FrameBuffer> &buffer : paramBuffers_) {\n>   \t\tbuffer->setCookie(ipaBufferId++);\n> -\t\tdata->ipaBuffers_.push_back({ .id = buffer->cookie(),\n> -\t\t\t\t\t      .planes = buffer->planes() });\n> +\t\tdata->ipaBuffers_.push_back(IPABuffer(buffer->cookie(),\n> +\t\t\t\t\t\t      buffer->planes()));\n>   \t\tavailableParamBuffers_.push(buffer.get());\n>   \t}\n>   \n>   \tfor (std::unique_ptr<FrameBuffer> &buffer : statBuffers_) {\n>   \t\tbuffer->setCookie(ipaBufferId++);\n> -\t\tdata->ipaBuffers_.push_back({ .id = buffer->cookie(),\n> -\t\t\t\t\t      .planes = buffer->planes() });\n> +\t\tdata->ipaBuffers_.push_back(IPABuffer(buffer->cookie(),\n> +\t\t\t\t\t\t      buffer->planes()));\n>   \t\tavailableStatBuffers_.push(buffer.get());\n>   \t}\n>   \n> @@ -729,8 +733,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n>   \tif (ret)\n>   \t\treturn ret;\n>   \n> -\tIPAOperationData ipaData = {};\n> -\tret = data->ipa_->start(ipaData, nullptr);\n> +\tret = data->ipa_->start();\n>   \tif (ret) {\n>   \t\tfreeBuffers(camera);\n>   \t\tLOG(RkISP1, Error)\n> @@ -771,10 +774,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n>   \t\t\treturn ret;\n>   \t\t}\n>   \n> -\t\tstreamConfig[0] = {\n> -\t\t\t.pixelFormat = data->mainPathStream_.configuration().pixelFormat,\n> -\t\t\t.size = data->mainPathStream_.configuration().size,\n> -\t\t};\n> +\t\tstreamConfig[0] = IPAStream(\n> +\t\t\tdata->mainPathStream_.configuration().pixelFormat,\n> +\t\t\tdata->mainPathStream_.configuration().size\n> +\t\t);\n>   \t}\n>   \n>   \tif (data->selfPath_->isEnabled()) {\n> @@ -788,10 +791,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n>   \t\t\treturn ret;\n>   \t\t}\n>   \n> -\t\tstreamConfig[1] = {\n> -\t\t\t.pixelFormat = data->selfPathStream_.configuration().pixelFormat,\n> -\t\t\t.size = data->selfPathStream_.configuration().size,\n> -\t\t};\n> +\t\tstreamConfig[1] = IPAStream(\n> +\t\t\tdata->selfPathStream_.configuration().pixelFormat,\n> +\t\t\tdata->selfPathStream_.configuration().size\n> +\t\t);\n>   \t}\n>   \n>   \tisp_->setFrameStartEnabled(true);\n> @@ -808,12 +811,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\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\nIt looks like there is a wrong calling order in rkisp1. The call to data->ipa_->configure\nis done upon the \"start\" method of the rkisp1 pipline-handler instead of the \"configure\" method.\nThis is bug not related to this patchset. But with this patchset, the call to data->ipa_->configure\nis after the call to data->ipa_->start when only async calls are allowed.\nI can send a patch fixing that.\n\nThanks,\nDafna\n\n>   \n>   \treturn ret;\n>   }\n> @@ -855,11 +856,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> +\tipa::rkisp1::RkISP1Event ev;\n> +\tev.op = ipa::rkisp1::EventQueueRequest;\n> +\tev.frame = data->frame_;\n> +\tev.bufferId = info->paramBuffer->cookie();\n> +\tev.controls = request->controls();\n> +\tdata->ipa_->processEvent(ev);\n>   \n>   \tdata->frame_++;\n>   \n> @@ -1090,10 +1092,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> +\tipa::rkisp1::RkISP1Event ev;\n> +\tev.op = ipa::rkisp1::EventSignalStatBuffer;\n> +\tev.frame = info->frame;\n> +\tev.bufferId = info->statBuffer->cookie();\n> +\tdata->ipa_->processEvent(ev);\n>   }\n>   \n>   REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)\n>","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 C6F39BD162\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Feb 2021 12:32:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 60F0263778;\n\tFri, 12 Feb 2021 13:32:53 +0100 (CET)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A4CF663772\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Feb 2021 13:32:51 +0100 (CET)","from [IPv6:2003:c7:cf1c:ce00:ddb3:fb9d:3f05:8872]\n\t(p200300c7cf1cce00ddb3fb9d3f058872.dip0.t-ipconnect.de\n\t[IPv6:2003:c7:cf1c:ce00:ddb3:fb9d:3f05:8872])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits))\n\t(No client certificate requested) (Authenticated sender: dafna)\n\tby bhuna.collabora.co.uk (Postfix) with ESMTPSA id 454891F4618E;\n\tFri, 12 Feb 2021 12:32:51 +0000 (GMT)"],"To":"libcamera-devel@lists.libcamera.org,\n\tPaul Elder <paul.elder@ideasonboard.com>","References":"<20210211071846.35161-1-paul.elder@ideasonboard.com>\n\t<20210211071846.35161-12-paul.elder@ideasonboard.com>","From":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","Message-ID":"<ca49d94f-48ac-d9b4-462b-d31ee525534e@collabora.com>","Date":"Fri, 12 Feb 2021 13:32:48 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<20210211071846.35161-12-paul.elder@ideasonboard.com>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v7 11/12] 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>","Cc":"Collabora Kernel ML <kernel@collabora.com>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":15148,"web_url":"https://patchwork.libcamera.org/comment/15148/","msgid":"<YCaMxNb/5u7C/IPL@pendragon.ideasonboard.com>","date":"2021-02-12T14:12:20","subject":"Re: [libcamera-devel] [PATCH v7 11/12] libcamera: pipeline,\n\tipa: rkisp1: Support the new IPC mechanism","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Dafna,\n\nOn Fri, Feb 12, 2021 at 01:32:48PM +0100, Dafna Hirschfeld wrote:\n> Am 11.02.21 um 08:18 schrieb Paul Elder:\n> > Add support to the rkisp1 pipeline handler and IPA for the new IPC\n> > mechanism.\n> > \n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > \n> > ---\n> > No change in v7\n> > \n> > Changes in v6:\n> > - move the enum and const from the header to the mojom file\n> > - remove the per-pipeline ControlInfoMap\n> > - since rkisp1.h has nothing in it anymore, remove it\n> > - use the namespace in the pipeline handler and IPA\n> > \n> > Changes in v5:\n> > - import the generated header with the new file name\n> > \n> > Changes 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> > \n> > Changes in v3:\n> > - change namespacing of base ControlInfoMap structure\n> > \n> > New in v2\n> > ---\n> >   include/libcamera/ipa/meson.build        |  1 +\n> >   include/libcamera/ipa/rkisp1.h           | 22 -------\n> >   include/libcamera/ipa/rkisp1.mojom       | 44 +++++++++++++\n> >   src/ipa/rkisp1/meson.build               |  2 +-\n> >   src/ipa/rkisp1/rkisp1.cpp                | 61 +++++++++---------\n> >   src/libcamera/pipeline/rkisp1/rkisp1.cpp | 79 ++++++++++++------------\n> >   6 files changed, 115 insertions(+), 94 deletions(-)\n> >   delete mode 100644 include/libcamera/ipa/rkisp1.h\n> >   create mode 100644 include/libcamera/ipa/rkisp1.mojom\n> > \n> > diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\n> > index 67e3f049..d701bccc 100644\n> > --- a/include/libcamera/ipa/meson.build\n> > +++ b/include/libcamera/ipa/meson.build\n> > @@ -56,6 +56,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',\n> >   \n> >   ipa_mojom_files = [\n> >       'raspberrypi.mojom',\n> > +    'rkisp1.mojom',\n> >       'vimc.mojom',\n> >   ]\n> >   \n> > diff --git a/include/libcamera/ipa/rkisp1.h b/include/libcamera/ipa/rkisp1.h\n> > deleted file mode 100644\n> > index bb824f29..00000000\n> > --- a/include/libcamera/ipa/rkisp1.h\n> > +++ /dev/null\n> > @@ -1,22 +0,0 @@\n> > -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > -/*\n> > - * Copyright (C) 2019, Google Inc.\n> > - *\n> > - * rkisp1.h - Image Processing Algorithm interface for RkISP1\n> > - */\n> > -#ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__\n> > -#define __LIBCAMERA_IPA_INTERFACE_RKISP1_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> > -\n> > -#endif /* __DOXYGEN__ */\n> > -\n> > -#endif /* __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ */\n> > diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\n> > new file mode 100644\n> > index 00000000..9270f9c7\n> > --- /dev/null\n> > +++ b/include/libcamera/ipa/rkisp1.mojom\n> > @@ -0,0 +1,44 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +\n> > +module ipa.rkisp1;\n> > +\n> > +import \"include/libcamera/ipa/core.mojom\";\n> > +\n> > +enum RkISP1Operations {\n> > +\tActionV4L2Set = 1,\n> > +\tActionParamFilled = 2,\n> > +\tActionMetadata = 3,\n> > +\tEventSignalStatBuffer = 4,\n> > +\tEventQueueRequest = 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> > +};\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> > diff --git a/src/ipa/rkisp1/meson.build b/src/ipa/rkisp1/meson.build\n> > index 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,\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index f4812d8d..67bac986 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -19,7 +19,7 @@\n> >   #include <libcamera/control_ids.h>\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,25 +28,22 @@ namespace libcamera {\n> >   \n> >   LOG_DEFINE_CATEGORY(IPARkISP1)\n> >   \n> > -class IPARkISP1 : public IPAInterface\n> > +class IPARkISP1 : public ipa::rkisp1::IPARkISP1Interface\n> >   {\n> >   public:\n> >   \tint init([[maybe_unused]] const IPASettings &settings) override\n> >   \t{\n> >   \t\treturn 0;\n> >   \t}\n> > -\tint start([[maybe_unused]] const IPAOperationData &data,\n> > -\t\t  [[maybe_unused]] IPAOperationData *result) override { return 0; }\n> > +\tint start() override { return 0; }\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 ipa::rkisp1::RkISP1Event &event) override;\n> >   \n> >   private:\n> >   \tvoid queueRequest(unsigned int frame, rkisp1_params_cfg *params,\n> > @@ -79,10 +76,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 +153,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 ipa::rkisp1::RkISP1Event &event)\n> >   {\n> > -\tswitch (event.operation) {\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> > +\tswitch (event.op) {\n> > +\tcase ipa::rkisp1::EventSignalStatBuffer: {\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,18 +166,18 @@ void IPARkISP1::processEvent(const IPAOperationData &event)\n> >   \t\tupdateStatistics(frame, stats);\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> > +\tcase ipa::rkisp1::EventQueueRequest: {\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> > @@ -202,8 +197,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> > +\tipa::rkisp1::RkISP1Action op;\n> > +\top.op = ipa::rkisp1::ActionParamFilled;\n> >   \n> >   \tqueueFrameAction.emit(frame, op);\n> >   }\n> > @@ -255,13 +250,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> > +\tipa::rkisp1::RkISP1Action op;\n> > +\top.op = ipa::rkisp1::ActionV4L2Set;\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 +268,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> > +\tipa::rkisp1::RkISP1Action op;\n> > +\top.op = ipa::rkisp1::ActionMetadata;\n> > +\top.controls = ctrls;\n> >   \n> >   \tqueueFrameAction.emit(frame, op);\n> >   }\n> > @@ -292,9 +287,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> >   \n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index e85979a7..23c95100 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > @@ -18,7 +18,9 @@\n> >   #include <libcamera/camera.h>\n> >   #include <libcamera/control_ids.h>\n> >   #include <libcamera/formats.h>\n> > -#include <libcamera/ipa/rkisp1.h>\n> > +#include <libcamera/ipa/core_ipa_interface.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> > @@ -96,9 +98,11 @@ public:\n> >   \tRkISP1MainPath *mainPath_;\n> >   \tRkISP1SelfPath *selfPath_;\n> >   \n> > +\tstd::unique_ptr<ipa::rkisp1::IPAProxyRkISP1> ipa_;\n> > +\n> >   private:\n> >   \tvoid queueFrameAction(unsigned int frame,\n> > -\t\t\t      const IPAOperationData &action);\n> > +\t\t\t      const ipa::rkisp1::RkISP1Action &action);\n> >   \n> >   \tvoid metadataReady(unsigned int frame, const ControlList &metadata);\n> >   };\n> > @@ -298,7 +302,7 @@ RkISP1FrameInfo *RkISP1Frames::find(Request *request)\n> >   \n> >   int RkISP1CameraData::loadIPA()\n> >   {\n> > -\tipa_ = IPAManager::createIPA(pipe_, 1, 1);\n> > +\tipa_ = IPAManager::createIPA<ipa::rkisp1::IPAProxyRkISP1>(pipe_, 1, 1);\n> >   \tif (!ipa_)\n> >   \t\treturn -ENOENT;\n> >   \n> > @@ -311,15 +315,15 @@ 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 ipa::rkisp1::RkISP1Action &action)\n> >   {\n> > -\tswitch (action.operation) {\n> > -\tcase RKISP1_IPA_ACTION_V4L2_SET: {\n> > -\t\tconst ControlList &controls = action.controls[0];\n> > +\tswitch (action.op) {\n> > +\tcase ipa::rkisp1::ActionV4L2Set: {\n> > +\t\tconst ControlList &controls = action.controls;\n> >   \t\tdelayedCtrls_->push(controls);\n> >   \t\tbreak;\n> >   \t}\n> > -\tcase RKISP1_IPA_ACTION_PARAM_FILLED: {\n> > +\tcase ipa::rkisp1::ActionParamFilled: {\n> >   \t\tPipelineHandlerRkISP1 *pipe = static_cast<PipelineHandlerRkISP1 *>(pipe_);\n> >   \t\tRkISP1FrameInfo *info = frameInfo_.find(frame);\n> >   \t\tif (!info)\n> > @@ -336,11 +340,11 @@ void RkISP1CameraData::queueFrameAction(unsigned int frame,\n> >   \n> >   \t\tbreak;\n> >   \t}\n> > -\tcase RKISP1_IPA_ACTION_METADATA:\n> > -\t\tmetadataReady(frame, action.controls[0]);\n> > +\tcase ipa::rkisp1::ActionMetadata:\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> > @@ -667,15 +671,15 @@ int PipelineHandlerRkISP1::allocateBuffers(Camera *camera)\n> >   \n> >   \tfor (std::unique_ptr<FrameBuffer> &buffer : paramBuffers_) {\n> >   \t\tbuffer->setCookie(ipaBufferId++);\n> > -\t\tdata->ipaBuffers_.push_back({ .id = buffer->cookie(),\n> > -\t\t\t\t\t      .planes = buffer->planes() });\n> > +\t\tdata->ipaBuffers_.push_back(IPABuffer(buffer->cookie(),\n> > +\t\t\t\t\t\t      buffer->planes()));\n> >   \t\tavailableParamBuffers_.push(buffer.get());\n> >   \t}\n> >   \n> >   \tfor (std::unique_ptr<FrameBuffer> &buffer : statBuffers_) {\n> >   \t\tbuffer->setCookie(ipaBufferId++);\n> > -\t\tdata->ipaBuffers_.push_back({ .id = buffer->cookie(),\n> > -\t\t\t\t\t      .planes = buffer->planes() });\n> > +\t\tdata->ipaBuffers_.push_back(IPABuffer(buffer->cookie(),\n> > +\t\t\t\t\t\t      buffer->planes()));\n> >   \t\tavailableStatBuffers_.push(buffer.get());\n> >   \t}\n> >   \n> > @@ -729,8 +733,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n> >   \tif (ret)\n> >   \t\treturn ret;\n> >   \n> > -\tIPAOperationData ipaData = {};\n> > -\tret = data->ipa_->start(ipaData, nullptr);\n> > +\tret = data->ipa_->start();\n> >   \tif (ret) {\n> >   \t\tfreeBuffers(camera);\n> >   \t\tLOG(RkISP1, Error)\n> > @@ -771,10 +774,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n> >   \t\t\treturn ret;\n> >   \t\t}\n> >   \n> > -\t\tstreamConfig[0] = {\n> > -\t\t\t.pixelFormat = data->mainPathStream_.configuration().pixelFormat,\n> > -\t\t\t.size = data->mainPathStream_.configuration().size,\n> > -\t\t};\n> > +\t\tstreamConfig[0] = IPAStream(\n> > +\t\t\tdata->mainPathStream_.configuration().pixelFormat,\n> > +\t\t\tdata->mainPathStream_.configuration().size\n> > +\t\t);\n> >   \t}\n> >   \n> >   \tif (data->selfPath_->isEnabled()) {\n> > @@ -788,10 +791,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\n> >   \t\t\treturn ret;\n> >   \t\t}\n> >   \n> > -\t\tstreamConfig[1] = {\n> > -\t\t\t.pixelFormat = data->selfPathStream_.configuration().pixelFormat,\n> > -\t\t\t.size = data->selfPathStream_.configuration().size,\n> > -\t\t};\n> > +\t\tstreamConfig[1] = IPAStream(\n> > +\t\t\tdata->selfPathStream_.configuration().pixelFormat,\n> > +\t\t\tdata->selfPathStream_.configuration().size\n> > +\t\t);\n> >   \t}\n> >   \n> >   \tisp_->setFrameStartEnabled(true);\n> > @@ -808,12 +811,10 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c\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> It looks like there is a wrong calling order in rkisp1. The call to data->ipa_->configure\n> is done upon the \"start\" method of the rkisp1 pipline-handler instead of the \"configure\" method.\n> This is bug not related to this patchset. But with this patchset, the call to data->ipa_->configure\n> is after the call to data->ipa_->start when only async calls are allowed.\n\nGood catch !\n\n> I can send a patch fixing that.\n\nThat would be nice, thanks.\n\n> >   \n> >   \treturn ret;\n> >   }\n> > @@ -855,11 +856,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> > +\tipa::rkisp1::RkISP1Event ev;\n> > +\tev.op = ipa::rkisp1::EventQueueRequest;\n> > +\tev.frame = data->frame_;\n> > +\tev.bufferId = info->paramBuffer->cookie();\n> > +\tev.controls = request->controls();\n> > +\tdata->ipa_->processEvent(ev);\n> >   \n> >   \tdata->frame_++;\n> >   \n> > @@ -1090,10 +1092,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> > +\tipa::rkisp1::RkISP1Event ev;\n> > +\tev.op = ipa::rkisp1::EventSignalStatBuffer;\n> > +\tev.frame = info->frame;\n> > +\tev.bufferId = info->statBuffer->cookie();\n> > +\tdata->ipa_->processEvent(ev);\n> >   }\n> >   \n> >   REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1)","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 75AC6BD162\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Feb 2021 14:12:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDABD63789;\n\tFri, 12 Feb 2021 15:12:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 11E0263781\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Feb 2021 15:12:47 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E26C8B5;\n\tFri, 12 Feb 2021 15:12:46 +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=\"RjHBJiEc\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1613139166;\n\tbh=TLkvOvyScgPU5YzGxa8bA9mniD0Omas8qIcs2Tc2O+Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RjHBJiEc7H25pH+UujaHbSrjtdpnNNNNGcBvoxRf8IysNvpRZUxK7jWJkMxDXZ6gr\n\tFZTaYuv/x68w7/aW096h3SyGjoMaTCsSpzpYWfG8D3Ou31jWxJrEeAdGxYr6W461bV\n\tPwS9qQl33emRPg3Sc7Org5XchjpJY3yGyb86DWoU=","Date":"Fri, 12 Feb 2021 16:12:20 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","Message-ID":"<YCaMxNb/5u7C/IPL@pendragon.ideasonboard.com>","References":"<20210211071846.35161-1-paul.elder@ideasonboard.com>\n\t<20210211071846.35161-12-paul.elder@ideasonboard.com>\n\t<ca49d94f-48ac-d9b4-462b-d31ee525534e@collabora.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<ca49d94f-48ac-d9b4-462b-d31ee525534e@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH v7 11/12] 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>","Cc":"libcamera-devel@lists.libcamera.org,\n\tCollabora Kernel ML <kernel@collabora.com>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]