vb2_queue_change_type(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… vb2_queue_change_type πŸ’…

ok so this is a page from the Kernel API Manual, bestie β€” we're literally in kernel land today, and this function is lowkey iconic. πŸŽ€


✨ NAME ✨

vb2_queue_change_type β€” changes the type of an inactive vb2_queue πŸ¦‹

Like, it swaps the vibe of the queue's type β€” but only when nothing's going on. Noted. πŸ”₯


🌸 SYNOPSIS 🌸

int vb2_queue_change_type (struct vb2_queue *q , unsigned int type );

πŸŽ€ ARGUMENTS πŸŽ€

  • q β€” pointer to struct vb2_queue with videobuf2 queue. this is the queue we're doing a little makeover on πŸ’…
  • type β€” the type to change to (V4L2_BUF_TYPE_VIDEO_*). yes bestie, it must be one of those ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” this function changes the type of the vb2_queue. but there's a catch, and the catch is giving "you can only do this when the queue is free": it's only possible if the queue is not busy (i.e. no buffers have been allocated). no buffers = green light, bestie. buffers = not today. 😭

the way that vb2_queue_change_type is used? it's for supporting multiple buffer types using the same queue β€” one queue, many looks, we love a versatile icon πŸ‘‘

so like, the driver can implement the v4l2_ioctl_ops.vidioc_reqbufs and v4l2_ioctl_ops.vidioc_create_bufs functions and call vb2_queue_change_type before calling vb2_ioctl_reqbufs or vb2_ioctl_create_bufs β€” and boom, that "locks" the buffer type until the buffers have been released. πŸ”’ periodt. that's the whole strategy and honestly it ate. 🌈

ngl the ordering matters: change the type first, then call vb2_ioctl_reqbufs or vb2_ioctl_create_bufs. miss that and you're giving chaotic energy, not main character energy. πŸ’€

πŸ’œ SEE ALSO πŸ’œ

all the besties this function hangs out with 🫢 β€” first up, the kernel file:

like, read them. or don't. but they're there. πŸ’–


ok that's the whole page, you're so welcome 🧚 and before you go β€” this cutie lives in ./include/media, and the page is dated October 2026 ⭐ mwah, stan kernel docs, byeeeee πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from