STRUCT VB2_PLANE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct vb2_plane(9) β€” plane information ✨

okay bestie, so this is a page from the Kernel API Manual, section 9, and it's all about struct vb2_plane β€” literally just plane information. that's the whole NAME. short king behavior but make it kernel. πŸŽ€


🌸 NAME 🌸

struct vb2_plane β€” plane information. periodt.


✨ SYNOPSIS ✨

the whole struct, character for character, no notes:

struct vb2_plane {
    void *mem_priv;
    struct dma_buf          *dbuf;
    unsigned int            dbuf_mapped;
    bool dbuf_duplicated;
    unsigned int            bytesused;
    unsigned int            length;
    unsigned int            min_length;
    union {
      unsigned int    offset;
      unsigned long   userptr;
      int fd;
    } m;
    unsigned int            data_offset;
 };

🫢 Members 🫢

  • mem_priv β€” the private data that belongs to this plane. just vibes and secrets, kept private. πŸ™ˆ
  • dbuf β€” a dma_buf, aka the shared buffer object.
  • dbuf_mapped β€” a flag that shows whether dbuf is mapped or not. yes/no energy. πŸ’…
  • dbuf_duplicated β€” a boolean showing whether dbuf is duplicated with a previous plane of the buffer. like, is this the same fit as before? πŸ‘€
  • bytesused β€” the number of bytes occupied by data in the plane. that's the payload, bestie. πŸ”₯
  • length β€” the size of this plane in bytes β€” and NOT the payload, okay, don't get it twisted. the maximum valid size is MAX_UINT - PAGE_SIZE.
  • min_length β€” the minimum required size of this plane in bytes (also NOT the payload). length is always greater than or equal to min_length, and like length, it is limited to MAX_UINT - PAGE_SIZE. the floor, if you will. ⭐
  • m β€” the union holding memtype-specific data. choose your fighter. 🌈
    • m.offset β€” when the memory in the associated struct vb2_buffer is VB2_MEMORY_MMAP, this equals the offset from the start of the device memory for this plane. (or it's a "cookie" that should be passed to mmap called on the video node. a lil cookie. πŸ“)
    • m.userptr β€” when the memory is VB2_MEMORY_USERPTR, this is a userspace pointer pointing to this plane.
    • m.fd β€” when the memory is VB2_MEMORY_DMABUF, this is a userspace file descriptor associated with this plane.
  • data_offset β€” the offset in the plane to the start of data; usually 0, unless there's a header in front of the data. highkey the header is gatekeeping the data. πŸ’€

πŸ¦‹ Description πŸ¦‹

this struct should contain enough information to be able to cover all the fields of struct v4l2_plane at videodev2.h. like, all of them. no field left behind. πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘

start with the kernel file ./include/media/videobuf2-core.h, then the whole friend group: enum vb2_memory(9), struct vb2_mem_ops(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_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).

that's the whole group chat, bestie. iykyk. 🧚


ngl this page lives in ./include/media and it's dated October 2026 β€” so yeah, it's giving from the future, and the whole thing is literally titled struct vb2_plane(9). slay. πŸ’œ
πŸ“¦ where this page comes from