vb2_core_create_bufs(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… vb2_core_create_bufs(9) β€” the buffer-making one

okay bestie, welcome to the Kernel API Manual ✨ this one's a function page from the videobuf2 world, and honestly? it's kind of a big deal. sit down, grab a strawberry πŸ“, and let's get into it.


🌸 NAME 🌸

vb2_core_create_bufs β€” literally just: allocate buffers and any required auxiliary structs. that's it, that's the vibe. πŸŽ€


✨ SYNOPSIS ✨

int vb2_core_create_bufs (struct vb2_queue *q , enum vb2_memory memory ,
unsigned int flags , unsigned int *count , unsigned int requested_planes
, const unsigned int requested_sizes[] , unsigned int *first_index );

look at all those params 😭 she's high-maintenance but she delivers.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • q β€” pointer to struct vb2_queue with the videobuf2 queue. your queue. your main character. πŸ‘‘
  • memory β€” the memory type, as defined by enum vb2_memory.
  • flags β€” auxiliary queue/buffer management flags. little toggles, big responsibilities.
  • count β€” the requested buffer count. how many you want, bestie.
  • requested_planes β€” number of planes requested.
  • requested_sizes β€” array with the size of the planes. one size per plane, don't skip βœ‹
  • first_index β€” index of the first created buffer. and here's the cute math bit: all allocated buffers have indices in the range [first_index..first_index+count-1] 🌈

πŸ’– DESCRIPTION πŸ’–

so this is the Videobuf2 core helper that implements the VIDIOC_CREATE_BUFS operation. it gets called internally by VB2 through an API-specific handler, like videobuf2-v4l2.h. iykyk 🧚

what does this function actually do? three things, and she does them in order:

  1. verifies parameter sanity (vibe check βœ…)
  2. calls the vb2_ops->queue_setup queue operation
  3. performs any necessary memory allocations

periodt. that's the whole pipeline. πŸ’…


πŸ”₯ RETURN πŸ”₯

returns zero on success; an error code otherwise. no cap β€” zero means slay, anything else means something went sideways 😭


⭐ SEE ALSO ⭐

okay this list is long but we're not skipping a single one, that would be disrespectful fr fr. here's the whole squad:

Kernel file ./include/media/videobuf2-core.h along with 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_prepare_buf(9), vb2_core_remove_bufs(9), vb2_core_qbuf(9), vb2_core_dqbuf(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) 🫢

go read all of them. or at least the ones you need. no pressure πŸ’œ


and that's the page!! πŸŽ€ this cutie lives in ./include/media, dated October 2026, straight from the Kernel API Manual β€” mwah, bye bestie, go allocate responsibly πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from