{"id":15639,"url":"https://patchwork.libcamera.org/api/patches/15639/?format=json","web_url":"https://patchwork.libcamera.org/patch/15639/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20220406141709.164794-5-umang.jain@ideasonboard.com>","date":"2022-04-06T14:17:07","name":"[libcamera-devel,IPAIPU3,v5,4/6] ipu3: Use the new IPAIPU3 interface","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"b2b86f6f6b55af8c6e5afcfdf026c9d067c90df1","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15639/mbox/","series":[{"id":3037,"url":"https://patchwork.libcamera.org/api/series/3037/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3037","date":"2022-04-06T14:17:03","name":"ipa: ipu3: Replace event-based ops with dedicated functions","version":5,"mbox":"https://patchwork.libcamera.org/series/3037/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15639/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15639/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 7F7C3C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Apr 2022 14:17:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A11765649;\n\tWed,  6 Apr 2022 16:17:36 +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 ED43C633A4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 16:17:34 +0200 (CEST)","from perceval.ideasonboard.com (unknown [27.57.186.178])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 098E5482;\n\tWed,  6 Apr 2022 16:17:32 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649254656;\n\tbh=OguJDJPfaEXUOIkbJ7xjx5mE7uSsWhyhsfTUwBVetwM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=Mzq7midEXfuxmMaZ4SWiGla18RthZbquVl8H+mIotCe0JxHG0wA6UV1MJpecaKRTs\n\t0kZydeIWSLqahPVfqTlqS2m43QNSEqFbaX9OfjVQVGY2jwnxzfR61jzl+pm4Voqr6b\n\tbxvHgn+N2HKUxawHU6PrHJFUwVhCoEbBcgupG5OWpqIFydFNsWe5Cl0zaRVklSuoYp\n\tLSU4agn2bvtVdaecW9jcyIumJxCWeu5NSCUtdRkpDUr49jOFpMcJ4e7H5SaTGveuP/\n\t/fMArkObaRcRWNV1Xtzur9Z5JImKprvZIlRPYaX4jSg/I+6qKnm8Wdra4dc0/zj9g5\n\t2xOOBJBDpK3Rw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649254654;\n\tbh=OguJDJPfaEXUOIkbJ7xjx5mE7uSsWhyhsfTUwBVetwM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cZSMxoGwUIsGN+pvxyHli1ru6Lb5fEXUw00ppXnZB4JMzbPNBlZvTahiylibHFIOZ\n\tiB3egoueImhwXZqjvYLGwGsSeK6SWhRT8vrvZ54O/pbpCqkUptfGufduzNrfaJQQw9\n\tlHLmalyK9LhrN7C0wHaORqVMuEqW6mJMnYFoiX6U="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"cZSMxoGw\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  6 Apr 2022 19:47:07 +0530","Message-Id":"<20220406141709.164794-5-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20220406141709.164794-1-umang.jain@ideasonboard.com>","References":"<20220406141709.164794-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [IPAIPU3 PATCH v5 4/6] ipu3: Use the new IPAIPU3\n\tinterface","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>","From":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Use the new IPAIPU3 interface that migrates the event-based ops\nto dedication functions.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n ipu3.cpp | 101 ++++++++++++++++++++++---------------------------------\n 1 file changed, 40 insertions(+), 61 deletions(-)","diff":"diff --git a/ipu3.cpp b/ipu3.cpp\nindex 6ab86e0..b6d2129 100644\n--- a/ipu3.cpp\n+++ b/ipu3.cpp\n@@ -49,13 +49,16 @@ public:\n \n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n-\tvoid processEvent(const IPU3Event &event) override;\n \n+\tvoid queueRequest(const uint32_t frame, const ControlList &controls) override;\n+\tvoid fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) override;\n+\tvoid processStatsBuffer(const uint32_t frame, const int64_t frameTimestamp,\n+\t\t\t\tconst uint32_t bufferId,\n+\t\t\t\tconst ControlList &sensorControls) override;\n private:\n \tvoid updateControls(const IPACameraSensorInfo &sensorInfo,\n \t\t\t    const ControlInfoMap &sensorControls,\n \t\t\t    ControlInfoMap *ipaControls);\n-\tvoid processControls(unsigned int frame, const ControlList &metadata);\n \tvoid runAiq(unsigned int frame);\n \tvoid fillParams(unsigned int frame, ipu3_uapi_params *params);\n \tvoid parseStatistics(unsigned int frame,\n@@ -321,54 +324,41 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)\n \t}\n }\n \n-void IPAIPU3::processEvent(const IPU3Event &event)\n+void IPAIPU3::queueRequest([[maybe_unused]] unsigned int frame,\n+\t\t\t   [[maybe_unused]] const ControlList &controls)\n {\n-\tswitch (event.op) {\n-\tcase EventProcessControls: {\n-\t\tprocessControls(event.frame, event.controls);\n-\t\tbreak;\n-\t}\n-\tcase EventStatReady: {\n-\t\tauto it = buffers_.find(event.bufferId);\n-\t\tif (it == buffers_.end()) {\n-\t\t\tLOG(IPAIPU3, Error) << \"Could not find stats buffer!\";\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tSpan<uint8_t> mem = it->second.maps()[0];\n-\t\tconst ipu3_uapi_stats_3a *stats =\n-\t\t\treinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());\n-\n-\t\tparseStatistics(event.frame,\n-\t\t\t\tevent.frameTimestamp,\n-\t\t\t\tstats,\n-\t\t\t\tevent.sensorControls);\n-\t\tbreak;\n-\t}\n-\tcase EventFillParams: {\n-\t\tauto it = buffers_.find(event.bufferId);\n-\t\tif (it == buffers_.end()) {\n-\t\t\tLOG(IPAIPU3, Error) << \"Could not find param buffer!\";\n-\t\t\treturn;\n-\t\t}\n-\n-\t\tSpan<uint8_t> mem = it->second.maps()[0];\n-\t\tipu3_uapi_params *params =\n-\t\t\treinterpret_cast<ipu3_uapi_params *>(mem.data());\n-\n-\t\tfillParams(event.frame, params);\n-\t\tbreak;\n-\t}\n-\tdefault:\n-\t\tLOG(IPAIPU3, Error) << \"Unknown event \" << event.op;\n-\t\tbreak;\n+\t/* \\todo Start processing for 'frame' based on 'controls'. */\n+}\n+\n+void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)\n+{\n+\tauto it = buffers_.find(bufferId);\n+\tif (it == buffers_.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Could not find params buffer\";\n+\t\treturn;\n \t}\n+\n+\tSpan<uint8_t> mem = it->second.maps()[0];\n+\tipu3_uapi_params *params =\n+\t\treinterpret_cast<ipu3_uapi_params *>(mem.data());\n+\n+\tfillParams(frame, params);\n }\n \n-void IPAIPU3::processControls([[maybe_unused]] unsigned int frame,\n-\t\t\t      [[maybe_unused]] const ControlList &controls)\n+void IPAIPU3::processStatsBuffer(const uint32_t frame, const int64_t frameTimestamp,\n+\t\t\t\t const uint32_t bufferId, const ControlList &sensorControls)\n {\n-\t/* \\todo Start processing for 'frame' based on 'controls'. */\n+\tauto it = buffers_.find(bufferId);\n+\tif (it == buffers_.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Could not find stats buffer\";\n+\t\treturn;\n+\t}\n+\n+\tSpan<uint8_t> mem = it->second.maps()[0];\n+\tconst ipu3_uapi_stats_3a *stats =\n+\t\treinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());\n+\n+\tparseStatistics(frame, frameTimestamp, stats, sensorControls);\n }\n \n void IPAIPU3::runAiq([[maybe_unused]] unsigned int frame)\n@@ -424,10 +414,7 @@ void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params)\n \n \tsetControls(frame);\n \n-\tIPU3Action op;\n-\top.op = ActionParamFilled;\n-\n-\tqueueFrameAction.emit(frame, op);\n+\tparamsBufferReady.emit(frame);\n }\n \n void IPAIPU3::parseStatistics(unsigned int frame,\n@@ -488,27 +475,19 @@ void IPAIPU3::parseStatistics(unsigned int frame,\n \t\t\t\t(sensorInfo_.pixelRate / 1e6);\n \tctrls.set(controls::FrameDuration, frameDuration);\n \n-\tIPU3Action op;\n-\top.op = ActionMetadataReady;\n-\top.controls = ctrls;\n-\n-\tqueueFrameAction.emit(frame, op);\n+\tmetadataReady.emit(frame, ctrls);\n }\n \n void IPAIPU3::setControls(unsigned int frame)\n {\n-\tIPU3Action op;\n-\top.op = ActionSetSensorControls;\n-\n \tControlList sensorCtrls(ctrls_);\n \tsensorCtrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure_));\n \tsensorCtrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast<int32_t>(gain_));\n \n-\top.sensorControls = sensorCtrls;\n-\n-\top.lensControls.set(V4L2_CID_FOCUS_ABSOLUTE, lensPosition_);\n+\tControlList lensCtrls(ctrls_);\n+\tlensCtrls.set(V4L2_CID_FOCUS_ABSOLUTE, lensPosition_);\n \n-\tqueueFrameAction.emit(frame, op);\n+\tsetSensorControls.emit(frame, sensorCtrls, lensCtrls);\n }\n \n } /* namespace ipa::ipu3 */\n","prefixes":["libcamera-devel","IPAIPU3","v5","4/6"]}