STRUCT V4L2_EXPORTBUFFER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct v4l2_exportbuffer β€” Kernel API Manual, bestie edition

okay so real talk, this struct is the one that lets you yeet a video buffer out as a DMABUF file descriptor ✨ it's giving "handoff era" and honestly? iconic.


✨ NAME ✨

struct v4l2_exportbuffer β€” export of video buffer as DMABUF file descriptor πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

struct v4l2_exportbuffer {
    __u32 type;
    __u32 index;
    __u32 plane;
    __u32 flags;
    __s32 fd;
    __u32 reserved[11];
 };

no cap, that's the whole layout πŸ‘‘


🌸 Members 🌸 (yes we're doing every single one, don't scroll)

  • type β€” enum v4l2_buf_type; it's the buffer type, and heads up: type == *_MPLANE means you're in multiplanar buffer territory 🫢
  • index β€” the id number of the buffer, aka which one you're talking about
  • plane β€” index of the plane to be exported; for single plane queues it's just 0
  • flags β€” flags for the newly created file; rn only O_CLOEXEC is supported, so go peek at the manual of the open syscall for the deets πŸ‘€
  • fd β€” the file descriptor associated with DMABUF, and note that the driver sets this one, not you πŸ’œ
  • reserved β€” drivers and applications must zero this array. literally mandatory. zero it. periodt.

πŸ’– Description πŸ’–

so this struct holds the data used for exporting a video buffer as a DMABUF file descriptor. slay.

the buffer is identified by a 'cookie' that VIDIOC_QUERYBUF hands you β€” and it's literally the identical cookie you'd use to mmap the buffer into userspace, iykyk πŸ“

⚠️ every reserved field must be set to zero. all of them. no exceptions, bestie.

and here's the lore: the field reserved0 is expected to become a structure 'type' that would allow an alternative layout of the struct's content. so because of that future glow-up, that field should not be used for any other extensions. do not repurpose it, I'm begging πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/uapi/linux/videodev2.h β€” and the whole friend group:

  • struct v4l2_capability(9)
  • struct v4l2_plane(9)
  • struct v4l2_buffer(9)
  • v4l2_timeval_to_ns(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_create_buffers(9)
  • struct v4l2_remove_buffers(9)

k that's the whole page, go export some buffers responsibly 🌈 this diva lives in ./include/uapi/linux and the version vibes are dated October 2026 β€” mwah, catch you in the next manpage πŸ’‹πŸŽ€

πŸ“¦ where this page comes from