From nobody Sun Apr 19 09:26:57 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2457532570E for ; Tue, 17 Feb 2026 11:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771326795; cv=none; b=IyqRcLzoSOpv8AgOwU/Ac+nrFKiw2DOQrmhUtNOWNtgP+ZoyN2+aew5+BOBeB+/mEsR7NmrykQfw9GThbZOxonz1Zpmll5jJkBxKHawjM7xNvPuJM6ElR8rmIyeO8tD280emwQ21oXhN7jhE9bvCAv6l6UVEa8HFDVoyu1/AWps= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771326795; c=relaxed/simple; bh=SsGuto8yJkPG0DYbaQpL/SuujE+DEYu+cfNNyFvziIs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oSxrHD3VwP/WOn0xXD7phJsIWM7fvGk7doa8t3vrdjaTZeJRZxEqmZtrsHLCGQ3S62qLLU0DyZwGgtj+HrRoeFBTt93KRJSM+tL3jo9RSe1FqVe4Nur9ryFWkUC9F15Yb2De07cwgE1TZOupA1RzOECXti8oHvaiJdIgL8VRBKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JuVFbrpd; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JuVFbrpd" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4837991d1e1so3012525e9.0 for ; Tue, 17 Feb 2026 03:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771326792; x=1771931592; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sPm7m9zp86N9ephLPNUzwVLOIxxpQJ735TcWub5eC2k=; b=JuVFbrpdEWOVVMeqTcMVx0hUUcNtEUm0xn+aAriJUa1Pd+zIQ25xiLg70t+LTfwMjy AA2Z+TLxHTK0kt3qo6MkBZVvUiEbmJnNp35K0K6RsJ6m93Mp+jN7qKJpnfK5s9vwkRSk /bqAX0gh7CzbsjSuv4DywEg14nWGOgBViiTsGrXiKWyeqKqsqoeE6Ohv8kZS6ZnIPDuy FPMHtXpST9sOrLhWj6IBc+r/Zpl6QNmTiHJZFisMIaRglMW/7WwmQL065SwO069KPqQq Gbw9cwwU8Xx0FMDhUbDatMZ90qAlqe6y0lIFwTNl8LdxlIk3bozX3AutMzGDMeWzx9Yy IE6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771326792; x=1771931592; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sPm7m9zp86N9ephLPNUzwVLOIxxpQJ735TcWub5eC2k=; b=tjLzARUsPwKBK8oOU4OPNn5kd9Izv90BmOQZiGNeiWdPvllckSG7x9h4JUopXFtee0 lm6iWJUli2GTcjMR3PsTHMhtj5DApleqVJcQ5Yrr5GJRCSLNStkLfacIbvFTz4E3fvR+ MH/m1uESo+k+QJMSySo3VhmiIOk7OvycNWffGo97MDkCNAKzC8y3JaEr+kSf3QLQBlr/ YyQoaSJ2ogJN4ELKR+fnjWh+eegu6/01aDYleQJUkS8P/5+nSXTCa4mtAN0JXNDvg2GC zaqSqsTz5wdnAXuWof/FKX37Q1cKLEmfDjhnRRuBe5VkBQjfsjVACpBDlrVfFtKjFJ6z dAsA== X-Gm-Message-State: AOJu0YyZ8g93L1Ib9OAfd7hY7viDPgPffPAyJ4g8pm4C6bbZuHsZH+Qg 8nktJluVvNPQ7Embwlp1/t7HNzTUY2qZquU9lKws3Vv3BLetjErq/hUklb0DsjJA X-Gm-Gg: AZuq6aLlveQqcSYTCDz0mVJKn1170wri9cA1d7Cg0Jne7p6nY7wFOczqGcT7YFXzIeW kwaYmQaGBSLlgi49Nsg7BAuJojOuUXXRSIJypHC0N+HooetgpDeITF7PQWN6mRaBpVsBpqVAoRr rZO06eAyKLDiMgA9G9G8wWXEDjj/9Wc07jiZNFL00rEuCEyaAEzTnn/CalEJ3EHKfLw0EElsQjm 0HdyfgwRWeoDnuNpCKhqLIW/oc/ghU5TzKCcpEnM6VAASP3kRdaKdfAOAwcjjDXFMIr9RH1s1ed WqhGMVuVB6eL5pC6zm5RUb1G1A6aimy4UQ4xj1kZX3Y4s2dnPSjxsj27GPh+7fpXPOZhO1jYuu5 vXE06H4uMbPimvEUJvxjypFfD2TIJ0ri056fFGkOm1n+YqzZWEHI1yQ8gfzd8vUVXw2GJz51Sxs rlYWnUNB/sT1lqOG2auSqh7smMp34/hA775cFeje/aTtnlo7I1z7bn45YY8YG/90Hr X-Received: by 2002:a05:600c:6986:b0:483:816b:67cf with SMTP id 5b1f17b1804b1-483816b693dmr80876605e9.4.1771326791558; Tue, 17 Feb 2026 03:13:11 -0800 (PST) Received: from rivka-VirtualBox.. ([147.234.64.73]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4835d99497asm691886895e9.6.2026.02.17.03.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Feb 2026 03:13:11 -0800 (PST) From: Rivka S To: linux-kernel@vger.kernel.org Cc: Rivka S Subject: [PATCH] v4l2-utils: libv4l2: Remove unconditional sleep after STREAMOFF and enable REQBUFS(count=0) Date: Tue, 17 Feb 2026 13:11:49 +0200 Message-ID: <20260217111147.16730-4-s0533160580@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove the unconditional sleep(1) after VIDIOC_STREAMOFF and enable the REQBUFS(count=3D0) call when freeing buffers. The current implementation calls sleep(1) after STREAMOFF with a FIXME comment suggesting a need to ensure that all buffers have stopped. However, the videobuf2 implementation documents that vb2_core_streamoff() cancels the queue and removes all buffers from the driver and vb2, returning control to userspace as part of the stream stop procedure. Since STREAMOFF already performs queue cancellation, remove the additional sleep delay as is it unnecessary and does not provide deterministic synchronization. Re-enable the REQBUFS(count=3D0) call, which was previously disabled due to historical limitations in the old video-buf implementation. Modern buffer frameworks expect this ioctl to release all buffers as defined by the V4L2 API. Signed-off-by: Rivka S --- utils/libv4l2util/v4l2_driver.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/utils/libv4l2util/v4l2_driver.c b/utils/libv4l2util/v4l2_drive= r.c index c9560326..28fc1bcf 100644 --- a/utils/libv4l2util/v4l2_driver.c +++ b/utils/libv4l2util/v4l2_driver.c @@ -569,17 +569,11 @@ int v4l2_free_bufs(struct v4l2_driver *drv) if (xioctl(drv->fd,VIDIOC_STREAMOFF,&drv->reqbuf.type)<0) return errno; =20 - sleep (1); // FIXME: Should check if all buffers are stopped =20 -/* V4L2 API says REQBUFS with count=3D0 should be used to release buffer. - However, video-buf.c doesn't implement it. - */ -#if 0 if (xioctl(drv->fd,VIDIOC_REQBUFS,&drv->reqbuf)<0) { perror("reqbufs while freeing buffers"); return errno; } -#endif =20 if (drv->reqbuf.count !=3D 0) { fprintf(stderr,"REQBUFS returned %d buffers while asking for freeing it!= \n", --=20 2.43.0