mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rivka S <s0533160580@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Rivka S <s0533160580@gmail.com>
Subject: [PATCH] v4l2-utils: libv4l2: Remove unconditional sleep after STREAMOFF and enable REQBUFS(count=0)
Date: Tue, 17 Feb 2026 13:11:49 +0200	[thread overview]
Message-ID: <20260217111147.16730-4-s0533160580@gmail.com> (raw)

Remove the unconditional sleep(1) after VIDIOC_STREAMOFF and
enable the REQBUFS(count=0) 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=0) 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 <s0533160580@gmail.com>
---
 utils/libv4l2util/v4l2_driver.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/utils/libv4l2util/v4l2_driver.c b/utils/libv4l2util/v4l2_driver.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;
 
-	sleep (1);	// FIXME: Should check if all buffers are stopped
 
-/* V4L2 API says REQBUFS with count=0 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
 
 	if (drv->reqbuf.count != 0) {
 		fprintf(stderr,"REQBUFS returned %d buffers while asking for freeing it!\n",
-- 
2.43.0


                 reply	other threads:[~2026-02-17 11:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260217111147.16730-4-s0533160580@gmail.com \
    --to=s0533160580@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®