Linux-libre 4.17.3-gnu
[librecmc/linux-libre.git] / drivers / media / platform / mtk-vcodec / venc_vpu_if.h
1 /*
2  * Copyright (c) 2016 MediaTek Inc.
3  * Author: PoChun Lin <pochun.lin@mediatek.com>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  */
15
16 #ifndef _VENC_VPU_IF_H_
17 #define _VENC_VPU_IF_H_
18
19 #include "mtk_vpu.h"
20 #include "venc_drv_if.h"
21
22 /*
23  * struct venc_vpu_inst - encoder VPU driver instance
24  * @wq_hd: wait queue used for vpu cmd trigger then wait vpu interrupt done
25  * @signaled: flag used for checking vpu interrupt done
26  * @failure: flag to show vpu cmd succeeds or not
27  * @state: enum venc_ipi_msg_enc_state
28  * @bs_size: bitstream size for skip frame case usage
29  * @is_key_frm: key frame flag
30  * @inst_addr: VPU instance addr
31  * @vsi: driver structure allocated by VPU side and shared to AP side for
32  *       control and info share
33  * @id: the id of inter-processor interrupt
34  * @ctx: context for v4l2 layer integration
35  * @dev: device for v4l2 layer integration
36  */
37 struct venc_vpu_inst {
38         wait_queue_head_t wq_hd;
39         int signaled;
40         int failure;
41         int state;
42         int bs_size;
43         int is_key_frm;
44         unsigned int inst_addr;
45         void *vsi;
46         enum ipi_id id;
47         struct mtk_vcodec_ctx *ctx;
48         struct platform_device *dev;
49 };
50
51 int vpu_enc_init(struct venc_vpu_inst *vpu);
52 int vpu_enc_set_param(struct venc_vpu_inst *vpu,
53                       enum venc_set_param_type id,
54                       struct venc_enc_param *param);
55 int vpu_enc_encode(struct venc_vpu_inst *vpu, unsigned int bs_mode,
56                    struct venc_frm_buf *frm_buf,
57                    struct mtk_vcodec_mem *bs_buf,
58                    unsigned int *bs_size);
59 int vpu_enc_deinit(struct venc_vpu_inst *vpu);
60
61 #endif