5800571960
-----BEGIN PGP SIGNATURE----- iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAlz8fAYeHHRvcnZhbGRz QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG1asH/3ySguxqtqL1MCBa 4/SZ37PHeWKMerfX6ZyJdgEqK3B+PWlmuLiOMNK5h2bPLzeQQQAmHU/mfKmpXqgB dHwUbG9yNnyUtTfsfRqAnCA6vpuw9Yb1oIzTCVQrgJLSWD0j7scBBvmzYqguOkto ThwigLUq3AILr8EfR4rh+GM+5Dn9OTEFAxwil9fPHQo7QoczwZxpURhScT6Co9TB DqLA3fvXbBvLs/CZy/S5vKM9hKzC+p39ApFTURvFPrelUVnythAM0dPDJg3pIn5u g+/+gDxDFa+7ANxvxO2ng1sJPDqJMeY/xmjJYlYyLpA33B7zLNk2vDHhAP06VTtr XCMhQ9s= =cb80 -----END PGP SIGNATURE----- Merge tag 'v5.2-rc4' into media/master There are some conflicts due to SPDX changes. We also have more patches being merged via media tree touching them. So, let's merge back from upstream and address those. Linux 5.2-rc4 * tag 'v5.2-rc4': (767 commits) Linux 5.2-rc4 MAINTAINERS: Karthikeyan Ramasubramanian is MIA i2c: xiic: Add max_read_len quirk lockref: Limit number of cmpxchg loop retries uaccess: add noop untagged_addr definition x86/insn-eval: Fix use-after-free access to LDT entry kbuild: use more portable 'command -v' for cc-cross-prefix s390/unwind: correct stack switching during unwind block, bfq: add weight symlink to the bfq.weight cgroup parameter cgroup: let a symlink too be created with a cftype file drm/nouveau/secboot/gp10[2467]: support newer FW to fix SEC2 failures on some boards drm/nouveau/secboot: enable loading of versioned LS PMU/SEC2 ACR msgqueue FW drm/nouveau/secboot: split out FW version-specific LS function pointers drm/nouveau/secboot: pass max supported FW version to LS load funcs drm/nouveau/core: support versioned firmware loading drm/nouveau/core: pass subdev into nvkm_firmware_get, rather than device block: free sched's request pool in blk_cleanup_queue pktgen: do not sleep with the thread lock held. net: mvpp2: Use strscpy to handle stat strings net: rds: fix memory leak in rds_ib_flush_mr_pool ... Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
155 lines
4.4 KiB
C
155 lines
4.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Copyright (c) 2016 MediaTek Inc.
|
|
* Author: Daniel Hsiao <daniel.hsiao@mediatek.com>
|
|
* Jungchang Tsao <jungchang.tsao@mediatek.com>
|
|
* Tiffany Lin <tiffany.lin@mediatek.com>
|
|
*/
|
|
|
|
#ifndef _VENC_DRV_IF_H_
|
|
#define _VENC_DRV_IF_H_
|
|
|
|
#include "mtk_vcodec_drv.h"
|
|
#include "mtk_vcodec_util.h"
|
|
|
|
/*
|
|
* enum venc_yuv_fmt - The type of input yuv format
|
|
* (VPU related: If you change the order, you must also update the VPU codes.)
|
|
* @VENC_YUV_FORMAT_I420: I420 YUV format
|
|
* @VENC_YUV_FORMAT_YV12: YV12 YUV format
|
|
* @VENC_YUV_FORMAT_NV12: NV12 YUV format
|
|
* @VENC_YUV_FORMAT_NV21: NV21 YUV format
|
|
*/
|
|
enum venc_yuv_fmt {
|
|
VENC_YUV_FORMAT_I420 = 3,
|
|
VENC_YUV_FORMAT_YV12 = 5,
|
|
VENC_YUV_FORMAT_NV12 = 6,
|
|
VENC_YUV_FORMAT_NV21 = 7,
|
|
};
|
|
|
|
/*
|
|
* enum venc_start_opt - encode frame option used in venc_if_encode()
|
|
* @VENC_START_OPT_ENCODE_SEQUENCE_HEADER: encode SPS/PPS for H264
|
|
* @VENC_START_OPT_ENCODE_FRAME: encode normal frame
|
|
*/
|
|
enum venc_start_opt {
|
|
VENC_START_OPT_ENCODE_SEQUENCE_HEADER,
|
|
VENC_START_OPT_ENCODE_FRAME,
|
|
};
|
|
|
|
/*
|
|
* enum venc_set_param_type - The type of set parameter used in
|
|
* venc_if_set_param()
|
|
* (VPU related: If you change the order, you must also update the VPU codes.)
|
|
* @VENC_SET_PARAM_ENC: set encoder parameters
|
|
* @VENC_SET_PARAM_FORCE_INTRA: force an intra frame
|
|
* @VENC_SET_PARAM_ADJUST_BITRATE: adjust bitrate (in bps)
|
|
* @VENC_SET_PARAM_ADJUST_FRAMERATE: set frame rate
|
|
* @VENC_SET_PARAM_GOP_SIZE: set IDR interval
|
|
* @VENC_SET_PARAM_INTRA_PERIOD: set I frame interval
|
|
* @VENC_SET_PARAM_SKIP_FRAME: set H264 skip one frame
|
|
* @VENC_SET_PARAM_PREPEND_HEADER: set H264 prepend SPS/PPS before IDR
|
|
* @VENC_SET_PARAM_TS_MODE: set VP8 temporal scalability mode
|
|
*/
|
|
enum venc_set_param_type {
|
|
VENC_SET_PARAM_ENC,
|
|
VENC_SET_PARAM_FORCE_INTRA,
|
|
VENC_SET_PARAM_ADJUST_BITRATE,
|
|
VENC_SET_PARAM_ADJUST_FRAMERATE,
|
|
VENC_SET_PARAM_GOP_SIZE,
|
|
VENC_SET_PARAM_INTRA_PERIOD,
|
|
VENC_SET_PARAM_SKIP_FRAME,
|
|
VENC_SET_PARAM_PREPEND_HEADER,
|
|
VENC_SET_PARAM_TS_MODE,
|
|
};
|
|
|
|
/*
|
|
* struct venc_enc_prm - encoder settings for VENC_SET_PARAM_ENC used in
|
|
* venc_if_set_param()
|
|
* @input_fourcc: input yuv format
|
|
* @h264_profile: V4L2 defined H.264 profile
|
|
* @h264_level: V4L2 defined H.264 level
|
|
* @width: image width
|
|
* @height: image height
|
|
* @buf_width: buffer width
|
|
* @buf_height: buffer height
|
|
* @frm_rate: frame rate in fps
|
|
* @intra_period: intra frame period
|
|
* @bitrate: target bitrate in bps
|
|
* @gop_size: group of picture size
|
|
*/
|
|
struct venc_enc_param {
|
|
enum venc_yuv_fmt input_yuv_fmt;
|
|
unsigned int h264_profile;
|
|
unsigned int h264_level;
|
|
unsigned int width;
|
|
unsigned int height;
|
|
unsigned int buf_width;
|
|
unsigned int buf_height;
|
|
unsigned int frm_rate;
|
|
unsigned int intra_period;
|
|
unsigned int bitrate;
|
|
unsigned int gop_size;
|
|
};
|
|
|
|
/*
|
|
* struct venc_frm_buf - frame buffer information used in venc_if_encode()
|
|
* @fb_addr: plane frame buffer addresses
|
|
*/
|
|
struct venc_frm_buf {
|
|
struct mtk_vcodec_fb fb_addr[MTK_VCODEC_MAX_PLANES];
|
|
};
|
|
|
|
/*
|
|
* struct venc_done_result - This is return information used in venc_if_encode()
|
|
* @bs_size: output bitstream size
|
|
* @is_key_frm: output is key frame or not
|
|
*/
|
|
struct venc_done_result {
|
|
unsigned int bs_size;
|
|
bool is_key_frm;
|
|
};
|
|
|
|
/*
|
|
* venc_if_init - Create the driver handle
|
|
* @ctx: device context
|
|
* @fourcc: encoder input format
|
|
* Return: 0 if creating handle successfully, otherwise it is failed.
|
|
*/
|
|
int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc);
|
|
|
|
/*
|
|
* venc_if_deinit - Release the driver handle
|
|
* @ctx: device context
|
|
* Return: 0 if releasing handle successfully, otherwise it is failed.
|
|
*/
|
|
int venc_if_deinit(struct mtk_vcodec_ctx *ctx);
|
|
|
|
/*
|
|
* venc_if_set_param - Set parameter to driver
|
|
* @ctx: device context
|
|
* @type: parameter type
|
|
* @in: input parameter
|
|
* Return: 0 if setting param successfully, otherwise it is failed.
|
|
*/
|
|
int venc_if_set_param(struct mtk_vcodec_ctx *ctx,
|
|
enum venc_set_param_type type,
|
|
struct venc_enc_param *in);
|
|
|
|
/*
|
|
* venc_if_encode - Encode one frame
|
|
* @ctx: device context
|
|
* @opt: encode frame option
|
|
* @frm_buf: input frame buffer information
|
|
* @bs_buf: output bitstream buffer infomraiton
|
|
* @result: encode result
|
|
* Return: 0 if encoding frame successfully, otherwise it is failed.
|
|
*/
|
|
int venc_if_encode(struct mtk_vcodec_ctx *ctx,
|
|
enum venc_start_opt opt,
|
|
struct venc_frm_buf *frm_buf,
|
|
struct mtk_vcodec_mem *bs_buf,
|
|
struct venc_done_result *result);
|
|
|
|
#endif /* _VENC_DRV_IF_H_ */
|