{"id":13351,"url":"https://patchwork.libcamera.org/api/1.1/patches/13351/?format=json","web_url":"https://patchwork.libcamera.org/patch/13351/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210813144437.138005-5-umang.jain@ideasonboard.com>","date":"2021-08-13T14:44:37","name":"[libcamera-devel,v2,4/4] ipa: vimc: Send and retrieve FrameBuffers from IPA","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fa081ce5d43655556509f4e3035d0ba608b43f51","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/1.1/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/1.1/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/13351/mbox/","series":[{"id":2356,"url":"https://patchwork.libcamera.org/api/1.1/series/2356/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2356","date":"2021-08-13T14:44:33","name":"Pass buffers to VIMC IPA","version":2,"mbox":"https://patchwork.libcamera.org/series/2356/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13351/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13351/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 6BAE6C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Aug 2021 14:44:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 344976888D;\n\tFri, 13 Aug 2021 16:44:59 +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 D4BC06888D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Aug 2021 16:44:57 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.198])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CCA968F;\n\tFri, 13 Aug 2021 16:44:56 +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=\"dDkoloQW\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628865897;\n\tbh=h93wOdQqb83xbnfiGOUpIJXSro7G9RPZqHAPvKk9Sdg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=dDkoloQWGVG/ZjO8dy+0hXNxoLBGssfXQT/J6Yuk6zVrp3HWsb5qAdZEHymoxSc4R\n\tSqohTwfUYiabEOYjgdhAVxxFsqfmMWh16obxqCd2U4U4MJUDmVZ4k5jQhFhBDtq3mZ\n\tg4hV/4PohXYKZyE8EKJT1V1JNiK9GIYR0B1pYr3M=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 13 Aug 2021 20:14:37 +0530","Message-Id":"<20210813144437.138005-5-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210813144437.138005-1-umang.jain@ideasonboard.com>","References":"<20210813144437.138005-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 4/4] ipa: vimc: Send and retrieve\n\tFrameBuffers from IPA","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Plumb through VIMC mojo interface to enable buffers passing.\nSince VIMC is a virtual test driver and does not have actual\nIPA buffers (parameters and statistics), we can only pass them\nas is, to and from the IPA. The buffers used here are mock\nFrameBuffers which are dmabuf backed(in other words, mmap()able\nthrough MappedFramebuffer inside the IPA).\n\nThis commits shows:\n- Passing and filling the parameter buffer from the pipeline handler to\n  the IPA.\n- Passing request controls ControlList to the IPA.\n\nAny tests using VIMC will now loop in the IPA paths. Any tests running\nin isolated mode will help us to test IPA IPC code paths especially\naround (de)serialization of data passing from pipeline handlers to the\nIPA. Future IPA interface tests can simply extend the VIMC mojom\ninterface to achieve/test a specific use case as required.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n include/libcamera/ipa/vimc.mojom     | 14 +++++++++++++-\n src/ipa/vimc/vimc.cpp                | 19 +++++++++++++++++++\n src/libcamera/pipeline/vimc/vimc.cpp | 11 +++++++++++\n 3 files changed, 43 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/ipa/vimc.mojom b/include/libcamera/ipa/vimc.mojom\nindex 8cb240d3..85a2d8e4 100644\n--- a/include/libcamera/ipa/vimc.mojom\n+++ b/include/libcamera/ipa/vimc.mojom\n@@ -29,8 +29,20 @@ interface IPAVimcInterface {\n \n \tmapBuffers(array<libcamera.IPABuffer> buffers);\n \tunmapBuffers(array<uint32> ids);\n+\n+\t/*\n+\t * VIMC being a virtual test driver does not have actual parameters\n+\t * and statistics buffers. However, VIMC pipeline creates mock IPA\n+\t * buffers and map it to IPA.\n+\t *\n+\t * Since, we are not working with actual IPA buffers here,\n+\t * following are mostly stub functions, introduced to leverage IPA\n+\t * IPC tests.\n+\t */\n+\t[async] fillParams(uint32 frame, uint32 bufferId);\n+\t[async] processControls(uint32 frame, libcamera.ControlList controls);\n };\n \n interface IPAVimcEventInterface {\n-\tdummyEvent(uint32 val);\n+\tparamsFilled(uint32 bufferId);\n };\ndiff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp\nindex 082b2db7..be189181 100644\n--- a/src/ipa/vimc/vimc.cpp\n+++ b/src/ipa/vimc/vimc.cpp\n@@ -43,6 +43,9 @@ public:\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \n+\tvoid fillParams(uint32_t frame, uint32_t bufferId) override;\n+\tvoid processControls(uint32_t frame, const ControlList &controls) override;\n+\n private:\n \tvoid initTrace();\n \tvoid trace(enum ipa::vimc::IPAOperationCode operation);\n@@ -125,6 +128,22 @@ void IPAVimc::unmapBuffers(const std::vector<unsigned int> &ids)\n \t}\n }\n \n+void IPAVimc::fillParams([[maybe_unused]] uint32_t frame, uint32_t bufferId)\n+{\n+\tauto it = buffers_.find(bufferId);\n+\tif (it == buffers_.end()) {\n+\t\tLOG(IPAVimc, Error) << \"Could not find parameter buffer\";\n+\t\treturn;\n+\t}\n+\n+\tparamsFilled.emit(bufferId);\n+}\n+\n+void IPAVimc::processControls([[maybe_unused]] uint32_t frame,\n+\t\t\t      [[maybe_unused]] const ControlList &controls)\n+{\n+}\n+\n void IPAVimc::initTrace()\n {\n \tstruct stat fifoStat;\ndiff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp\nindex c44a6242..bfd545c8 100644\n--- a/src/libcamera/pipeline/vimc/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc/vimc.cpp\n@@ -52,6 +52,7 @@ public:\n \tint init();\n \tint allocateMockIPABuffers();\n \tvoid bufferReady(FrameBuffer *buffer);\n+\tvoid paramsFilled(unsigned int id);\n \n \tMediaDevice *media_;\n \tstd::unique_ptr<CameraSensor> sensor_;\n@@ -433,6 +434,8 @@ int PipelineHandlerVimc::queueRequestDevice(Camera *camera, Request *request)\n \tif (ret < 0)\n \t\treturn ret;\n \n+\tdata->ipa_->processControls(request->sequence(), request->controls());\n+\n \treturn 0;\n }\n \n@@ -466,6 +469,8 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)\n \t\treturn false;\n \t}\n \n+\tdata->ipa_->paramsFilled.connect(data.get(), &VimcCameraData::paramsFilled);\n+\n \tstd::string conf = data->ipa_->configurationFile(\"vimc.conf\");\n \tdata->ipa_->init(IPASettings{ conf, data->sensor_->model() });\n \n@@ -570,6 +575,8 @@ void VimcCameraData::bufferReady(FrameBuffer *buffer)\n \n \tpipe_->completeBuffer(request, buffer);\n \tpipe_->completeRequest(request);\n+\n+\tipa_->fillParams(request->sequence(), mockIPABufs_[0]->cookie());\n }\n \n int VimcCameraData::allocateMockIPABuffers()\n@@ -591,6 +598,10 @@ int VimcCameraData::allocateMockIPABuffers()\n \treturn video_->exportBuffers(bufCount, &mockIPABufs_);\n }\n \n+void VimcCameraData::paramsFilled([[maybe_unused]] unsigned int id)\n+{\n+}\n+\n REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc)\n \n } /* namespace libcamera */\n","prefixes":["libcamera-devel","v2","4/4"]}