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.

Dependency Surface

Detected Declarations

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

Implementation Notes