perf tools: Don't clone maps from parent when synthesizing forks
[linux/fpc-iii.git] / drivers / media / platform / mtk-vcodec / vdec_drv_if.h
blobded1154481cdc50c540f720613e3d0a37fe890c8
1 /*
2 * Copyright (c) 2016 MediaTek Inc.
3 * Author: PC Chen <pc.chen@mediatek.com>
4 * Tiffany Lin <tiffany.lin@mediatek.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
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.
16 #ifndef _VDEC_DRV_IF_H_
17 #define _VDEC_DRV_IF_H_
19 #include "mtk_vcodec_drv.h"
20 #include "mtk_vcodec_dec.h"
21 #include "mtk_vcodec_util.h"
24 /**
25 * struct vdec_fb_status - decoder frame buffer status
26 * @FB_ST_NORMAL : initial state
27 * @FB_ST_DISPLAY : frmae buffer is ready to be displayed
28 * @FB_ST_FREE : frame buffer is not used by decoder any more
30 enum vdec_fb_status {
31 FB_ST_NORMAL = 0,
32 FB_ST_DISPLAY = (1 << 0),
33 FB_ST_FREE = (1 << 1)
36 /* For GET_PARAM_DISP_FRAME_BUFFER and GET_PARAM_FREE_FRAME_BUFFER,
37 * the caller does not own the returned buffer. The buffer will not be
38 * released before vdec_if_deinit.
39 * GET_PARAM_DISP_FRAME_BUFFER : get next displayable frame buffer,
40 * struct vdec_fb**
41 * GET_PARAM_FREE_FRAME_BUFFER : get non-referenced framebuffer, vdec_fb**
42 * GET_PARAM_PIC_INFO : get picture info, struct vdec_pic_info*
43 * GET_PARAM_CROP_INFO : get crop info, struct v4l2_crop*
44 * GET_PARAM_DPB_SIZE : get dpb size, unsigned int*
46 enum vdec_get_param_type {
47 GET_PARAM_DISP_FRAME_BUFFER,
48 GET_PARAM_FREE_FRAME_BUFFER,
49 GET_PARAM_PIC_INFO,
50 GET_PARAM_CROP_INFO,
51 GET_PARAM_DPB_SIZE
54 /**
55 * struct vdec_fb_node - decoder frame buffer node
56 * @list : list to hold this node
57 * @fb : point to frame buffer (vdec_fb), fb could point to frame buffer and
58 * working buffer this is for maintain buffers in different state
60 struct vdec_fb_node {
61 struct list_head list;
62 struct vdec_fb *fb;
65 /**
66 * vdec_if_init() - initialize decode driver
67 * @ctx : [in] v4l2 context
68 * @fourcc : [in] video format fourcc, V4L2_PIX_FMT_H264/VP8/VP9..
70 int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc);
72 /**
73 * vdec_if_deinit() - deinitialize decode driver
74 * @ctx : [in] v4l2 context
77 void vdec_if_deinit(struct mtk_vcodec_ctx *ctx);
79 /**
80 * vdec_if_decode() - trigger decode
81 * @ctx : [in] v4l2 context
82 * @bs : [in] input bitstream
83 * @fb : [in] frame buffer to store decoded frame, when null menas parse
84 * header only
85 * @res_chg : [out] resolution change happens if current bs have different
86 * picture width/height
87 * Note: To flush the decoder when reaching EOF, set input bitstream as NULL.
89 * Return: 0 on success. -EIO on unrecoverable error.
91 int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,
92 struct vdec_fb *fb, bool *res_chg);
94 /**
95 * vdec_if_get_param() - get driver's parameter
96 * @ctx : [in] v4l2 context
97 * @type : [in] input parameter type
98 * @out : [out] buffer to store query result
100 int vdec_if_get_param(struct mtk_vcodec_ctx *ctx, enum vdec_get_param_type type,
101 void *out);
103 #endif