From patchwork Wed Mar 25 15:14:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 26371 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 43F86C330A for ; Wed, 25 Mar 2026 15:16:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B804462CE3; Wed, 25 Mar 2026 16:16:03 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="g/SQqUz0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3A84F62C4E for ; Wed, 25 Mar 2026 16:16:02 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 3F8D31BCF; Wed, 25 Mar 2026 16:14:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1774451684; bh=s0K8MHWvQEkthFW0dWwiLxTiBHilkSt4GYNaDePO0bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/SQqUz00HQqzHXyLJWxcFyaRpmXoI2DD75q/rOpqSQQmc26cqHhegiMAhXLK731X THEeGdf8DdO74X2jiZj6Z9FjSm1WejjiIwXnCxeDvzG4+1sIMnTNXs1XO95J2Qjdee x198Z60x9dWwVLe7F6ZmfF5DmvTZIyCFpO3XVG+Y= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 29/32] pipeline: rkisp1: Pass bufferId to paramsComputed() Date: Wed, 25 Mar 2026 16:14:01 +0100 Message-ID: <20260325151416.2114564-30-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260325151416.2114564-1-stefan.klug@ideasonboard.com> References: <20260325151416.2114564-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The frame number is not necessarily unique. This should not be the case, but even misbehaving kernel drivers should not be able to interfere with that on the libcamera side. Pass the bufferId, to have a guaranteed unique handle. Signed-off-by: Stefan Klug --- Changes in v2: - Added this patch --- include/libcamera/ipa/rkisp1.mojom | 2 +- src/ipa/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libcamera/ipa/rkisp1.mojom b/include/libcamera/ipa/rkisp1.mojom index 56c9fe8ab92a..e48bdf92c8f8 100644 --- a/include/libcamera/ipa/rkisp1.mojom +++ b/include/libcamera/ipa/rkisp1.mojom @@ -45,7 +45,7 @@ interface IPARkISP1Interface { }; interface IPARkISP1EventInterface { - paramsComputed(uint32 frame, uint32 bytesused); + paramsComputed(uint32 frame, uint32 bufferId, uint32 bytesused); setSensorControls(uint32 frame, libcamera.ControlList sensorControls); metadataReady(uint32 frame, libcamera.ControlList metadata); }; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 8a657a170b0d..863cea13dfa3 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -381,7 +381,7 @@ void IPARkISP1::computeParams(const uint32_t frame, const uint32_t bufferId) setSensorControls.emit(frame, ctrls); if (bufferId != 0) - paramsComputed.emit(frame, size); + paramsComputed.emit(frame, bufferId, size); } void IPARkISP1::processStats(const uint32_t frame, const uint32_t bufferId, diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index b6592e87dcc4..c46515110ffc 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -105,7 +105,7 @@ public: bool canUseDewarper_; bool usesDewarper_; - void paramsComputed(unsigned int frame, unsigned int bytesused); + void paramsComputed(unsigned int frame, unsigned int bufferId, unsigned int bytesused); private: void setSensorControls(unsigned int frame, const ControlList &sensorControls); @@ -376,14 +376,14 @@ int RkISP1CameraData::loadTuningFile(const std::string &path) return 0; } -void RkISP1CameraData::paramsComputed(unsigned int frame, unsigned int bytesused) +void RkISP1CameraData::paramsComputed(unsigned int frame, unsigned int bufferId, unsigned int bytesused) { PipelineHandlerRkISP1 *pipe = RkISP1CameraData::pipe(); ParamBufferInfo &pInfo = pipe->computingParamBuffers_.front(); pipe->computingParamBuffers_.pop(); - ASSERT(pInfo.expectedSequence == frame); FrameBuffer *buffer = pInfo.buffer; + ASSERT(buffer->cookie() == bufferId); LOG(RkISP1Schedule, Debug) << "Queue params for " << frame << " " << buffer; @@ -1225,7 +1225,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] const ControlL availableParamBuffers_.pop(); computingParamBuffers_.push({ paramBuffer, nextParamsSequence_++ }); paramsSyncHelper_.pushCorrection(0); - data->paramsComputed(0, res.paramBufferBytesUsed); + data->paramsComputed(0, paramBufferId, res.paramBufferBytesUsed); } actions += [&]() { data->ipa_->stop(); };