drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c- Extension
.c- Size
- 23075 bytes
- Lines
- 820
- 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/interrupt.hlinux/kernel.hlinux/slab.h../mtk_vcodec_enc_drv.h../../common/mtk_vcodec_intr.h../mtk_vcodec_enc.h../mtk_vcodec_enc_pm.h../venc_drv_base.h../venc_ipi_msg.h../venc_vpu_if.h
Detected Declarations
struct venc_h264_vpu_configstruct venc_h264_vpu_bufstruct venc_h264_vsistruct venc_h264_vpu_config_extstruct venc_h264_vpu_buf_34struct venc_h264_vsi_34struct venc_h264_instenum venc_h264_frame_typeenum venc_h264_vpu_work_bufenum venc_h264_bs_modefunction h264_read_regfunction h264_get_profilefunction h264_get_levelfunction h264_enc_free_work_buffunction h264_enc_alloc_work_buffunction h264_enc_wait_venc_donefunction h264_frame_typefunction h264_encode_spsfunction h264_encode_ppsfunction h264_encode_headerfunction h264_encode_framefunction h264_encode_fillerfunction h264_enc_initfunction h264_enc_encodefunction h264_enc_set_vsi_configsfunction h264_enc_set_vsi_34_configsfunction h264_enc_set_paramfunction h264_enc_deinit
Annotated Snippet
struct venc_h264_vpu_config {
u32 input_fourcc;
u32 bitrate;
u32 pic_w;
u32 pic_h;
u32 buf_w;
u32 buf_h;
u32 gop_size;
u32 intra_period;
u32 framerate;
u32 profile;
u32 level;
u32 wfd;
};
/*
* struct venc_h264_vpu_buf - Structure for buffer information
* AP-W/R : AP is writer/reader on this item
* VPU-W/R: VPU is write/reader on this item
* @iova: IO virtual address
* @vpua: VPU side memory addr which is used by RC_CODE
* @size: buffer size (in bytes)
*/
struct venc_h264_vpu_buf {
u32 iova;
u32 vpua;
u32 size;
};
/*
* struct venc_h264_vsi - Structure for VPU driver control and info share
* AP-W/R : AP is writer/reader on this item
* VPU-W/R: VPU is write/reader on this item
* This structure is allocated in VPU side and shared to AP side.
* @config: h264 encoder configuration
* @work_bufs: working buffer information in VPU side
* The work_bufs here is for storing the 'size' info shared to AP side.
* The similar item in struct venc_h264_inst is for memory allocation
* in AP side. The AP driver will copy the 'size' from here to the one in
* struct mtk_vcodec_mem, then invoke mtk_vcodec_mem_alloc to allocate
* the buffer. After that, bypass the 'dma_addr' to the 'iova' field here for
* register setting in VPU side.
*/
struct venc_h264_vsi {
struct venc_h264_vpu_config config;
struct venc_h264_vpu_buf work_bufs[VENC_H264_VPU_WORK_BUF_MAX];
};
/**
* struct venc_h264_vpu_config_ext - Structure for h264 encoder configuration
* AP-W/R : AP is writer/reader on this item
* VPU-W/R: VPU is write/reader on this item
* @input_fourcc: input fourcc
* @bitrate: target bitrate (in bps)
* @pic_w: picture width. Picture size is visible stream resolution, in pixels,
* to be used for display purposes; must be smaller or equal to buffer
* size.
* @pic_h: picture height
* @buf_w: buffer width. Buffer size is stream resolution in pixels aligned to
* hardware requirements.
* @buf_h: buffer height
* @gop_size: group of picture size (idr frame)
* @intra_period: intra frame period
* @framerate: frame rate in fps
* @profile: as specified in standard
* @level: as specified in standard
* @wfd: WFD mode 1:on, 0:off
* @max_qp: max quant parameter
* @min_qp: min quant parameter
* @reserved: reserved configs
*/
struct venc_h264_vpu_config_ext {
u32 input_fourcc;
u32 bitrate;
u32 pic_w;
u32 pic_h;
u32 buf_w;
u32 buf_h;
u32 gop_size;
u32 intra_period;
u32 framerate;
u32 profile;
u32 level;
u32 wfd;
u32 max_qp;
u32 min_qp;
u32 reserved[8];
};
/**
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/kernel.h`, `linux/slab.h`, `../mtk_vcodec_enc_drv.h`, `../../common/mtk_vcodec_intr.h`, `../mtk_vcodec_enc.h`, `../mtk_vcodec_enc_pm.h`, `../venc_drv_base.h`.
- Detected declarations: `struct venc_h264_vpu_config`, `struct venc_h264_vpu_buf`, `struct venc_h264_vsi`, `struct venc_h264_vpu_config_ext`, `struct venc_h264_vpu_buf_34`, `struct venc_h264_vsi_34`, `struct venc_h264_inst`, `enum venc_h264_frame_type`, `enum venc_h264_vpu_work_buf`, `enum venc_h264_bs_mode`.
- 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.