drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c- Extension
.c- Size
- 13555 bytes
- Lines
- 450
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/slab.hmedia/v4l2-mem2mem.hmedia/v4l2-h264.hmedia/videobuf2-dma-contig.h../mtk_vcodec_dec.h../../common/mtk_vcodec_intr.h../vdec_drv_base.h../vdec_drv_if.h../vdec_vpu_if.hvdec_h264_req_common.h
Detected Declarations
struct mtk_h264_dec_slice_paramstruct vdec_h264_dec_infostruct vdec_h264_vsistruct vdec_h264_slice_instfunction get_vdec_decode_parametersfunction allocate_prediction_buffunction free_prediction_buffunction alloc_mv_buffunction free_mv_buffunction get_pic_infofunction get_crop_infofunction get_dpb_sizefunction vdec_h264_slice_initfunction vdec_h264_slice_deinitfunction vdec_h264_slice_decodefunction vdec_h264_slice_get_param
Annotated Snippet
struct mtk_h264_dec_slice_param {
struct mtk_h264_sps_param sps;
struct mtk_h264_pps_param pps;
struct slice_api_h264_scaling_matrix scaling_matrix;
struct slice_api_h264_decode_param decode_params;
struct mtk_h264_dpb_info h264_dpb_info[16];
};
/**
* struct vdec_h264_dec_info - decode information
* @dpb_sz : decoding picture buffer size
* @resolution_changed : flag to notify that a resolution change happened
* @realloc_mv_buf : flag to notify driver to re-allocate mv buffer
* @cap_num_planes : number planes of capture buffer
* @bs_dma : Input bit-stream buffer dma address
* @y_fb_dma : Y frame buffer dma address
* @c_fb_dma : C frame buffer dma address
* @vdec_fb_va : VDEC frame buffer struct virtual address
*/
struct vdec_h264_dec_info {
u32 dpb_sz;
u32 resolution_changed;
u32 realloc_mv_buf;
u32 cap_num_planes;
u64 bs_dma;
u64 y_fb_dma;
u64 c_fb_dma;
u64 vdec_fb_va;
};
/**
* struct vdec_h264_vsi - shared memory for decode information exchange
* between VPU and Host.
* The memory is allocated by VPU then mapping to Host
* in vpu_dec_init() and freed in vpu_dec_deinit()
* by VPU.
* AP-W/R : AP is writer/reader on this item
* VPU-W/R: VPU is write/reader on this item
* @pred_buf_dma : HW working prediction buffer dma address (AP-W, VPU-R)
* @mv_buf_dma : HW working motion vector buffer dma address (AP-W, VPU-R)
* @dec : decode information (AP-R, VPU-W)
* @pic : picture information (AP-R, VPU-W)
* @crop : crop information (AP-R, VPU-W)
* @h264_slice_params : the parameters that hardware use to decode
*/
struct vdec_h264_vsi {
u64 pred_buf_dma;
u64 mv_buf_dma[H264_MAX_MV_NUM];
struct vdec_h264_dec_info dec;
struct vdec_pic_info pic;
struct v4l2_rect crop;
struct mtk_h264_dec_slice_param h264_slice_params;
};
/**
* struct vdec_h264_slice_inst - h264 decoder instance
* @num_nalu : how many nalus be decoded
* @ctx : point to mtk_vcodec_dec_ctx
* @pred_buf : HW working prediction buffer
* @mv_buf : HW working motion vector buffer
* @vpu : VPU instance
* @vsi_ctx : Local VSI data for this decoding context
* @h264_slice_param : the parameters that hardware use to decode
* @dpb : decoded picture buffer used to store reference buffer information
*/
struct vdec_h264_slice_inst {
unsigned int num_nalu;
struct mtk_vcodec_dec_ctx *ctx;
struct mtk_vcodec_mem pred_buf;
struct mtk_vcodec_mem mv_buf[H264_MAX_MV_NUM];
struct vdec_vpu_inst vpu;
struct vdec_h264_vsi vsi_ctx;
struct mtk_h264_dec_slice_param h264_slice_param;
struct v4l2_h264_dpb_entry dpb[16];
};
static int get_vdec_decode_parameters(struct vdec_h264_slice_inst *inst)
{
const struct v4l2_ctrl_h264_decode_params *dec_params;
const struct v4l2_ctrl_h264_sps *sps;
const struct v4l2_ctrl_h264_pps *pps;
const struct v4l2_ctrl_h264_scaling_matrix *scaling_matrix;
struct mtk_h264_dec_slice_param *slice_param = &inst->h264_slice_param;
struct v4l2_h264_reflist_builder reflist_builder;
struct v4l2_h264_reference v4l2_p0_reflist[V4L2_H264_REF_LIST_LEN];
struct v4l2_h264_reference v4l2_b0_reflist[V4L2_H264_REF_LIST_LEN];
struct v4l2_h264_reference v4l2_b1_reflist[V4L2_H264_REF_LIST_LEN];
u8 *p0_reflist = slice_param->decode_params.ref_pic_list_p0;
u8 *b0_reflist = slice_param->decode_params.ref_pic_list_b0;
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `media/v4l2-mem2mem.h`, `media/v4l2-h264.h`, `media/videobuf2-dma-contig.h`, `../mtk_vcodec_dec.h`, `../../common/mtk_vcodec_intr.h`, `../vdec_drv_base.h`.
- Detected declarations: `struct mtk_h264_dec_slice_param`, `struct vdec_h264_dec_info`, `struct vdec_h264_vsi`, `struct vdec_h264_slice_inst`, `function get_vdec_decode_parameters`, `function allocate_prediction_buf`, `function free_prediction_buf`, `function alloc_mv_buf`, `function free_mv_buf`, `function get_pic_info`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.