From patchwork Mon Sep 14 14:02:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28254 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 378CEC3272 for ; Mon, 14 Sep 2026 14:03:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 32CD2686B0; Mon, 14 Sep 2026 16:03:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="NZOusl8p"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65DCB686B0 for ; Mon, 14 Sep 2026 16:03:54 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:a279:75fa:1f6c:7f40]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6688A1B39; Mon, 14 Sep 2026 16:02:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1789394534; bh=EtkQjgTmtJNbfQKzGd9nS/igUdSJBUS5yVnj7iChuKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZOusl8pmIjLSLE1clB85/1th5ZKmsiSy3Tsj4mZ6TWL2CNAXnCvonuOL3ql5nIAF hH62ZoKa/iegkP4mrQNNwV4LmHZvLSvksMW5Qw1ofdl/vJwe+T26amYeKRaQzmY8ZC l2Yu0HVr+KEX6tMvOhUOA7i+2zDRNby7Z/uVRBRE= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Jacopo Mondi Subject: [PATCH v3 10/41] libcamera: v4l2_videodevice: Do not hide frame drops Date: Mon, 14 Sep 2026 16:02:23 +0200 Message-ID: <20260914140309.3354666-11-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" 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 f63d74879ff2..cc962bf81187 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -286,7 +286,6 @@ private: std::unique_ptr 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 41dc5d0f65ed..807107f99a03 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1902,19 +1902,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(); - std::span framebufferPlanes = buffer->planes(); unsigned int numV4l2Planes = multiPlanar ? buf.length : 1; @@ -1991,8 +1978,6 @@ int V4L2VideoDevice::streamOn() { int ret; - firstFrame_.reset(); - ret = ioctl(VIDIOC_STREAMON, &bufferType_); if (ret < 0) { LOG(V4L2, Error)