STRUCT V4L2_CREATE_BUFFERS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct v4l2_create_buffers(9) πŸ’…

okay bestie, so this is a page straight outta the Kernel API Manual β€” it's the man page for struct v4l2_create_buffers(9), and it's literally the argument struct for VIDIOC_CREATE_BUFS. no cap, that's the whole NAME section. let's get into it πŸŽ€


✨ SYNOPSIS ✨

like, here's the shape of it, exactly as it lives in the kernel:

struct v4l2_create_buffers {
    __u32 index;
    __u32 count;
    __u32 memory;
    struct v4l2_format      format;
    __u32 capabilities;
    __u32 flags;
    __u32 max_num_buffers;
    __u32 reserved[5];
 };

look at her. so structured. so organized. main character struct energy fr fr πŸ‘‘


🌸 Members 🌸

  • index β€” on return, this is the index of the first created buffer πŸ’– so like, the kernel hands it back to you after the call.
  • count β€” entry: the number of buffers you're requesting πŸ‘€ that's you telling the kernel how many you want, going in.
  • memory β€” enum v4l2_memory; this is the buffer memory type. pick your vibe.
  • format β€” the frame format that the buffers are being requested for ✨ it's giving "what are these buffers even for."
  • capabilities β€” the capabilities of this buffer type. iykyk.
  • flags β€” extra buffer management attributes πŸ¦‹ but lowkey ignored unless the queue has the V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability and is configured for MMAP streaming I/O. so don't just assume they do something, bestie.
  • max_num_buffers β€” if the V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS capability flag is set, this field indicates the maximum possible number of buffers for this queue πŸ”₯ otherwise it's just sitting there.
  • reserved β€” future extensions 🧚 like, reserved for the kernel girlies of tomorrow. don't touch.
heads up: reserved[5] is literally an array of five. it's reserved, plural, and it's for future extensions. respect her space πŸ™ˆ

⭐ Return ⭐

the return value is the number of created buffers β€” that's it, that's the number. slay.


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./include/uapi/linux/videodev2.h, plus the whole friend group:

  • struct v4l2_capability(9)
  • struct v4l2_plane(9)
  • struct v4l2_buffer(9)
  • v4l2_timeval_to_ns(9)
  • struct v4l2_exportbuffer(9)
  • struct v4l2_selection(9)
  • struct v4l2_plane_pix_format(9)
  • struct v4l2_pix_format_mplane(9)
  • struct v4l2_sdr_format(9)
  • struct v4l2_meta_format(9)
  • struct v4l2_format(9)
  • struct v4l2_event_motion_det(9)
  • struct v4l2_remove_buffers(9)

and that's the page, bestie!! πŸ’œ this one shipped out of ./include/uapi/linux, dated October 2026, and it's literally filed under struct v4l2_create_buffers(9) β€” go create some buffers, you've got this 🫢✨🌈

πŸ“¦ where this page comes from