{"id":19514,"url":"https://patchwork.libcamera.org/api/1.1/patches/19514/?format=json","web_url":"https://patchwork.libcamera.org/patch/19514/","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":"<20240220164317.998477-4-dan.scally@ideasonboard.com>","date":"2024-02-20T16:43:13","name":"[v2,3/7] libcamera: rkisp1: Track request->sequence() instead of frame_","commit_ref":null,"pull_url":null,"state":"rejected","archived":true,"hash":"b2983f966b630115baa08d671d916b600c532944","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/1.1/people/156/?format=json","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/19514/mbox/","series":[{"id":4172,"url":"https://patchwork.libcamera.org/api/1.1/series/4172/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4172","date":"2024-02-20T16:43:10","name":"Remove RkISP1FrameInfo and IPU3Frames classes","version":2,"mbox":"https://patchwork.libcamera.org/series/4172/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/19514/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/19514/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 55355C32C3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Feb 2024 16:43:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D54516281B;\n\tTue, 20 Feb 2024 17:43:27 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D453D61CAA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Feb 2024 17:43:24 +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 72A0F14B0;\n\tTue, 20 Feb 2024 17:43:17 +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=\"HAcgv9SR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1708447397;\n\tbh=aFGqaUW3ZkJPRpocov+lqEFRvBqZ4KIdRpuExSdhOXU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HAcgv9SRYfpx8e7GzRFGYwa881BTr4JVxHadMKpbpxvJaL8Mo6yl+GitmlQNyuhyh\n\tG5LPBmT8AD9XinF4uLSiHk8RTmO33fV+ieWGcQ938vT7FhobHxc26pH/btrqfLQLmb\n\t53ZPaHObS+kZYyyP2Ou53NCqx+6SctiAazis8+fE=","From":"Daniel Scally <dan.scally@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 3/7] libcamera: rkisp1: Track request->sequence() instead\n\tof frame_","Date":"Tue, 20 Feb 2024 16:43:13 +0000","Message-Id":"<20240220164317.998477-4-dan.scally@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20240220164317.998477-1-dan.scally@ideasonboard.com>","References":"<20240220164317.998477-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":"The rkisp1 pipeline handler currently tries to track the frame number\nfrom V4L2 to provide an index to the IPA module's FCQueue - this is\nnot necessary, the Request's sequence does the same job perfectly\nwell.\n\nNote that the association of controls and calculated parameters with\nspecific frames is not affected here - the parameters are always\napplied based on the most recently processed statistics, and the\napplied controls are fetched separately using the V4L2 provided\nbuffer->metadata().sequence, which value is also internally tracked\nby DelayedControls.\n\nSigned-off-by: Daniel Scally <dan.scally@ideasonboard.com>\n---\nChanges in v2:\n\n\t- In statReady() I no longer used request->sequence() to fetch from\n\t  delayedCtrls_ - ensuring that we only use the V4L2 reported sequence\n\t  there.\n\n src/libcamera/pipeline/rkisp1/rkisp1.cpp | 23 +++++++++--------------\n 1 file changed, 9 insertions(+), 14 deletions(-)","diff":"diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex 586b46d6..d926c83c 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -88,7 +88,7 @@ class RkISP1CameraData : public Camera::Private\n public:\n \tRkISP1CameraData(PipelineHandler *pipe, RkISP1MainPath *mainPath,\n \t\t\t RkISP1SelfPath *selfPath)\n-\t\t: Camera::Private(pipe), frame_(0), frameInfo_(pipe),\n+\t\t: Camera::Private(pipe), frameInfo_(pipe),\n \t\t  mainPath_(mainPath), selfPath_(selfPath)\n \t{\n \t}\n@@ -100,7 +100,6 @@ public:\n \tStream selfPathStream_;\n \tstd::unique_ptr<CameraSensor> sensor_;\n \tstd::unique_ptr<DelayedControls> delayedCtrls_;\n-\tunsigned int frame_;\n \tstd::vector<IPABuffer> ipaBuffers_;\n \tRkISP1Frames frameInfo_;\n \n@@ -214,7 +213,7 @@ RkISP1Frames::RkISP1Frames(PipelineHandler *pipe)\n RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *request,\n \t\t\t\t      bool isRaw)\n {\n-\tunsigned int frame = data->frame_;\n+\tunsigned int frame = request->sequence();\n \n \tFrameBuffer *paramBuffer = nullptr;\n \tFrameBuffer *statBuffer = nullptr;\n@@ -235,6 +234,7 @@ RkISP1FrameInfo *RkISP1Frames::create(const RkISP1CameraData *data, Request *req\n \n \t\tstatBuffer = pipe_->availableStatBuffers_.front();\n \t\tpipe_->availableStatBuffers_.pop();\n+\t\tstatBuffer->_d()->setRequest(request);\n \t}\n \n \tFrameBuffer *mainPathBuffer = request->findBuffer(&data->mainPathStream_);\n@@ -935,8 +935,6 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL\n \t\treturn ret;\n \t}\n \n-\tdata->frame_ = 0;\n-\n \tif (!isRaw_) {\n \t\tret = param_->streamOn();\n \t\tif (ret) {\n@@ -1028,7 +1026,7 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n \tif (!info)\n \t\treturn -ENOENT;\n \n-\tdata->ipa_->queueRequest(data->frame_, request->controls());\n+\tdata->ipa_->queueRequest(request->sequence(), request->controls());\n \tif (isRaw_) {\n \t\tif (info->mainPathBuffer)\n \t\t\tdata->mainPath_->queueBuffer(info->mainPathBuffer);\n@@ -1036,12 +1034,10 @@ int PipelineHandlerRkISP1::queueRequestDevice(Camera *camera, Request *request)\n \t\tif (data->selfPath_ && info->selfPathBuffer)\n \t\t\tdata->selfPath_->queueBuffer(info->selfPathBuffer);\n \t} else {\n-\t\tdata->ipa_->fillParamsBuffer(data->frame_,\n+\t\tdata->ipa_->fillParamsBuffer(request->sequence(),\n \t\t\t\t\t     info->paramBuffer->cookie());\n \t}\n \n-\tdata->frame_++;\n-\n \treturn 0;\n }\n \n@@ -1276,7 +1272,8 @@ void PipelineHandlerRkISP1::bufferReady(FrameBuffer *buffer)\n \t\tif (isRaw_) {\n \t\t\tconst ControlList &ctrls =\n \t\t\t\tdata->delayedCtrls_->get(metadata.sequence);\n-\t\t\tdata->ipa_->processStatsBuffer(info->frame, 0, ctrls);\n+\t\t\tdata->ipa_->processStatsBuffer(request->sequence(),\n+\t\t\t\t\t\t       0, ctrls);\n \t\t}\n \t} else {\n \t\tif (isRaw_)\n@@ -1304,6 +1301,7 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n {\n \tASSERT(activeCamera_);\n \tRkISP1CameraData *data = cameraData(activeCamera_);\n+\tRequest *request = buffer->request();\n \n \tRkISP1FrameInfo *info = data->frameInfo_.find(buffer);\n \tif (!info)\n@@ -1315,10 +1313,7 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer)\n \t\treturn;\n \t}\n \n-\tif (data->frame_ <= buffer->metadata().sequence)\n-\t\tdata->frame_ = buffer->metadata().sequence + 1;\n-\n-\tdata->ipa_->processStatsBuffer(info->frame, info->statBuffer->cookie(),\n+\tdata->ipa_->processStatsBuffer(request->sequence(), info->statBuffer->cookie(),\n \t\t\t\t       data->delayedCtrls_->get(buffer->metadata().sequence));\n }\n \n","prefixes":["v2","3/7"]}