vb2_core_dqbuf(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– vb2_core_dqbuf(9) πŸ’–

okay bestie, welcome to vb2_core_dqbuf(9) from the Kernel API Manual. This is literally the dequeue-a-buffer-to-userspace moment, and the vibes are immaculate. πŸ’…βœ¨


✨ NAME ✨

vb2_core_dqbuf β€” Dequeue a buffer to the userspace.


🌸 SYNOPSIS 🌸

int vb2_core_dqbuf (struct vb2_queue *q , unsigned int *pindex , void
       *pb , bool nonblocking );

πŸ’… ARGUMENTS πŸ’…

  • q β€” pointer to struct vb2_queue with the videobuf2 queue. That's the main-character queue structure, iykyk. πŸ‘‘
  • pindex β€” pointer to the buffer index. May be NULL. No cap, it's allowed to be NULL. 🫢
  • pb β€” buffer structure passed from userspace to the v4l2_ioctl_ops->vidioc_dqbuf handler in driver. Yes, that exact handler name, bestie. πŸŽ€
  • nonblocking β€” if true, this call will not sleep waiting for a buffer if no buffers ready for dequeuing are present. Normally the driver would be passing (file->f_flags & O_NONBLOCK) here. So if you don't want it to sleep, this is your girl. 😴🚫

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this is the Videobuf2 core helper to implement the VIDIOC_DQBUF operation. It is called internally by VB2 by an API-specific handler, like videobuf2-v4l2.h. Lowkey iconic plumbing. πŸ”₯

This function:

  1. calls the buf_finish callback 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.
  2. the buffer struct members are filled with relevant information for the userspace.

So yeah, callback first if it exists, then the buffer struct gets its relevant info for userspace. Periodt. πŸ’–


⭐ RETURN ⭐

returns zero on success; an error code otherwise.


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/media/videobuf2-core.h, and then the whole squad: enum vb2_memory(9), struct vb2_mem_ops(9), struct vb2_plane(9), enum vb2_io_modes(9), enum vb2_buffer_state(9), struct vb2_buffer(9), struct vb2_ops(9), struct vb2_buf_ops(9), struct vb2_queue(9), vb2_queue_allows_cache_hints(9), vb2_plane_vaddr(9), vb2_plane_cookie(9), vb2_buffer_done(9), vb2_discard_done(9), vb2_wait_for_all_buffers(9), vb2_core_querybuf(9), vb2_core_reqbufs(9), vb2_core_create_bufs(9), vb2_core_prepare_buf(9), vb2_core_remove_bufs(9), vb2_core_qbuf(9), vb2_core_streamon(9), vb2_core_streamoff(9), vb2_core_expbuf(9), vb2_core_queue_init(9), vb2_core_queue_release(9), vb2_queue_error(9), vb2_mmap(9), vb2_get_unmapped_area(9), vb2_core_poll(9), vb2_read(9), vb2_write(9), vb2_thread_fnc(9), vb2_thread_start(9), vb2_thread_stop(9), vb2_is_streaming(9), vb2_fileio_is_active(9), vb2_get_num_buffers(9), vb2_is_busy(9), vb2_get_drv_priv(9), vb2_set_plane_payload(9), vb2_get_plane_payload(9), vb2_plane_size(9), vb2_start_streaming_called(9), vb2_clear_last_buffer_dequeued(9), vb2_get_buffer(9), vb2_buffer_in_use(9), vb2_verify_memory_type(9), vb2_request_object_is_buffer(9), vb2_request_buffer_cnt(9).


mwah πŸ’‹ source vibes: ./include/media; version/date: October 2026. That's the whole vb2_core_dqbuf(9) tea, bestie β€” go dequeue something iconic. 🫢🌈

πŸ“¦ where this page comes from