STRUCT MTK_VCODEC_DEC_CTX(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the mtk_vcodec_dec_dev of the device. like, which device this baby belongs to.
  • list β€” link to ctx_list of mtk_vcodec_dec_dev πŸ”—
  • fh β€” a struct v4l2_fh. that's the whole description, she's mysterious like that πŸ™ˆ
  • m2m_ctx β€” pointer to the v4l2_m2m_ctx of the context
  • q_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 context
  • dec_if β€” hooked decoder driver interface βš“
  • drv_handle β€” driver handle for specific decode/encode instance
  • picinfo β€” store picture info after header parsing πŸ–ΌοΈ
  • dpb_size β€” store dpb count after header parsing
  • int_cond β€” variable used by the waitqueue
  • int_type β€” type of the last interrupt ⚑
  • queue β€” waitqueue that can be used to wait for this context to finish. there's MTK_VDEC_HW_MAX of them, one per hardware bestie πŸ’œ
  • irq_status β€” irq status
  • ctrl_hdl β€” handler for v4l2 framework
  • decode_work β€” worker for the decoding. get it, work_struct, doing the WORK πŸ’ͺ
  • last_decoded_picinfo β€” pic information get from latest decode
  • empty_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 to true if flushing is in progress.
  • current_codec β€” current set input codec, in V4L2 pixel format
  • capture_fourcc β€” capture queue type in V4L2 pixel format
  • 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
  • decoded_frame_cnt β€” number of decoded frames 🎬
  • lock β€” protect variables accessed by V4L2 threads and worker thread such as mtk_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 to true if 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