drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c- Extension
.c- Size
- 44064 bytes
- Lines
- 1335
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/sizes.hlinux/videodev2.hhfi.hhfi_plat_bufs.hhelpers.h
Detected Declarations
struct dec_bufsize_opsstruct enc_bufsize_opsfunction Copyrightfunction size_vpxd_lb_fe_left_ctrlfunction size_vpxd_lb_se_left_ctrlfunction size_vpss_lbfunction size_h264d_hw_bin_bufferfunction h264d_scratch_sizefunction size_h265d_hw_bin_bufferfunction h265d_scratch_sizefunction vpxd_scratch_sizefunction mpeg2d_scratch_sizefunction calculate_enc_output_frame_sizefunction calculate_enc_scratch_sizefunction h264e_scratch_sizefunction h265e_scratch_sizefunction vp8e_scratch_sizefunction hfi_iris2_h264d_comv_sizefunction size_h264d_bse_cmd_buffunction size_h264d_vpp_cmd_buffunction hfi_iris2_h264d_non_comv_sizefunction size_h265d_bse_cmd_buffunction size_h265d_vpp_cmd_buffunction hfi_iris2_h265d_comv_sizefunction hfi_iris2_h265d_non_comv_sizefunction hfi_iris2_vp8d_comv_sizefunction h264d_scratch1_sizefunction h265d_scratch1_sizefunction vp8d_scratch1_sizefunction vp9d_scratch1_sizefunction mpeg2d_scratch1_sizefunction calculate_enc_scratch1_sizefunction h264e_scratch1_sizefunction h265e_scratch1_sizefunction vp8e_scratch1_sizefunction ubwc_metadata_plane_stridefunction ubwc_metadata_plane_bufheightfunction ubwc_metadata_plane_buffer_sizefunction enc_scratch2_sizefunction enc_persist_sizefunction h264d_persist1_sizefunction h265d_persist1_sizefunction vp8d_persist1_sizefunction vp9d_persist1_sizefunction mpeg2d_persist1_sizefunction calculate_dec_input_frame_sizefunction output_buffer_countfunction bufreq_dec
Annotated Snippet
struct dec_bufsize_ops {
u32 (*scratch)(u32 width, u32 height, bool is_interlaced);
u32 (*scratch1)(u32 width, u32 height, u32 min_buf_count,
bool split_mode_enabled, u32 num_vpp_pipes);
u32 (*persist1)(void);
};
struct enc_bufsize_ops {
u32 (*scratch)(u32 width, u32 height, u32 work_mode, u32 num_vpp_pipes,
u32 rc_type);
u32 (*scratch1)(u32 width, u32 height, u32 num_ref, bool ten_bit,
u32 num_vpp_pipes);
u32 (*scratch2)(u32 width, u32 height, u32 num_ref, bool ten_bit);
u32 (*persist)(void);
};
static const struct dec_bufsize_ops dec_h264_ops = {
.scratch = h264d_scratch_size,
.scratch1 = h264d_scratch1_size,
.persist1 = h264d_persist1_size,
};
static const struct dec_bufsize_ops dec_h265_ops = {
.scratch = h265d_scratch_size,
.scratch1 = h265d_scratch1_size,
.persist1 = h265d_persist1_size,
};
static const struct dec_bufsize_ops dec_vp8_ops = {
.scratch = vpxd_scratch_size,
.scratch1 = vp8d_scratch1_size,
.persist1 = vp8d_persist1_size,
};
static const struct dec_bufsize_ops dec_vp9_ops = {
.scratch = vpxd_scratch_size,
.scratch1 = vp9d_scratch1_size,
.persist1 = vp9d_persist1_size,
};
static const struct dec_bufsize_ops dec_mpeg2_ops = {
.scratch = mpeg2d_scratch_size,
.scratch1 = mpeg2d_scratch1_size,
.persist1 = mpeg2d_persist1_size,
};
static const struct enc_bufsize_ops enc_h264_ops = {
.scratch = h264e_scratch_size,
.scratch1 = h264e_scratch1_size,
.scratch2 = enc_scratch2_size,
.persist = enc_persist_size,
};
static const struct enc_bufsize_ops enc_h265_ops = {
.scratch = h265e_scratch_size,
.scratch1 = h265e_scratch1_size,
.scratch2 = enc_scratch2_size,
.persist = enc_persist_size,
};
static const struct enc_bufsize_ops enc_vp8_ops = {
.scratch = vp8e_scratch_size,
.scratch1 = vp8e_scratch1_size,
.scratch2 = enc_scratch2_size,
.persist = enc_persist_size,
};
static u32
calculate_dec_input_frame_size(u32 width, u32 height, u32 codec,
u32 max_mbs_per_frame, u32 buffer_size_limit)
{
u32 frame_size, num_mbs;
u32 div_factor = 1;
u32 base_res_mbs = NUM_MBS_4K;
/*
* Decoder input size calculation:
* If clip is 8k buffer size is calculated for 8k : 8k mbs/4
* For 8k cases we expect width/height to be set always.
* In all other cases size is calculated for 4k:
* 4k mbs for VP8/VP9 and 4k/2 for remaining codecs
*/
num_mbs = (ALIGN(height, 16) * ALIGN(width, 16)) / 256;
if (num_mbs > NUM_MBS_4K) {
div_factor = 4;
base_res_mbs = max_mbs_per_frame;
} else {
base_res_mbs = NUM_MBS_4K;
if (codec == V4L2_PIX_FMT_VP9)
div_factor = 1;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/sizes.h`, `linux/videodev2.h`, `hfi.h`, `hfi_plat_bufs.h`, `helpers.h`.
- Detected declarations: `struct dec_bufsize_ops`, `struct enc_bufsize_ops`, `function Copyright`, `function size_vpxd_lb_fe_left_ctrl`, `function size_vpxd_lb_se_left_ctrl`, `function size_vpss_lb`, `function size_h264d_hw_bin_buffer`, `function h264d_scratch_size`, `function size_h265d_hw_bin_buffer`, `function h265d_scratch_size`.
- 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.