STRUCT MTK_VCODEC_ENC_DEV(9)
π 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 ofstruct 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_BASEofvoid __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. au64, 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. protectsctx_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 anint, it's the irq, it's for h264. that's the whole sentence.irqlockβ protect data access by irq handler and work thread. aspinlock_tkeeping those two from stepping on each other πpmβ power management control. astruct mtk_vcodec_pm, handling the power side of life. β‘enc_capabilityβ used to identify encode capability. anunsigned intof pure "what can this thing actually do." πdbgfsβ debug log related information. astruct 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
- 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