v4l2_m2m_for_each_src_buf(9)
π v4l2_m2m_for_each_src_buf(9) β the Kernel API Manual glow-up
okay bestie, welcome to the Kernel API Manual, section 9, and today's main character is v4l2_m2m_for_each_src_buf. it's a macro. it loops. it's giving "just walk the source-ready list, babe." π¦
β¨ NAME β¨
v4l2_m2m_for_each_src_buf β iterate over a list of source ready buffers
like, literally just loop over your source-ready buffers one by one. that's the whole vibe. no cap. π
πΈ SYNOPSIS πΈ
v4l2_m2m_for_each_src_buf (m2m_ctx , b );
that's it. that's the whole call. two things go in, the loop does its thing. π
π«Ά ARGUMENTS π«Ά
m2m_ctxβ the m2m context assigned to the instance, given bystruct v4l2_m2m_ctx. it's the home base, the main character energy of your mem2mem setup πbβ the current buffer, of typestruct v4l2_m2m_buffer. this is the one you're holding in your hand right now as the loop goes around π
ngl, both of these are required β there's no cute default here, you bring your own context and your own buffer variable. periodt.
π₯ SEE ALSO π₯
okay this is the part where the manpage flexes its entire friend group. every single one of these, no skips, no cap:
- kernel file:
./include/media/v4l2-mem2mem.hβ that's where the magic lives, iykyk π§ - the structs:
struct v4l2_m2m_ops(9),struct v4l2_m2m_queue_ctx(9),struct v4l2_m2m_ctx(9),struct v4l2_m2m_buffer(9) - getting your bearings:
v4l2_m2m_get_curr_priv(9),v4l2_m2m_get_vq(9),v4l2_m2m_get_src_vq(9),v4l2_m2m_get_dst_vq(9) - scheduling & finishing:
v4l2_m2m_try_schedule(9),v4l2_m2m_job_finish(9),v4l2_m2m_buf_done_and_job_finish(9),v4l2_m2m_last_buffer_done(9) - state machine core:
v4l2_m2m_clear_state(9),v4l2_m2m_mark_stopped(9),v4l2_m2m_dst_buf_is_last(9),v4l2_m2m_has_stopped(9),v4l2_m2m_is_last_draining_src_buf(9) - power moves:
v4l2_m2m_suspend(9),v4l2_m2m_resume(9) - the buffer quartet:
v4l2_m2m_reqbufs(9),v4l2_m2m_querybuf(9),v4l2_m2m_qbuf(9),v4l2_m2m_dqbuf(9) - buffer prep squad:
v4l2_m2m_prepare_buf(9),v4l2_m2m_create_bufs(9),v4l2_m2m_expbuf(9) - streaming on/off:
v4l2_m2m_streamon(9),v4l2_m2m_streamoff(9),v4l2_m2m_update_start_streaming_state(9),v4l2_m2m_update_stop_streaming_state(9) - commands & io:
v4l2_m2m_encoder_cmd(9),v4l2_m2m_decoder_cmd(9),v4l2_m2m_poll(9),v4l2_m2m_mmap(9) - lifecycle besties:
v4l2_m2m_init(9),v4l2_m2m_release(9),v4l2_m2m_get(9),v4l2_m2m_put(9),v4l2_m2m_ctx_init(9),v4l2_m2m_ctx_release(9) - queueing:
v4l2_m2m_buf_queue(9),v4l2_m2m_num_src_bufs_ready(9),v4l2_m2m_num_dst_bufs_ready(9) - peeking at buffers:
v4l2_m2m_next_buf(9),v4l2_m2m_next_src_buf(9),v4l2_m2m_next_dst_buf(9),v4l2_m2m_last_buf(9),v4l2_m2m_last_src_buf(9),v4l2_m2m_last_dst_buf(9) - loop siblings (the family π):
v4l2_m2m_for_each_dst_buf(9),v4l2_m2m_for_each_dst_buf_safe(9),v4l2_m2m_for_each_src_buf_safe(9) - removing buffers:
v4l2_m2m_buf_remove(9),v4l2_m2m_src_buf_remove(9),v4l2_m2m_dst_buf_remove(9),v4l2_m2m_buf_remove_by_buf(9),v4l2_m2m_src_buf_remove_by_buf(9),v4l2_m2m_dst_buf_remove_by_buf(9) - metadata:
v4l2_m2m_buf_copy_metadata(9)
the calm-loop energy offor_each_src_bufis unmatched, but if you're out here removing stuff while iterating, go say hi tov4l2_m2m_for_each_src_buf_safe(9)instead, bestie. don't come crying to me at 3am. π
and that's the whole page, mwah π this little lore drop lives in ./include/media, dated October 2026, filed under the v4l2_m2m_for_each_src_buf(9) header β slay, go iterate responsibly π¦β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms