drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c
Extension
.c
Size
11738 bytes
Lines
437
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 vdec_vp8_slice_info {
	u64 vld_wrapper_dma;
	u64 seg_id_buf_dma;
	u64 wrap_y_dma;
	u64 wrap_c_dma;
	u64 cur_y_fb_dma;
	u64 cur_c_fb_dma;
	u64 bs_dma;
	u32 bs_sz;
	u32 resolution_changed;
	u32 frame_header_type;
	u32 crc[8];
	u32 reserved;
};

/**
 * struct vdec_vp8_slice_dpb_info  - vp8 reference information
 *
 * @y_dma_addr:	Y bitstream physical address
 * @c_dma_addr:	CbCr bitstream physical address
 * @reference_flag:	reference picture flag
 * @reserved:		64bit align
 */
struct vdec_vp8_slice_dpb_info {
	dma_addr_t y_dma_addr;
	dma_addr_t c_dma_addr;
	int reference_flag;
	int reserved;
};

/**
 * struct vdec_vp8_slice_vsi - VPU shared information
 *
 * @dec:		decoding information
 * @pic:		picture information
 * @vp8_dpb_info:	reference buffer information
 */
struct vdec_vp8_slice_vsi {
	struct vdec_vp8_slice_info dec;
	struct vdec_pic_info pic;
	struct vdec_vp8_slice_dpb_info vp8_dpb_info[3];
};

/**
 * struct vdec_vp8_slice_inst - VP8 decoder instance
 *
 * @seg_id_buf:	seg buffer
 * @wrap_y_buf:	wrapper y buffer
 * @wrap_c_buf:	wrapper c buffer
 * @vld_wrapper_buf:	vld wrapper buffer
 * @ctx:		V4L2 context
 * @vpu:		VPU instance for decoder
 * @vsi:		VPU share information
 */
struct vdec_vp8_slice_inst {
	struct mtk_vcodec_mem seg_id_buf;
	struct mtk_vcodec_mem wrap_y_buf;
	struct mtk_vcodec_mem wrap_c_buf;
	struct mtk_vcodec_mem vld_wrapper_buf;
	struct mtk_vcodec_dec_ctx *ctx;
	struct vdec_vpu_inst vpu;
	struct vdec_vp8_slice_vsi *vsi;
};

static void *vdec_vp8_slice_get_ctrl_ptr(struct mtk_vcodec_dec_ctx *ctx, int id)
{
	struct v4l2_ctrl *ctrl = v4l2_ctrl_find(&ctx->ctrl_hdl, id);

	if (!ctrl)
		return ERR_PTR(-EINVAL);

	return ctrl->p_cur.p;
}

static void vdec_vp8_slice_get_pic_info(struct vdec_vp8_slice_inst *inst)
{
	struct mtk_vcodec_dec_ctx *ctx = inst->ctx;
	unsigned int data[3];

	data[0] = ctx->picinfo.pic_w;
	data[1] = ctx->picinfo.pic_h;
	data[2] = ctx->capture_fourcc;
	vpu_dec_get_param(&inst->vpu, data, 3, GET_PARAM_PIC_INFO);

	ctx->picinfo.buf_w = ALIGN(ctx->picinfo.pic_w, 64);
	ctx->picinfo.buf_h = ALIGN(ctx->picinfo.pic_h, 64);
	ctx->picinfo.fb_sz[0] = inst->vpu.fb_sz[0];
	ctx->picinfo.fb_sz[1] = inst->vpu.fb_sz[1];

	inst->vsi->pic.pic_w = ctx->picinfo.pic_w;

Annotation

Implementation Notes