{"id":19480,"url":"https://patchwork.libcamera.org/api/patches/19480/?format=json","web_url":"https://patchwork.libcamera.org/patch/19480/","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":"<20240212153532.179283-4-dan.scally@ideasonboard.com>","date":"2024-02-12T15:35:30","name":"[3/5] libcamera: rkisp1: Switch IPA slots to use bufferId not frame","commit_ref":null,"pull_url":null,"state":"rejected","archived":true,"hash":"29e0badd7ce179214a830a28017d8838bd0ac504","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/?format=json","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19480/mbox/","series":[{"id":4166,"url":"https://patchwork.libcamera.org/api/series/4166/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4166","date":"2024-02-12T15:35:27","name":"Remove RkISP1FrameInfo class","version":1,"mbox":"https://patchwork.libcamera.org/series/4166/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19480/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19480/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 308C7C32C3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 12 Feb 2024 15:35:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DB79A62814;\n\tMon, 12 Feb 2024 16:35:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CF67627FE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 12 Feb 2024 16:35:44 +0100 (CET)","from mail.ideasonboard.com\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A64FB53;\n\tMon, 12 Feb 2024 16:35:42 +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=\"FBa8t7yv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1707752142;\n\tbh=lrEgDEFU1TFHgIie2eGmD3DqpVXJ2+sJDe+Wy4+dkd8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=FBa8t7yvb+ZQ9fM0qrhdt9hRVsp8QVZ5GIzrmYQu+MgTWIIWeMgMwYoCm3CGz5lzF\n\tD5UVMm9H+E2JNXygqLEKHoy4CPVNte8NpZ8Z26svvWVH9lXIwxevua/SJGgyXiql2V\n\tdvfcEmCPkh462FJnNtfB3v5Hi3U55JQTaSUes7UY=","From":"Daniel Scally <dan.scally@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH 3/5] libcamera: rkisp1: Switch IPA slots to use bufferId not\n\tframe","Date":"Mon, 12 Feb 2024 15:35:30 +0000","Message-Id":"<20240212153532.179283-4-dan.scally@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240212153532.179283-1-dan.scally@ideasonboard.com>","References":"<20240212153532.179283-1-dan.scally@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"In preparation for removing the RkISP1FrameInfo class we need the\nRkISP1 IPA to emit bufferIds rather than frame numbers for its slots\nso that the pipeline handler can find the correct buffer properly.\n\nSwitch the slots; reconfigure the pipeline handler to obtain the\ncorrect buffer first before passing it to RkISP1FrameInfo::find()\nas before; one of its overloads already works with FrameBuffer *.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\n include/libcamera/ipa/rkisp1.mojom       |  4 +-\n src/ipa/rkisp1/rkisp1.cpp                |  4 +-\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 59 ++++++++++++++++--------\n 3 files changed, 44 insertions(+), 23 deletions(-)","diff":"diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom\nindex 1009e970..4c097622 100644\n--- a/include/libcamera/ipa/rkisp1.mojom\n+++ b/include/libcamera/ipa/rkisp1.mojom\n@@ -36,7 +36,7 @@ interface IPARkISP1Interface {\n };\n \n interface IPARkISP1EventInterface {\n-\tparamsBufferReady(uint32 frame);\n+\tparamsBufferReady(uint32 bufferId);\n \tsetSensorControls(uint32 frame, libcamera.ControlList sensorControls);\n-\tmetadataReady(uint32 frame, libcamera.ControlList metadata);\n+\tmetadataReady(uint32 bufferId, libcamera.ControlList metadata);\n };\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 6544c925..7e01a04d 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -337,7 +337,7 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)\n \tfor (auto const &algo : algorithms())\n \t\talgo->prepare(context_, frame, frameContext, params);\n \n-\tparamsBufferReady.emit(frame);\n+\tparamsBufferReady.emit(bufferId);\n }\n \n void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,\n@@ -370,7 +370,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \n \tsetControls(frame);\n \n-\tmetadataReady.emit(frame, metadata);\n+\tmetadataReady.emit(bufferId, metadata);\n }\n \n void IPARkISP1::updateControls(const IPACameraSensorInfo &sensorInfo,\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 22e553fe..d4ed38a4 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -376,23 +376,34 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision)\n \treturn 0;\n }\n \n-void RkISP1CameraData::paramFilled(unsigned int frame)\n+void RkISP1CameraData::paramFilled(unsigned int bufferId)\n {\n \tPipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe();\n-\tRkISP1FrameInfo *info = frameInfo_.find(frame);\n-\tif (!info)\n-\t\treturn;\n \n-\tinfo->paramBuffer->_d()->metadata().planes()[0].bytesused =\n-\t\tsizeof(struct rkisp1_params_cfg);\n-\tpipe->param_->queueBuffer(info->paramBuffer);\n-\tpipe->stat_->queueBuffer(info->statBuffer);\n+\tfor (std::unique_ptr<FrameBuffer> &paramBuffer : pipe->paramBuffers_) {\n+\t\tif (paramBuffer->cookie() != bufferId)\n+\t\t\tcontinue;\n+\n+\t\tRkISP1FrameInfo *info = frameInfo_.find(paramBuffer.get());\n+\t\tif (!info)\n+\t\t\treturn;\n+\n+\t\tinfo->paramBuffer->_d()->metadata().planes()[0].bytesused =\n+\t\t\tsizeof(struct rkisp1_params_cfg);\n+\t\tpipe->param_->queueBuffer(info->paramBuffer);\n+\t\tpipe->stat_->queueBuffer(info->statBuffer);\n \n-\tif (info->mainPathBuffer)\n-\t\tmainPath_->queueBuffer(info->mainPathBuffer);\n+\t\tif (info->mainPathBuffer)\n+\t\t\tmainPath_->queueBuffer(info->mainPathBuffer);\n+\n+\t\tif (selfPath_ && info->selfPathBuffer)\n+\t\t\tselfPath_->queueBuffer(info->selfPathBuffer);\n+\n+\t\treturn;\n+\t}\n \n-\tif (selfPath_ && info->selfPathBuffer)\n-\t\tselfPath_->queueBuffer(info->selfPathBuffer);\n+\tLOG(RkISP1, Fatal) << \"Can't locate buffer from bufferId\";\n+\treturn;\n }\n \n void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame,\n@@ -401,16 +412,26 @@ void RkISP1CameraData::setSensorControls([[maybe_unused]] unsigned int frame,\n \tdelayedCtrls_->push(sensorControls);\n }\n \n-void RkISP1CameraData::metadataReady(unsigned int frame, const ControlList &metadata)\n+void RkISP1CameraData::metadataReady(unsigned int bufferId,\n+\t\t\t\t     const ControlList &metadata)\n {\n-\tRkISP1FrameInfo *info = frameInfo_.find(frame);\n-\tif (!info)\n-\t\treturn;\n+\tfor (std::unique_ptr<FrameBuffer> &statBuffer : pipe()->statBuffers_) {\n+\t\tif (statBuffer->cookie() != bufferId)\n+\t\t\tcontinue;\n+\n+\t\tRkISP1FrameInfo *info = frameInfo_.find(statBuffer.get());\n+\t\tif (!info)\n+\t\t\treturn;\n \n-\tinfo->request->metadata().merge(metadata);\n-\tinfo->metadataProcessed = true;\n+\t\tinfo->request->metadata().merge(metadata);\n+\t\tinfo->metadataProcessed = true;\n+\n+\t\tpipe()->tryCompleteRequest(info);\n+\t\treturn;\n+\t}\n \n-\tpipe()->tryCompleteRequest(info);\n+\tLOG(RkISP1, Fatal) << \"Can't locate buffer from bufferId\";\n+\treturn;\n }\n \n /* -----------------------------------------------------------------------------\n","prefixes":["3/5"]}