brintos

brintos / linux-shallow public Read only

0
0
Text · 3.7 KiB · 57ed9b1 Raw
120 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 * Copyright (c) 2016 MediaTek Inc.4 * Author: PC Chen <pc.chen@mediatek.com>5 */6 7#ifndef _VDEC_VPU_IF_H_8#define _VDEC_VPU_IF_H_9 10struct mtk_vcodec_dec_ctx;11 12/**13 * struct vdec_vpu_inst - VPU instance for video codec14 * @id          : ipi msg id for each decoder15 * @core_id     : core id used to separate different hardware16 * @vsi         : driver structure allocated by VPU side and shared to AP side17 *                for control and info share18 * @failure     : VPU execution result status, 0: success, others: fail19 * @inst_addr	: VPU decoder instance address20 * @fw_abi_version : ABI version of the firmware.21 * @inst_id	: if fw_abi_version >= 2, contains the instance ID to be given22 *                in place of inst_addr in messages.23 * @signaled    : 1 - Host has received ack message from VPU, 0 - not received24 * @ctx         : context for v4l2 layer integration25 * @wq          : wait queue to wait VPU message ack26 * @handler     : ipi handler for each decoder27 * @codec_type     : use codec type to separate different codecs28 * @capture_type:	used capture type to separate different capture format29 * @fb_sz  : frame buffer size of each plane30 */31struct vdec_vpu_inst {32	int id;33	int core_id;34	void *vsi;35	int32_t failure;36	uint32_t inst_addr;37	uint32_t fw_abi_version;38	uint32_t inst_id;39	unsigned int signaled;40	struct mtk_vcodec_dec_ctx *ctx;41	wait_queue_head_t wq;42	mtk_vcodec_ipi_handler handler;43	unsigned int codec_type;44	unsigned int capture_type;45	unsigned int fb_sz[2];46};47 48/**49 * vpu_dec_init - init decoder instance and allocate required resource in VPU.50 *51 * @vpu: instance for vdec_vpu_inst52 */53int vpu_dec_init(struct vdec_vpu_inst *vpu);54 55/**56 * vpu_dec_start - start decoding, basically the function will be invoked once57 *                 every frame.58 *59 * @vpu : instance for vdec_vpu_inst60 * @data: meta data to pass bitstream info to VPU decoder61 * @len : meta data length62 */63int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len);64 65/**66 * vpu_dec_end - end decoding, basically the function will be invoked once67 *               when HW decoding done interrupt received successfully. The68 *               decoder in VPU will continue to do reference frame management69 *               and check if there is a new decoded frame available to display.70 *71 * @vpu : instance for vdec_vpu_inst72 */73int vpu_dec_end(struct vdec_vpu_inst *vpu);74 75/**76 * vpu_dec_deinit - deinit decoder instance and resource freed in VPU.77 *78 * @vpu: instance for vdec_vpu_inst79 */80int vpu_dec_deinit(struct vdec_vpu_inst *vpu);81 82/**83 * vpu_dec_reset - reset decoder, use for flush decoder when end of stream or84 *                 seek. Remaining non displayed frame will be pushed to display.85 *86 * @vpu: instance for vdec_vpu_inst87 */88int vpu_dec_reset(struct vdec_vpu_inst *vpu);89 90/**91 * vpu_dec_core - core start decoding, basically the function will be invoked once92 *                 every frame.93 *94 * @vpu : instance for vdec_vpu_inst95 */96int vpu_dec_core(struct vdec_vpu_inst *vpu);97 98/**99 * vpu_dec_core_end - core end decoding, basically the function will be invoked once100 *               when core HW decoding done and receive interrupt successfully. The101 *               decoder in VPU will update hardware information and deinit hardware102 *               and check if there is a new decoded frame available to display.103 *104 * @vpu : instance for vdec_vpu_inst105 */106int vpu_dec_core_end(struct vdec_vpu_inst *vpu);107 108/**109 * vpu_dec_get_param - get param from scp110 *111 * @vpu : instance for vdec_vpu_inst112 * @data: meta data to pass bitstream info to VPU decoder113 * @len : meta data length114 * @param_type : get param type115 */116int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,117		      unsigned int len, unsigned int param_type);118 119#endif120