From patchwork Wed Mar 25 15:13:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 26362 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 36277C32F7 for ; Wed, 25 Mar 2026 15:15:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D02AF62C4E; Wed, 25 Mar 2026 16:15:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qILCJV6h"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 37F2D62BF0 for ; Wed, 25 Mar 2026 16:15:37 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b16a:5ed9:4ada:a95a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 2DD2F1ADE; Wed, 25 Mar 2026 16:14:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1774451659; bh=Nh+/HjRT8Ow0xkr2/Ni0Fr/5sJvQgPPeB+GRIqLevtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qILCJV6htDiLKZGrDUUTPSP3ce1t3k+y7+bOLVmxVLJA61worFRKpzmmiTr2lqQPP JFpBDcPzmHzdY4umYIoVVG4MH4mdvlnUCLSnZUYIfWPKO7LdqexIYTlg/PSA9JyxY2 OvPNF0bu3euZCzizAUs5NTapZkOseJWy0LpgvbpI= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Jacopo Mondi Subject: [PATCH v2 20/32] libcamera: v4l2_videodevice: Do not hide frame drops Date: Wed, 25 Mar 2026 16:13:52 +0100 Message-ID: <20260325151416.2114564-21-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" From: Jacopo Mondi Autocorrecting the sequence number in case it doesn't start with 0 produces difficult to debug problems in cases where the first frame got lost. We need to handle these properly in the pipeline handler (and fix kernel drivers if needed). Signed-off-by: Jacopo Mondi Signed-off-by: Stefan Klug --- Changes in v2: - Rewrote commit message. --- include/libcamera/internal/v4l2_videodevice.h | 1 - src/libcamera/v4l2_videodevice.cpp | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 57db0036db6b..de91fbd0f8dc 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -286,7 +286,6 @@ private: EventNotifier *fdBufferNotifier_; State state_; - std::optional firstFrame_; Timer watchdog_; utils::Duration watchdogDuration_; diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index d877df29ee6e..2c911a11dba7 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1904,19 +1904,6 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer() if (V4L2_TYPE_IS_OUTPUT(buf.type)) return buffer; - /* - * Detect kernel drivers which do not reset the sequence number to zero - * on stream start. - */ - if (!firstFrame_.has_value()) { - if (buf.sequence) - LOG(V4L2, Info) - << "Zero sequence expected for first frame (got " - << buf.sequence << ")"; - firstFrame_ = buf.sequence; - } - metadata.sequence -= firstFrame_.value(); - Span framebufferPlanes = buffer->planes(); unsigned int numV4l2Planes = multiPlanar ? buf.length : 1; @@ -1993,8 +1980,6 @@ int V4L2VideoDevice::streamOn() { int ret; - firstFrame_.reset(); - ret = ioctl(VIDIOC_STREAMON, &bufferType_); if (ret < 0) { LOG(V4L2, Error)