STRUCT MTK_VIDEO_DEC_BUF(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct mtk_video_dec_buf(9) β€” the Kernel API Manual glow-up πŸŽ€

okay so bestie, this is a page from the Kernel API Manual and it's all about one very specific little struct, so grab your iced coffee and let's get into it ✨


🌸 NAME 🌸

struct mtk_video_dec_buf β€” literally the private data that's related to each VB2 buffer. that's it, that's the whole vibe 🫢


✨ SYNOPSIS ✨

here's the shape of it, exactly as it lives, no cap:

struct mtk_video_dec_buf {
    struct v4l2_m2m_buffer  m2m_buf;
    bool used;
    bool queued_in_vb2;
    bool queued_in_v4l2;
    bool error;
    union {
      struct vdec_fb  frame_buffer;
      struct mtk_vcodec_mem   bs_buffer;
    };
 };

look at that anonymous union living its best main character life πŸ’œ


πŸ¦‹ Members πŸ¦‹

  • m2m_buf β€” the M2M buffer. that's the whole description, she's brief and she knows it πŸ’…
  • used β€” capture buffer that contains decoded frame data and is kept in the codec data structure. so like, it's holding the decoded frame tea and staying put in the codec's data structure πŸ“
  • queued_in_vb2 β€” the capture buffer is queued in vb2. yes queen, she's in the queue πŸ‘‘
  • queued_in_v4l2 β€” this capture buffer is sitting in the v4l2 driver but not in the vb2 queue yet. like she's in the group chat but hasn't opened the poll πŸ™ˆ
  • error β€” an unrecoverable error occurs on this buffer. big yikes, it's giving πŸ’€ β€” and note the word unrecoverable, we do not soft-pedal that one
  • {unnamed_union} β€” anonymous. mysterious. iconic 🌈
  • frame_buffer β€” the decode status, plus the buffer information of the capture buffer πŸŽ€
  • bs_buffer β€” output buffer info ⭐

πŸ”₯ {unnamed_union} β€” a lil sub-heading of her own πŸ”₯

so the two members frame_buffer and bs_buffer both live inside that same anonymous union, and they're the two flavours you get depending on what you're looking at:

  • frame_buffer β€” decode status, and buffer information of Capture buffer πŸ’–
  • bs_buffer β€” output buffer info 🌸

πŸ’€ Note πŸ’€

these status information help us track and debug buffer state. fr fr, the status flags are basically the receipts that let you follow what a buffer's been up to and debug it when things go sideways 🧚

ngl bestie, treat those bools like a tiny little state machine β€” used, queued_in_vb2, queued_in_v4l2, error β€” and remember error means an unrecoverable error, so don't go expecting a comeback tour 😭

🌟 SEE ALSO 🌟

  • Kernel file β€” ./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec.h (the struct's home address 🏑)
  • struct vdec_fb(9) β€” go read up on that one too, iykyk πŸ¦‹

and that's the page! πŸ’… this little number came to you straight from the source at ./drivers/media/platform/media... and it's dated October 2026, so mark your calendars and stan responsibly. bye bestie, slay your buffers πŸŒˆβ­πŸŽ€

πŸ“¦ where this page comes from