STRUCT V4L2_M2M_DEV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” a struct media_entity pointer holding the source entity. ngl, this one is only used when the M2M device is registered via v4l2_m2m_register_media_controller. conditional queen πŸŽ€
  • source_pad β€” a struct media_pad for the source pad. same deal: only used when the M2M device is registered via v4l2_m2m_register_media_controller.
  • sink β€” a struct media_entity pointer holding the sink entity. also only used when the M2M device is registered via v4l2_m2m_register_media_controller.
  • sink_pad β€” a struct media_pad for the sink pad. yep, you guessed it: only used when the M2M device is registered via v4l2_m2m_register_media_controller.
  • proc β€” a struct media_entity pointer that holds the M2M device itself. she's her own entity, honestly iconic ⭐
  • proc_pads β€” a struct media_pad for the proc pads. only used when the M2M device is registered via v4l2_m2m_unregister_media_controller. (yes, that's what it says β€” unregister, i'm just the messenger πŸ’€)
  • intf_devnode β€” a struct media_intf_devnode pointer 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 β€” protects job_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 πŸ¦‹

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 name struct v4l2_m2m_dev(9) every single time πŸ‘‘βœ¨

k bye, go write a driver, love u πŸ’–πŸ§š

πŸ“¦ where this page comes from