STRUCT MTK_VCODEC_ENC_DEV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct mtk_vcodec_enc_dev(9) πŸ’–

okay so this is a page from the Kernel API Manual β€” the struct mtk_vcodec_enc_dev(9) entry, to be exact β€” and bestie, it's basically the master driver-data bag for the MediaTek vcodec encoder. every single thing the encoder driver needs lives in here. let's get into it 🫢


✨ NAME ✨

struct mtk_vcodec_enc_dev β€” driver data

like, that's the whole vibe. it's the driver data struct. main character energy fr fr. πŸ‘‘


🌸 SYNOPSIS 🌸

struct mtk_vcodec_enc_dev {
    struct v4l2_device v4l2_dev;
    struct video_device *vfd_enc;
    struct v4l2_m2m_dev *m2m_dev_enc;
    struct platform_device *plat_dev;
    struct list_head ctx_list;
    struct mtk_vcodec_enc_ctx *curr_ctx;
    void __iomem *reg_base[NUM_MAX_VCODEC_REG_BASE];
    const struct mtk_vcodec_enc_pdata *venc_pdata;
    struct mtk_vcodec_fw *fw_handler;
    u64 id_counter;
    struct mutex enc_mutex;
    struct mutex dev_mutex;
    spinlock_t dev_ctx_lock;
    struct workqueue_struct *encode_workqueue;
    int enc_irq;
    spinlock_t irqlock;
    struct mtk_vcodec_pm pm;
    unsigned int enc_capability;
    struct mtk_vcodec_dbgfs dbgfs;
 };

look at that field list. it's giving organized. it's giving "i know what i'm doing." πŸ’…


πŸŽ€ Members πŸŽ€

one by one, no skips, no cap:

  • v4l2_dev β€” the V4L2 device you register video devices for. the official V4L2 plug. πŸ”Œ
  • vfd_enc β€” video device for the encoder. this is literally the encoder's video node.
  • m2m_dev_enc β€” m2m device for the encoder. memory-to-memory, obviously. ✨
  • plat_dev β€” platform device. hello platform device, welcome to the struct.
  • ctx_list β€” list of struct mtk_vcodec_ctx. all the contexts, listed. πŸ’œ
  • curr_ctx β€” the context that is waiting for codec hardware. yes, that one. it's waiting its turn like a good little context 😭
  • reg_base β€” mapped address of MTK Vcodec registers. it's an array: NUM_MAX_VCODEC_REG_BASE of void __iomem *, lowkey iconic.
  • venc_pdata β€” encoder IC-specific data. per-chip deets, const struct mtk_vcodec_enc_pdata * style. πŸ“
  • fw_handler β€” used to communicate with the firmware. the firmware's dedicated little messenger. πŸ¦‹
  • id_counter β€” used to identify the current opened instance. a u64, so it can count for, like, forever.
  • enc_mutex β€” encoder hardware lock. touch the hardware without it and you're gonna have a bad time πŸ’€
  • dev_mutex β€” video_device lock. that's the lock, for the video_device. πŸŽ€
  • dev_ctx_lock β€” the lock of the context list. protects ctx_list, literally its whole job.
  • encode_workqueue β€” encode work queue. struct workqueue_struct *, doing the actual work-scheduling thing. πŸ”₯
  • enc_irq β€” h264 encoder irq resource. it's an int, it's the irq, it's for h264. that's the whole sentence.
  • irqlock β€” protect data access by irq handler and work thread. a spinlock_t keeping those two from stepping on each other πŸ™ˆ
  • pm β€” power management control. a struct mtk_vcodec_pm, handling the power side of life. ⚑
  • enc_capability β€” used to identify encode capability. an unsigned int of pure "what can this thing actually do." 🌈
  • dbgfs β€” debug log related information. a struct mtk_vcodec_dbgfs, for when you need to see what's going on in there. ⭐
ngl bestie, the two spinlocks plus the two mutexes are the whole personality of this struct β€” everything else is just bookkeeping. protect your data, periodt. πŸ’…

🌟 SEE ALSO 🌟

go look at these if you want the full cinematic universe:

  • Kernel file ./drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
  • struct mtk_vcodec_enc_pdata(9)
  • struct mtk_enc_params(9)
  • struct mtk_vcodec_enc_ctx(9)

and that's the page!! πŸ’– this one came out of ./drivers/media/platform/media... dated October 2026, and it's filed under struct mtk_vcodec_enc_dev(9) β€” so when you see that footer in the wild, you'll know exactly who she is. slay, go read the headers, ily, bye πŸ§šβœ¨πŸŽ€

πŸ“¦ where this page comes from