vb2_dqbuf(9)
π vb2_dqbuf β like, the Kernel API Manual page, bestie β¨
Okay so welcome to vb2_dqbuf(9), bestie. Yes that's the whole title, and yes it's from the Kernel API Manual. Sit down, grab a strawberry π, we're learning how to dequeue a buffer to userspace.
πΈ NAME πΈ
vb2_dqbuf β Dequeue a buffer to the userspace. That's it, that's the whole vibe. It hands a buffer back to userspace. Iconic behavior, no notes. π
β¨ SYNOPSIS β¨
int vb2_dqbuf (struct vb2_queue *q , struct v4l2_buffer *b , bool
nonblocking );
Three args, one int coming back at you. Locked in. π
π ARGUMENTS π
qβ pointer tostruct vb2_queuewith the videobuf2 queue. Like, this is the queue. Your main character queue. π«Άbβ the buffer structure passed from userspace into the driver'sv4l2_ioctl_ops->vidioc_dqbufhandler. It literally did the little journey from userspace to you, respect it. π«nonblockingβ iftrue, this call will not sleep waiting for a buffer when there's, like, no buffers ready for dequeuing present. Zero patience energy, lowkey. Normally the driver would be passing(file->f_flags & O_NONBLOCK)here. fr fr. π΄π«
π DESCRIPTION π
So this one should be called from the v4l2_ioctl_ops->vidioc_dqbuf ioctl handler of a driver. That's the spot. That's where it lives. π
This function does the following, in order, and honestly it ate:
- verifies the passed buffer β vibe check first, always β
- calls the
vb2_ops->buf_finishcallback in the driver (if provided), in which the driver can perform any additional operations that may be required before returning the buffer to userspace, such as cache sync. So like, the driver gets its little moment to do extra stuff before the buffer goes home. π§ - the buffer struct members are filled with relevant information for the userspace. Filled! Stuffed! Delivered! π¦
The return values from this function are intended to be directly returned from the v4l2_ioctl_ops->vidioc_dqbuf handler in the driver. Do not be weird about it, just return them. β
π¦ SEE ALSO π¦
Go look at the kernel file ./include/media/videobuf2-v4l2.h, plus all these besties:
struct vb2_v4l2_buffer(9)vb2_find_buffer(9)vb2_querybuf(9)vb2_reqbufs(9)vb2_create_bufs(9)vb2_prepare_buf(9)vb2_qbuf(9)vb2_expbuf(9)vb2_streamon(9)vb2_streamoff(9)vb2_queue_init(9)vb2_queue_init_name(9)vb2_queue_release(9)vb2_queue_change_type(9)vb2_poll(9)vb2_queue_is_busy(9)vb2_video_unregister_device(9)
The whole friend group, honestly. iykyk. π
That's the page!! Sourced from ./include/media, dated October 2026 β so like, mark your calendars bestie, mwah π, go dequeue some buffers, you're gonna slay π«Άπ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms