vb2_queue_change_type(9)
π 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 tostruct vb2_queuewith 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 callvb2_ioctl_reqbufsorvb2_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:
./include/media/videobuf2-v4l2.hstruct 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_dqbuf(9)vb2_streamon(9)vb2_streamoff(9)vb2_queue_init(9)vb2_queue_init_name(9)vb2_queue_release(9)vb2_poll(9)vb2_queue_is_busy(9)vb2_video_unregister_device(9)
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
- 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