STRUCT V4L2_M2M_DEV(9)
π struct v4l2_m2m_dev(9) β like, the Kernel API Manual era π
okay bestie, sit down, hydrate, and let me tell you about struct v4l2_m2m_dev β the β¨per-device contextβ¨. That's the whole vibe: it's the little home base that holds onto everything one M2M device needs. no cap.
πΈ NAME πΈ
struct v4l2_m2m_dev β per-device context. that's it, that's the name, she's iconic and she knows it π
β¨ SYNOPSIS β¨
here's the whole struct, copied exactly, do not touch, she is perfect as she is:
struct v4l2_m2m_dev {
struct v4l2_m2m_ctx *curr_ctx;
#ifdef CONFIG_MEDIA_CONTROLLER;
struct media_entity *source;
struct media_pad source_pad;
struct media_entity sink;
struct media_pad sink_pad;
struct media_entity proc;
struct media_pad proc_pads[2];
struct media_intf_devnode *intf_devnode;
#endif;
struct list_head job_queue;
spinlock_t job_spinlock;
struct work_struct job_work;
unsigned long job_queue_flags;
const struct v4l2_m2m_ops *m2m_ops;
struct kref kref;
};
like, notice the #ifdef CONFIG_MEDIA_CONTROLLER; chunk in the middle β those media controller fields are lowkey optional, they only exist when that config is on. the rest is always there, fr fr π«Ά
π Members π
okay this is the part where we go field by field, and honestly? every single one of them ate π₯
curr_ctxβ the currently running instance. the main character of the moment, literally.sourceβ astruct media_entitypointer holding the source entity. ngl, this one is only used when the M2M device is registered viav4l2_m2m_register_media_controller. conditional queen πsource_padβ astruct media_padfor the source pad. same deal: only used when the M2M device is registered viav4l2_m2m_register_media_controller.sinkβ astruct media_entitypointer holding the sink entity. also only used when the M2M device is registered viav4l2_m2m_register_media_controller.sink_padβ astruct media_padfor the sink pad. yep, you guessed it: only used when the M2M device is registered viav4l2_m2m_register_media_controller.procβ astruct media_entitypointer that holds the M2M device itself. she's her own entity, honestly iconic βproc_padsβ astruct media_padfor the proc pads. only used when the M2M device is registered viav4l2_m2m_unregister_media_controller. (yes, that's what it says βunregister, i'm just the messenger π)intf_devnodeβ astruct media_intf_devnodepointer to the interface that controls the M2M device. the little remote control of the whole situation ποΈjob_queueβ the instances queued up to run. the group chat of pending jobs.job_spinlockβ protectsjob_queue. she's the bouncer at the door, keeping the queue safe from chaos πͺjob_workβ the worker that runs the queued jobs. the one who actually does the homework.job_queue_flagsβ flags for the queue status,QUEUE_PAUSED. like a "brb" status but for jobs.m2m_opsβ the driver callbacks. the personality of the driver, basically.krefβ the device reference count. keeping track of who's still holding on π«Ά
π¦ SEE ALSO π¦
- Kernel file
./drivers/media/v4l2-core/v4l2-mem2mem.c v4l2_m2m_try_run(9)v4l2_m2m_try_schedule(9)v4l2_m2m_device_run_work(9)v4l2_m2m_cancel_job(9)
go read those next, bestie, you'll be obsessed π
nerdiest possible sign-off: this page lives under./drivers/media/v4l2-core, dated October 2026, and yes she signs her namestruct v4l2_m2m_dev(9)every single time πβ¨
k bye, go write a driver, love u ππ§
π¦ 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