v4l2_m2m_src_buf_remove(9)
π v4l2_m2m_src_buf_remove π
okay so bestie, welcome to the Kernel API Manual β yes it's a whole manual, and yes this page is literally just about taking a buffer off a list and handing it back. tiny function, big main character energy. let's go π«Ά
β¨ NAME β¨
v4l2_m2m_src_buf_remove β bestie, this one takes off a source buffer from the list of ready buffers and returns it. that's the whole gig. it's giving "bouncer at the club, but the club is a linked list" π
π¦ SYNOPSIS π¦
struct vb2_v4l2_buffer * v4l2_m2m_src_buf_remove (struct v4l2_m2m_ctx
*m2m_ctx );
like, look at that return type. struct vb2_v4l2_buffer * β a pointer, we're getting the actual buffer back, not a copy. obsessed β¨
π ARGUMENTS π
m2m_ctxβ the m2m context assigned to the instance, given to you bystruct v4l2_m2m_ctx. this is the β¨contextβ¨ (literally) β hand it over and the function knows which list it's working with. no cap.
π SEE ALSO π
okay this is the part where the manpage goes absolutely feral with cross-references, and honestly? it ate. there are so many of them, so let's do this in chunks, iykyk π
the kernel file itself, first:
Kernel file ./include/media/v4l2-mem2mem.h
then the structs (the friend group π):
struct v4l2_m2m_ops(9)struct v4l2_m2m_queue_ctx(9)struct v4l2_m2m_ctx(9)struct v4l2_m2m_buffer(9)
the core context / scheduling girlies:
v4l2_m2m_get_curr_priv(9)v4l2_m2m_get_vq(9)v4l2_m2m_try_schedule(9)v4l2_m2m_job_finish(9)v4l2_m2m_buf_done_and_job_finish(9)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)v4l2_m2m_last_buffer_done(9)v4l2_m2m_suspend(9)v4l2_m2m_resume(9)
the ioctl-coded squad (reqbufs, qbuf, dqbuf, we love a queue π):
v4l2_m2m_reqbufs(9)v4l2_m2m_querybuf(9)v4l2_m2m_qbuf(9)v4l2_m2m_dqbuf(9)v4l2_m2m_prepare_buf(9)v4l2_m2m_create_bufs(9)v4l2_m2m_expbuf(9)v4l2_m2m_streamon(9)v4l2_m2m_streamoff(9)v4l2_m2m_update_start_streaming_state(9)v4l2_m2m_update_stop_streaming_state(9)v4l2_m2m_encoder_cmd(9)v4l2_m2m_decoder_cmd(9)v4l2_m2m_poll(9)v4l2_m2m_mmap(9)
lifecycle icons β init, release, get, put, ctx things β¨:
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)
buffer-queue brainrot (affectionate) π§:
the next/last peekers π:
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)
the iterator loops (for each, but make it fashion):
v4l2_m2m_for_each_dst_buf(9)v4l2_m2m_for_each_src_buf(9)v4l2_m2m_for_each_dst_buf_safe(9)v4l2_m2m_for_each_src_buf_safe(9)
the videobuf queues:
and the buffer-remove family β this function's literal siblings, plus a metadata copy friend π:
v4l2_m2m_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)v4l2_m2m_buf_copy_metadata(9)
fr fr a little reminder: this page only documents taking a source buffer off the ready list and returning it. the dst versions are their own whole thing, don't mix them up bestie π
and that's the whole page!! short, sweet, and absolutely iconic for a kernel function π
sign-off time: this masterpiece lives in ./include/media, it's stamped October 2026, and it answers to the name v4l2_m2m_src_buf_remove(9) β under the umbrella of that Kernel API Manual we mentioned up top. mwah, go remove some buffers 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