brintos

brintos / linux-shallow public Read only

0
0
Text · 3.1 KiB · bfd297c Raw
104 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 *		   Tiffany Lin <tiffany.lin@mediatek.com>6 */7 8#ifndef _VDEC_DRV_IF_H_9#define _VDEC_DRV_IF_H_10 11#include "mtk_vcodec_dec.h"12 13 14/**15 * enum vdec_fb_status  - decoder frame buffer status16 * @FB_ST_NORMAL: initial state17 * @FB_ST_DISPLAY: frame buffer is ready to be displayed18 * @FB_ST_FREE: frame buffer is not used by decoder any more19 */20enum vdec_fb_status {21	FB_ST_NORMAL		= 0,22	FB_ST_DISPLAY		= (1 << 0),23	FB_ST_FREE		= (1 << 1)24};25 26/* For GET_PARAM_DISP_FRAME_BUFFER and GET_PARAM_FREE_FRAME_BUFFER,27 * the caller does not own the returned buffer. The buffer will not be28 *				released before vdec_if_deinit.29 * GET_PARAM_DISP_FRAME_BUFFER	: get next displayable frame buffer,30 *				struct vdec_fb**31 * GET_PARAM_FREE_FRAME_BUFFER	: get non-referenced framebuffer, vdec_fb**32 * GET_PARAM_PIC_INFO		: get picture info, struct vdec_pic_info*33 * GET_PARAM_CROP_INFO		: get crop info, struct v4l2_crop*34 * GET_PARAM_DPB_SIZE		: get dpb size, unsigned int*35 */36enum vdec_get_param_type {37	GET_PARAM_DISP_FRAME_BUFFER,38	GET_PARAM_FREE_FRAME_BUFFER,39	GET_PARAM_PIC_INFO,40	GET_PARAM_CROP_INFO,41	GET_PARAM_DPB_SIZE42};43 44/**45 * struct vdec_fb_node  - decoder frame buffer node46 * @list	: list to hold this node47 * @fb	: point to frame buffer (vdec_fb), fb could point to frame buffer and48 *	working buffer this is for maintain buffers in different state49 */50struct vdec_fb_node {51	struct list_head list;52	struct vdec_fb *fb;53};54 55extern const struct vdec_common_if vdec_h264_if;56extern const struct vdec_common_if vdec_h264_slice_if;57extern const struct vdec_common_if vdec_h264_slice_multi_if;58extern const struct vdec_common_if vdec_vp8_if;59extern const struct vdec_common_if vdec_vp8_slice_if;60extern const struct vdec_common_if vdec_vp9_if;61extern const struct vdec_common_if vdec_vp9_slice_lat_if;62extern const struct vdec_common_if vdec_hevc_slice_multi_if;63extern const struct vdec_common_if vdec_av1_slice_lat_if;64 65/**66 * vdec_if_init() - initialize decode driver67 * @ctx	: [in] v4l2 context68 * @fourcc	: [in] video format fourcc, V4L2_PIX_FMT_H264/VP8/VP9..69 */70int vdec_if_init(struct mtk_vcodec_dec_ctx *ctx, unsigned int fourcc);71 72/**73 * vdec_if_deinit() - deinitialize decode driver74 * @ctx	: [in] v4l2 context75 *76 */77void vdec_if_deinit(struct mtk_vcodec_dec_ctx *ctx);78 79/**80 * vdec_if_decode() - trigger decode81 * @ctx	: [in] v4l2 context82 * @bs	: [in] input bitstream83 * @fb	: [in] frame buffer to store decoded frame, when null means parse84 *	header only85 * @res_chg	: [out] resolution change happens if current bs have different86 *	picture width/height87 * Note: To flush the decoder when reaching EOF, set input bitstream as NULL.88 *89 * Return: 0 on success. -EIO on unrecoverable error.90 */91int vdec_if_decode(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_mem *bs,92		   struct vdec_fb *fb, bool *res_chg);93 94/**95 * vdec_if_get_param() - get driver's parameter96 * @ctx	: [in] v4l2 context97 * @type	: [in] input parameter type98 * @out	: [out] buffer to store query result99 */100int vdec_if_get_param(struct mtk_vcodec_dec_ctx *ctx, enum vdec_get_param_type type,101		      void *out);102 103#endif104