STRUCT MTK_VCODEC_ENC_CTX(9)
๐ธ struct mtk_vcodec_enc_ctx(9) ๐ธ
okay so bestie, welcome to the Kernel API Manual ๐ this page is all about struct mtk_vcodec_enc_ctx โ literally the private data for one context (a whole instance, like a whole little world ๐). yes it's a C struct, yes it's iconic, no you can't skip it.
โจ NAME โจ
struct mtk_vcodec_enc_ctx โ the context (instance) private data. that's it, that's the vibe ๐
it's the per-instance bag of holding for MediaTek's encoder.
๐ SYNOPSIS ๐
here's the whole thing, character for character, do not touch, she's perfect:
struct mtk_vcodec_enc_ctx {
enum mtk_instance_type type;
struct mtk_vcodec_enc_dev *dev;
struct list_head list;
struct v4l2_fh fh;
struct v4l2_m2m_ctx *m2m_ctx;
struct mtk_q_data q_data[2];
int id;
enum mtk_instance_state state;
enum mtk_encode_param param_change;
struct mtk_enc_params enc_params;
const struct venc_common_if *enc_if;
void *drv_handle;
int int_cond[MTK_VDEC_HW_MAX];
int int_type[MTK_VDEC_HW_MAX];
wait_queue_head_t queue[MTK_VDEC_HW_MAX];
unsigned int irq_status;
struct v4l2_ctrl_handler ctrl_hdl;
struct work_struct encode_work;
struct v4l2_m2m_buffer empty_flush_buf;
bool is_flushing;
enum v4l2_colorspace colorspace;
enum v4l2_ycbcr_encoding ycbcr_enc;
enum v4l2_quantization quantization;
enum v4l2_xfer_func xfer_func;
struct mutex q_mutex;
void *vpu_inst;
};
๐ Members ๐
๐ฆ the basics
typeโ what kind of encoder instance this is. the personality type of the instance, if you will โจdevโ pointer to themtk_vcodec_enc_devof the device. the parent, the home base, the main character ๐listโ link toctx_listofmtk_vcodec_enc_dev. it's how this ctx hangs out with all the other ctxs ๐ซถfhโ astruct v4l2_fh. justโฆ there. slaying quietly ๐m2m_ctxโ pointer to thev4l2_m2m_ctxof the context. mem2mem brain.q_dataโ store information of input and output queue of the context. two of them ([2]), because input AND output, duh ๐idโ index of the context that this structure describes. her little name tag ๐ท๏ธstateโ state of the context. mood ring, basically ๐ฎ
๐ the encoding stuff
param_changeโ indicate encode parameter type. flags which kind of encode params changed, no cap.enc_paramsโ encoding parameters. the actual seasoning in the soup ๐enc_ifโ hooked encoder driver interface. the plug, the connector, theconst struct venc_common_if *girly.drv_handleโ driver handle for specific decode/encode instance. yes the manpage literally says "decode/encode" โ we do not edit โ๏ธ
๐ฅ interrupts & waiting
int_condโ variable used by the waitqueue.int_typeโ type of the last interrupt. she remembers the last interrupts, both arrays are[MTK_VDEC_HW_MAX]sized btw โญqueueโ waitqueue that can be used to wait for this context to finish. also[MTK_VDEC_HW_MAX], also iconic.irq_statusโ irq status. that's the whole description, she's mysterious like that ๐
๐ v4l2 framework corner
ctrl_hdlโ handler for v4l2 framework. the control freak (affectionate) ๐encode_workโ worker for the encoding. she works, she's astruct work_struct, we respect her ๐ซกempty_flush_bufโ a fake size-0 capture buffer that indicates flush. Used for encoder. it's fake but it's doing her best ๐ญ honestly a legend for that.is_flushingโ set totrueif flushing is in progress. true girlies set it, false girliesโฆ also possible ๐ฝโจ
๐ colorspace lore (do NOT skip, I know you want to)
colorspaceโenum v4l2_colorspace; supplemental to pixelformat.ycbcr_encโenum v4l2_ycbcr_encoding, Y'CbCr encoding.quantizationโenum v4l2_quantization, colorspace quantization.xfer_funcโenum v4l2_xfer_func, colorspace transfer function.
like yes it's four whole enum fields but they're besties and they come as a set ๐
๐ธ the last two
q_mutexโ vb2_queue mutex. lock her before you touch her, mutual respect ๐vpu_instโ vpu instance pointer. final member energy, main character exit ๐
โญ SEE ALSO โญ
go read these next, bestie, iykyk:
- 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_dev(9)
also, just so we're clear: the manpage footer literally shows the source as ./drivers/media/platform/media... โ truncated and everything, that's the actual original text, we are NOT fixing it ๐ซถ
okay that's the page!! this was struct mtk_vcodec_enc_ctx(9), from the Kernel API Manual, the source/version line being ./drivers/media/platform/media... and the date October 2026 (futuristic icon behavior, honestly ๐ฅ). mwah, go encode something, bestie ๐๐โจ
๐ฆ 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