STRUCT MTK_VCODEC_DEC_CTX(9)
π struct mtk_vcodec_dec_ctx(9) β¨
okay bestie, welcome to the Kernel API Manual page for struct mtk_vcodec_dec_ctx π β this is the glow-up doc for the MediaTek vcodec decoder context struct, and we're gonna get through it together, no cap.
πΈ NAME πΈ
struct mtk_vcodec_dec_ctx β Context (instance) private data. that's it, that's the vibe π
β¨ SYNOPSIS β¨
here's the whole struct, laid out exactly as it lives, do not touch, just admire π
struct mtk_vcodec_dec_ctx {
enum mtk_instance_type type;
struct mtk_vcodec_dec_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;
const struct vdec_common_if *dec_if;
void *drv_handle;
struct vdec_pic_info picinfo;
int dpb_size;
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 decode_work;
struct vdec_pic_info last_decoded_picinfo;
struct v4l2_m2m_buffer empty_flush_buf;
bool is_flushing;
u32 current_codec;
u32 capture_fourcc;
enum v4l2_colorspace colorspace;
enum v4l2_ycbcr_encoding ycbcr_enc;
enum v4l2_quantization quantization;
enum v4l2_xfer_func xfer_func;
int decoded_frame_cnt;
struct mutex lock;
int hw_id;
struct vdec_msg_queue msg_queue;
void *vpu_inst;
bool is_10bit_bitstream;
};
π¦ Members π¦
okay now the main character energy part β every single field, explained π«Ά
typeβ the type of decoder instance π«devβ pointer to themtk_vcodec_dec_devof the device. like, which device this baby belongs to.listβ link toctx_listofmtk_vcodec_dec_devπfhβ astruct v4l2_fh. that's the whole description, she's mysterious like that πm2m_ctxβ pointer to thev4l2_m2m_ctxof the contextq_dataβ store information of input and output queue of the context. note the[2], two queues, iconic.idβ index of the context that this structure describes π’stateβ state of the contextdec_ifβ hooked decoder driver interface βdrv_handleβ driver handle for specific decode/encode instancepicinfoβ store picture info after header parsing πΌοΈdpb_sizeβ store dpb count after header parsingint_condβ variable used by the waitqueueint_typeβ type of the last interrupt β‘queueβ waitqueue that can be used to wait for this context to finish. there'sMTK_VDEC_HW_MAXof them, one per hardware bestie πirq_statusβ irq statusctrl_hdlβ handler for v4l2 frameworkdecode_workβ worker for the decoding. get it,work_struct, doing the WORK πͺlast_decoded_picinfoβ pic information get from latest decodeempty_flush_bufβ a fake size-0 capture buffer that indicates flush. Used for stateful decoder. she's fake but she's important πis_flushingβ set totrueif flushing is in progress.current_codecβ current set input codec, in V4L2 pixel formatcapture_fourccβ capture queue type in V4L2 pixel formatcolorspaceβenum v4l2_colorspace; supplemental to pixelformat πycbcr_encβenum v4l2_ycbcr_encoding, Y'CbCr encodingquantizationβenum v4l2_quantization, colorspace quantizationxfer_funcβenum v4l2_xfer_func, colorspace transfer functiondecoded_frame_cntβ number of decoded frames π¬lockβ protect variables accessed by V4L2 threads and worker thread such asmtk_video_dec_buf. respect the lock, fr fr πhw_idβ hardware index used to identify different hardware.msg_queueβ msg queue used to store lat buffer information.vpu_instβ vpu instance pointer.is_10bit_bitstreamβ set totrueif it's 10bit bitstream β
π₯ SEE ALSO π₯
- Kernel file
./drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.hπ struct vdec_pic_info(9),struct mtk_vcodec_dec_pdata(9),struct mtk_vcodec_dec_request(9),struct mtk_vcodec_dec_dev(9)β go read these next bestie, they're all linked up π§
that's the whole page, you ate it up π
β¨ this little gem came from ./drivers/media/platform/media... and it's dated October 2026, so mark your calendars and go forth and decode ππ
π¦ 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