treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / media / platform / mtk-vcodec / mtk_vcodec_dec.h
blobcf26b6c1486a647d732c43671a4ec092d9ac64e7
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2016 MediaTek Inc.
4 * Author: PC Chen <pc.chen@mediatek.com>
5 * Tiffany Lin <tiffany.lin@mediatek.com>
6 */
8 #ifndef _MTK_VCODEC_DEC_H_
9 #define _MTK_VCODEC_DEC_H_
11 #include <media/videobuf2-core.h>
12 #include <media/v4l2-mem2mem.h>
14 #define VCODEC_CAPABILITY_4K_DISABLED 0x10
15 #define VCODEC_DEC_4K_CODED_WIDTH 4096U
16 #define VCODEC_DEC_4K_CODED_HEIGHT 2304U
17 #define MTK_VDEC_MAX_W 2048U
18 #define MTK_VDEC_MAX_H 1088U
20 #define MTK_VDEC_IRQ_STATUS_DEC_SUCCESS 0x10000
22 /**
23 * struct vdec_fb - decoder frame buffer
24 * @base_y : Y plane memory info
25 * @base_c : C plane memory info
26 * @status : frame buffer status (vdec_fb_status)
28 struct vdec_fb {
29 struct mtk_vcodec_mem base_y;
30 struct mtk_vcodec_mem base_c;
31 unsigned int status;
34 /**
35 * struct mtk_video_dec_buf - Private data related to each VB2 buffer.
36 * @m2m_buf: M2M buffer
37 * @list: link list
38 * @used: Capture buffer contain decoded frame data and keep in
39 * codec data structure
40 * @queued_in_vb2: Capture buffer is queue in vb2
41 * @queued_in_v4l2: Capture buffer is in v4l2 driver, but not in vb2
42 * queue yet
43 * @lastframe: Intput buffer is last buffer - EOS
44 * @error: An unrecoverable error occurs on this buffer.
45 * @frame_buffer: Decode status, and buffer information of Capture buffer
47 * Note : These status information help us track and debug buffer state
49 struct mtk_video_dec_buf {
50 struct v4l2_m2m_buffer m2m_buf;
52 bool used;
53 bool queued_in_vb2;
54 bool queued_in_v4l2;
55 bool lastframe;
56 bool error;
57 struct vdec_fb frame_buffer;
60 extern const struct v4l2_ioctl_ops mtk_vdec_ioctl_ops;
61 extern const struct v4l2_m2m_ops mtk_vdec_m2m_ops;
65 * mtk_vdec_lock/mtk_vdec_unlock are for ctx instance to
66 * get/release lock before/after access decoder hw.
67 * mtk_vdec_lock get decoder hw lock and set curr_ctx
68 * to ctx instance that get lock
70 void mtk_vdec_unlock(struct mtk_vcodec_ctx *ctx);
71 void mtk_vdec_lock(struct mtk_vcodec_ctx *ctx);
72 int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,
73 struct vb2_queue *dst_vq);
74 void mtk_vcodec_dec_set_default_params(struct mtk_vcodec_ctx *ctx);
75 void mtk_vcodec_dec_release(struct mtk_vcodec_ctx *ctx);
76 int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx);
79 #endif /* _MTK_VCODEC_DEC_H_ */