STRUCT VB2_BUF_OPS(9)
π struct vb2_buf_ops(9)
okay so bestie, welcome to the Kernel API Manual page for struct vb2_buf_ops β like, the whole entire manual name is right there, we're being official today β¨
π NAME π
struct vb2_buf_ops β driver-specific callbacks. that's it, that's the whole name section. she's short but she's got range π
β¨ SYNOPSIS β¨
here's the struct in all her glory, no cap, copy it exactly:
struct vb2_buf_ops {
int (*verify_planes_array)(struct vb2_buffer *vb, const void *pb);
void (*init_buffer)(struct vb2_buffer *vb);
void (*fill_user_buffer)(struct vb2_buffer *vb, void *pb);
int (*fill_vb2_buffer)(struct vb2_buffer *vb, struct vb2_plane *planes);
void (*copy_timestamp)(struct vb2_buffer *vb, const void *pb);
};
five function pointers. five little besties. each one a whole vibe π¦
πΈ Members πΈ
okay so let's meet the squad, one by one:
verify_planes_arrayβ she's the bouncer πͺ lowkey checks that a given user space structure actually contains enough planes for the buffer. and the way that this gets called for each dequeued buffer? iconic. every single one. no skipping the line, periodt.init_bufferβ given avb2_buffer, initialize the extra data afterstruct vb2_buffer. for V4L2 specifically, that extra data is astruct vb2_v4l2_bufferπ she's setting up the bonus content.fill_user_bufferβ given avb2_buffer, fill in the userspace structure. for V4L2, the userspace structure in question is astruct v4l2_buffer. filling her in, respectfully πfill_vb2_bufferβ the reverse direction, bestie! given a userspace structure, fill in thevb2_buffer. and heads up: if the userspace structure is invalid, then this op will return an error β οΈ like, she's not gonna pretend it's fine.copy_timestampβ copy the timestamp from a userspace structure to thestruct vb2_buffer. that's the whole job. simple, elegant, slays π
π SEE ALSO π
the friend group is huge, ngl, and the kernel file lives at ./include/media/videobuf2-core.h β here's literally everyone:
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_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_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)
fifty of them fr fr. she's connected. iykyk π
ok that's the whole page bestie, go forth and implement your callbacks π
and that's a wrap! this was page struct vb2_buf_ops(9) from the Kernel file at ./include/media, dated October 2026 β mwah, see u next manpage πβ¨π«Ά
π¦ 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