drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c- Extension
.c- Size
- 12818 bytes
- Lines
- 495
- 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.h../vdec_drv_if.h../mtk_vcodec_dec.h../../common/mtk_vcodec_intr.h../vdec_vpu_if.h../vdec_drv_base.h
Detected Declarations
struct h264_fbstruct h264_ring_fb_liststruct vdec_h264_dec_infostruct vdec_h264_vsistruct vdec_h264_instfunction get_mv_buf_sizefunction allocate_prediction_buffunction free_prediction_buffunction alloc_mv_buffunction free_mv_buffunction check_list_validityfunction put_fb_to_freefunction get_pic_infofunction get_crop_infofunction get_dpb_sizefunction vdec_h264_initfunction vdec_h264_deinitfunction find_start_codefunction vdec_h264_decodefunction vdec_h264_get_fbfunction vdec_h264_get_param
Annotated Snippet
struct h264_fb {
uint64_t vdec_fb_va;
uint64_t y_fb_dma;
uint64_t c_fb_dma;
int32_t poc;
uint32_t reserved;
};
/**
* struct h264_ring_fb_list - ring frame buffer list
* @fb_list : frame buffer array
* @read_idx : read index
* @write_idx : write index
* @count : buffer count in list
* @reserved : for 8 bytes alignment
*/
struct h264_ring_fb_list {
struct h264_fb fb_list[H264_MAX_FB_NUM];
unsigned int read_idx;
unsigned int write_idx;
unsigned int count;
unsigned int reserved;
};
/**
* struct vdec_h264_dec_info - decode information
* @dpb_sz : decoding picture buffer size
* @resolution_changed : resolution change happen
* @realloc_mv_buf : flag to notify driver to re-allocate mv buffer
* @reserved : for 8 bytes alignment
* @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 {
uint32_t dpb_sz;
uint32_t resolution_changed;
uint32_t realloc_mv_buf;
uint32_t reserved;
uint64_t bs_dma;
uint64_t y_fb_dma;
uint64_t c_fb_dma;
uint64_t 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
* @hdr_buf : Header parsing buffer (AP-W, VPU-R)
* @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)
* @list_free : free frame buffer ring list (AP-W/R, VPU-W)
* @list_disp : display frame buffer ring list (AP-R, VPU-W)
* @dec : decode information (AP-R, VPU-W)
* @pic : picture information (AP-R, VPU-W)
* @crop : crop information (AP-R, VPU-W)
*/
struct vdec_h264_vsi {
unsigned char hdr_buf[HDR_PARSING_BUF_SZ];
uint64_t pred_buf_dma;
uint64_t mv_buf_dma[H264_MAX_FB_NUM];
struct h264_ring_fb_list list_free;
struct h264_ring_fb_list list_disp;
struct vdec_h264_dec_info dec;
struct vdec_pic_info pic;
struct v4l2_rect crop;
};
/**
* struct vdec_h264_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 : VPU shared information
*/
struct vdec_h264_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_FB_NUM];
struct vdec_vpu_inst vpu;
struct vdec_h264_vsi *vsi;
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `../vdec_drv_if.h`, `../mtk_vcodec_dec.h`, `../../common/mtk_vcodec_intr.h`, `../vdec_vpu_if.h`, `../vdec_drv_base.h`.
- Detected declarations: `struct h264_fb`, `struct h264_ring_fb_list`, `struct vdec_h264_dec_info`, `struct vdec_h264_vsi`, `struct vdec_h264_inst`, `function get_mv_buf_size`, `function allocate_prediction_buf`, `function free_prediction_buf`, `function alloc_mv_buf`, `function free_mv_buf`.
- 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.