drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/mediatek/vcodec/decoder/vdec_msg_queue.h
Extension
.h
Size
6032 bytes
Lines
192
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_msg_queue_ctx {
	wait_queue_head_t ready_to_use;
	struct list_head ready_queue;
	/* protect lat buffer */
	spinlock_t ready_lock;
	int ready_num;
	int hardware_index;
};

/**
 * struct vdec_lat_buf - lat buffer message used to store lat info for core decode
 * @wdma_err_addr: wdma error address used for lat hardware
 * @slice_bc_addr: slice bc address used for lat hardware
 * @rd_mv_addr:	mv addr for av1 lat hardware output, core hardware input
 * @tile_addr:	tile buffer for av1 core input
 * @ts_info: need to set timestamp from output to capture
 * @src_buf_req: output buffer media request object
 *
 * @private_data: shared information used to lat and core hardware
 * @ctx: mtk vcodec context information
 * @core_decode: different codec use different decode callback function
 * @lat_list: add lat buffer to lat head list
 * @core_list: add lat buffer to core head list
 *
 * @is_last_frame: meaning this buffer is the last frame
 */
struct vdec_lat_buf {
	struct mtk_vcodec_mem wdma_err_addr;
	struct mtk_vcodec_mem slice_bc_addr;
	struct mtk_vcodec_mem rd_mv_addr;
	struct mtk_vcodec_mem tile_addr;
	struct vb2_v4l2_buffer ts_info;
	struct media_request *src_buf_req;

	void *private_data;
	struct mtk_vcodec_dec_ctx *ctx;
	core_decode_cb_t core_decode;
	struct list_head lat_list;
	struct list_head core_list;

	bool is_last_frame;
};

/**
 * struct vdec_msg_queue - used to store lat buffer message
 * @lat_buf: lat buffer used to store lat buffer information
 * @wdma_addr: wdma address used for ube
 * @wdma_rptr_addr: ube read point
 * @wdma_wptr_addr: ube write point
 * @core_work: core hardware work
 * @lat_ctx: used to store lat buffer list
 * @core_ctx: used to store core buffer list
 *
 * @lat_list_cnt: used to record each instance lat list count
 * @core_list_cnt: used to record each instance core list count
 * @flush_done: core flush done status
 * @empty_lat_buf: the last lat buf used to flush decode
 * @core_dec_done: core work queue decode done event
 * @status: current context decode status for core hardware
 * @ctx: mtk vcodec context information
 */
struct vdec_msg_queue {
	struct vdec_lat_buf lat_buf[NUM_BUFFER_COUNT];

	struct mtk_vcodec_mem wdma_addr;
	u64 wdma_rptr_addr;
	u64 wdma_wptr_addr;

	struct work_struct core_work;
	struct vdec_msg_queue_ctx lat_ctx;
	struct vdec_msg_queue_ctx core_ctx;

	atomic_t lat_list_cnt;
	atomic_t core_list_cnt;
	bool flush_done;
	struct vdec_lat_buf empty_lat_buf;
	wait_queue_head_t core_dec_done;
	int status;
	struct mtk_vcodec_dec_ctx *ctx;
};

/**
 * vdec_msg_queue_init - init lat buffer information.
 * @msg_queue: used to store the lat buffer information
 * @ctx: v4l2 ctx
 * @core_decode: core decode callback for each codec
 * @private_size: the private data size used to share with core
 *
 * Return: returns 0 if init successfully, or fail.
 */

Annotation

Implementation Notes