v4l2_m2m_buf...d_job_finish(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… v4l2_m2m_buf_done_and_job_finish β€” bestie's guide to the Kernel API Manual ✨

okay so real talk, this one is from the Kernel API Manual, and it's lowkey the function you call when you're DONE done with a job and you need everything to wrap up cute πŸŽ€


✨ NAME ✨

v4l2_m2m_buf_done_and_job_finish β€” hands back your source and destination buffers with their state, tells the framework the job is finished, and lets it do the lil cleanup dance πŸ§ΉπŸ’–


🌸 SYNOPSIS 🌸

void v4l2_m2m_buf_done_and_job_finish (struct v4l2_m2m_dev *m2m_dev ,
struct v4l2_m2m_ctx *m2m_ctx , enum vb2_buffer_state state );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • m2m_dev β€” an opaque pointer to the internal data that handles the M2M context. like, you're not supposed to peek inside, it's giving mystery ✨
  • m2m_ctx β€” the m2m context assigned to the instance, handed to you as a struct v4l2_m2m_ctx. this is your context, main character energy πŸ‘‘
  • state β€” the vb2 buffer state, passed straight on to v4l2_m2m_buf_done. (so it's a little relay race πŸƒβ€β™€οΈ)

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜• β€” drivers that set V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF must use this function instead of job_finish, because they need to take held buffers into account. for every other driver it's optional, no pressure bestie 🫢

what it does, step by step, no cap:

  1. it removes the source buffer from the ready list and returns it with the given state.
  2. same thing for the destination buffer β€” unless that buffer is marked 'held'. in that case it just stays on the ready list, chillin' 😎
  3. after all that, the job is finished (see job_finish).

and why do we even do this?? because it lets multiple output buffers be used to fill in a single capture buffer 🎯. this is typically used by stateless decoders, where multiple e.g. H.264 slices contribute to a single decoded frame. literally teamwork makes the dream work πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/media/v4l2-mem2mem.h, plus the whole friend group πŸ‘‡


and that's the whole page bestie, go forth and finish your jobs responsibly πŸ’…βœ¨

β€” signed off from ./include/media, October 2026, living inside the Kernel API Manual as v4l2_m2m_buf...d_job_finish(9) πŸ¦‹πŸ’–πŸŽ€

πŸ“¦ where this page comes from