STRUCT VB2_BUF_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 a vb2_buffer, initialize the extra data after struct vb2_buffer. for V4L2 specifically, that extra data is a struct vb2_v4l2_buffer πŸ’– she's setting up the bonus content.
  • fill_user_buffer β€” given a vb2_buffer, fill in the userspace structure. for V4L2, the userspace structure in question is a struct v4l2_buffer. filling her in, respectfully πŸ™ˆ
  • fill_vb2_buffer β€” the reverse direction, bestie! given a userspace structure, fill in the vb2_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 the struct 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:

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