From patchwork Mon Sep 14 14:02:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28275 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 48804BDCB7 for ; Mon, 14 Sep 2026 14:04:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7AF7368700; Mon, 14 Sep 2026 16:04:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PDcXiHbI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A5466686FF for ; Mon, 14 Sep 2026 16:04:48 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:a279:75fa:1f6c:7f40]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A52E4C14; Mon, 14 Sep 2026 16:03:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1789394588; bh=HyVpHVQjQoA4KLAiVBsGN2o+3XnJhzx+Yqpgd/tR8BE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDcXiHbIRa9bOwtkLZXtP2Av8QLbLc65Coud+WPDG5mqH9PheNhzIVSWVLQbVOabO +YLsDa9ayO9EpzTlvcekC82sU5kqG2WyHh3qK2a75q8P6mDA9TTIdmmslhYhh0s1+O +SaWA37wDFoabGEx538LdhsFsoiEDINrOLEurDkw= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 31/41] pipeline: rkisp1: Fix buffer metadata when using the dewarper Date: Mon, 14 Sep 2026 16:02:44 +0200 Message-ID: <20260914140309.3354666-32-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260914140309.3354666-1-stefan.klug@ideasonboard.com> References: <20260914140309.3354666-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" When the dewarper is part of the pipeline, the output buffers shall still carry status (in case of FrameError), timestamp and sequence from the corresponding image buffer. Timestamp is automatically copied over by the m2m device. Manually transfer status and sequence. This change fixes an issue where frames with error status were marked as successful after running through the dewarper. Signed-off-by: Stefan Klug --- Changes in v2: - Added this patch --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index b051dd21fb4c..ca88f9a521d2 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -163,6 +163,10 @@ struct ParamBufferInfo { struct DewarpBufferInfo { FrameBuffer *inputBuffer; + struct { + FrameMetadata::Status status; + unsigned int sequence; + } inputMeta; FrameBuffer *outputBuffer; }; @@ -1879,7 +1883,11 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) * for the dewarper are the buffers of the request, supplied by the * application. */ - DewarpBufferInfo dewarpInfo{ buffer, reqInfo->request->findBuffer(&data->mainPathStream_) }; + DewarpBufferInfo dewarpInfo{ + buffer, + { metadata.status, metadata.sequence }, + reqInfo->request->findBuffer(&data->mainPathStream_) + }; LOG(RkISP1Schedule, Debug) << "Queue dewarper " << dewarpInfo.inputBuffer << " " << dewarpInfo.outputBuffer; @@ -1900,7 +1908,6 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer) void PipelineHandlerRkISP1::dewarpBufferReady(FrameBuffer *buffer) { Request *request = buffer->request(); - const FrameMetadata &metadata = buffer->metadata(); /* * After stopping the dewarper, the buffers are returned out of order. @@ -1911,13 +1918,18 @@ void PipelineHandlerRkISP1::dewarpBufferReady(FrameBuffer *buffer) if (dwInfo.outputBuffer != buffer) continue; + FrameMetadata &outputMeta = buffer->_d()->metadata(); + + if (outputMeta.status != FrameMetadata::FrameCancelled && + dwInfo.inputMeta.status == FrameMetadata::FrameError) + outputMeta.status = FrameMetadata::FrameError; + + outputMeta.sequence = dwInfo.inputMeta.sequence; + availableMainPathBuffers_.push(dwInfo.inputBuffer); dwInfo.inputBuffer = nullptr; dwInfo.outputBuffer = nullptr; - if (metadata.status == FrameMetadata::FrameCancelled) - buffer->_d()->cancel(); - completeBuffer(request, buffer); }