2019-06-04 05:37:33 -04:00
/* SPDX-License-Identifier: GPL-2.0 */
2016-09-02 09:19:54 -03:00
/*
* Copyright ( c ) 2016 MediaTek Inc .
* Author : PC Chen < pc . chen @ mediatek . com >
*/
# ifndef _VDEC_VPU_IF_H_
# define _VDEC_VPU_IF_H_
2020-08-21 12:35:52 +02:00
# include "mtk_vcodec_fw.h"
struct mtk_vcodec_ctx ;
2016-09-02 09:19:54 -03:00
/**
* struct vdec_vpu_inst - VPU instance for video codec
2020-08-21 12:35:52 +02:00
* @ id : ipi msg id for each decoder
2016-09-02 09:19:54 -03:00
* @ vsi : driver structure allocated by VPU side and shared to AP side
* for control and info share
* @ failure : VPU execution result status , 0 : success , others : fail
* @ inst_addr : VPU decoder instance address
* @ signaled : 1 - Host has received ack message from VPU , 0 - not received
* @ ctx : context for v4l2 layer integration
2018-01-04 06:47:28 -05:00
* @ dev : platform device of VPU
2016-09-02 09:19:54 -03:00
* @ wq : wait queue to wait VPU message ack
* @ handler : ipi handler for each decoder
*/
struct vdec_vpu_inst {
2020-08-21 12:35:52 +02:00
int id ;
2016-09-02 09:19:54 -03:00
void * vsi ;
int32_t failure ;
uint32_t inst_addr ;
unsigned int signaled ;
struct mtk_vcodec_ctx * ctx ;
wait_queue_head_t wq ;
2020-08-21 12:35:52 +02:00
mtk_vcodec_ipi_handler handler ;
2016-09-02 09:19:54 -03:00
} ;
/**
* vpu_dec_init - init decoder instance and allocate required resource in VPU .
*
* @ vpu : instance for vdec_vpu_inst
*/
int vpu_dec_init ( struct vdec_vpu_inst * vpu ) ;
/**
* vpu_dec_start - start decoding , basically the function will be invoked once
* every frame .
*
* @ vpu : instance for vdec_vpu_inst
* @ data : meta data to pass bitstream info to VPU decoder
* @ len : meta data length
*/
int vpu_dec_start ( struct vdec_vpu_inst * vpu , uint32_t * data , unsigned int len ) ;
/**
* vpu_dec_end - end decoding , basically the function will be invoked once
* when HW decoding done interrupt received successfully . The
2019-02-18 14:29:00 -05:00
* decoder in VPU will continue to do reference frame management
2016-09-02 09:19:54 -03:00
* and check if there is a new decoded frame available to display .
*
* @ vpu : instance for vdec_vpu_inst
*/
int vpu_dec_end ( struct vdec_vpu_inst * vpu ) ;
/**
* vpu_dec_deinit - deinit decoder instance and resource freed in VPU .
*
* @ vpu : instance for vdec_vpu_inst
*/
int vpu_dec_deinit ( struct vdec_vpu_inst * vpu ) ;
/**
* vpu_dec_reset - reset decoder , use for flush decoder when end of stream or
* seek . Remainig non displayed frame will be pushed to display .
*
* @ vpu : instance for vdec_vpu_inst
*/
int vpu_dec_reset ( struct vdec_vpu_inst * vpu ) ;
# endif