Add support for MT8196 video encoder
Subsystems (4)
v2 cover Add support for MT8196 video encoder
This patch series add support for MT8196 video encoder. patch 1~3: Add a new encoder driver interface for new VCP firmware. patch 4~6: Add MT8196 encoder driver platform data.
About adding new driver support, the v4l2-compliance report shows:
"Total for mtk-vcodec-enc device /dev/video3: 47, Succeeded: 46, Failed: 1, Warnings: 0" The 1 Failed case is not caused by current patch set.
This patch set depends on "media: mediatek: vcodec: support video decoder in mt8196"[1]
[1] https://patchwork.linuxtv.org/project/linux-media/list/?series=15232
Change in v2:
- Add support for VCP encode process.
- Add MT8196 encoder driver platform data.
- Rebase encoder patch onto decoder's patch set.
- Fix some review comments in v1.
Irui Wang (6):
media: mediatek: encoder: Add a new encoder driver interface
media: mediatek: encoder: Add support for common firmware interface
media: mediatek: encoder: Add support for VCP encode process
media: mediatek: encoder: Add a new platform data member
dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for
MT8196
media: mediatek: encoder: Add MT8196 encoder compatible data
.../media/mediatek,vcodec-encoder.yaml | 12 + .../mediatek/vcodec/common/mtk_vcodec_fw.c | 19 + .../mediatek/vcodec/common/mtk_vcodec_fw.h | 2 + .../vcodec/common/mtk_vcodec_fw_priv.h | 1 + .../vcodec/common/mtk_vcodec_fw_vcp.c | 6 + .../platform/mediatek/vcodec/encoder/Makefile | 1 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 28 + .../vcodec/encoder/mtk_vcodec_enc_drv.h | 15 +- .../vcodec/encoder/venc/venc_common_if.c | 678 ++++++++++++++++++ .../vcodec/encoder/venc/venc_h264_if.c | 8 +- .../mediatek/vcodec/encoder/venc_drv_if.c | 3 +- .../mediatek/vcodec/encoder/venc_drv_if.h | 11 +- .../mediatek/vcodec/encoder/venc_ipi_msg.h | 26 + .../mediatek/vcodec/encoder/venc_vpu_if.c | 51 +- 15 files changed, 843 insertions(+), 55 deletions(-) create mode 100644 drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if.c
Signature · 1 line
2.45.2
PATCH v2 1/6 media: mediatek: encoder: Add a new encoder driver interface
Introduce a new encoder kernel driver interface to ensure compatibility with the updated encoder software driver running in firmware. The new driver interface is expected to support more encoder formats, share more encode parameters between kernel and firmware.
--- .../mediatek/vcodec/common/mtk_vcodec_fw.c | 13 + .../mediatek/vcodec/common/mtk_vcodec_fw.h | 1 + .../platform/mediatek/vcodec/encoder/Makefile | 1 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 14 +- .../vcodec/encoder/mtk_vcodec_enc_drv.h | 8 +- .../vcodec/encoder/venc/venc_common_if.c | 667 ++++++++++++++++++ .../vcodec/encoder/venc/venc_h264_if.c | 8 +- .../mediatek/vcodec/encoder/venc_drv_if.h | 11 +- 8 files changed, 705 insertions(+), 18 deletions(-) create mode 100644 drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if.c
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c +13 -0
@@ -18,6 +18,19 @@ int mtk_vcodec_fw_get_ipi(enum mtk_vcodec_fw_type type, int hw_id) }EXPORT_SYMBOL_GPL (mtk_vcodec_fw_get_ipi); +int mtk_vcodec_fw_get_venc_ipi (enum mtk_vcodec_fw_type type) +{ +switch (type) { +case SCP : +return SCP_IPI_VENC_H264 ; +case VCP : +return VCP_IPI_ENCODER ; +default : +return -EINVAL ; + } +} +EXPORT_SYMBOL_GPL (mtk_vcodec_fw_get_venc_ipi); +struct mtk_vcodec_fw *mtk_vcodec_fw_select (void *priv,enum mtk_vcodec_fw_type type,enum mtk_vcodec_fw_use fw_use) {
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h +1 -0
@@ -42,5 +42,6 @@ int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id, void *buf, unsigned int len, unsigned int wait);int mtk_vcodec_fw_get_type (struct mtk_vcodec_fw *fw);int mtk_vcodec_fw_get_ipi (enum mtk_vcodec_fw_type type,int hw_id); +int mtk_vcodec_fw_get_venc_ipi (enum mtk_vcodec_fw_type type);#endif /* _MTK_VCODEC_FW_H_ */
drivers/media/platform/mediatek/vcodec/encoder/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-enc-y := venc/venc_vp8_if.o \ venc/venc_h264_if.o \ + venc/venc_common_if.o \ mtk_vcodec_enc.o \ mtk_vcodec_enc_drv.o \ mtk_vcodec_enc_pm.o \
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +8 -6
@@ -81,11 +81,11 @@ static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)break ;case V4L2_CID_MPEG_VIDEO_H264_PROFILE :mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d" , ctrl->val); - p->h264_profile = ctrl->val; + p->profile = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_LEVEL :mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d" , ctrl->val); - p->h264_level = ctrl->val; + p->level = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD :mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d" , ctrl->val);
@@ -386,8 +386,8 @@ static void mtk_venc_set_param(struct mtk_vcodec_enc_ctx *ctx,mtk_v4l2_venc_err (ctx,"Unsupported fourcc =%d" , q_data_src->fmt->fourcc);break ; } - param->h264_profile = enc_params->h264_profile; - param->h264_level = enc_params->h264_level; + param->profile = enc_params->profile; + param->level = enc_params->level;/* Config visible resolution */ param->width = q_data_src->visible_width;
@@ -403,8 +403,8 @@ static void mtk_venc_set_param(struct mtk_vcodec_enc_ctx *ctx,mtk_v4l2_venc_dbg (0 , ctx,"fmt 0x%x, P/L %d/%d w/h %d/%d buf %d/%d fps/bps %d/%d gop %d i_per %d" , - param->input_yuv_fmt, param->h264_profile, - param->h264_level, param->width, param->height, + param->input_yuv_fmt, param->profile, + param->level, param->width, param->height, param->buf_width, param->buf_height, param->frm_rate, param->bitrate, param->gop_size, param->intra_period);
@@ -1174,6 +1174,8 @@ static void mtk_venc_worker(struct work_struct *work) frm_buf.fb_addr[i].size = (size_t )src_buf->vb2_buf.planes[i].length; } + frm_buf.num_planes = src_buf->vb2_buf.num_planes; + bs_buf.va =vb2_plane_vaddr (&dst_buf->vb2_buf,0 ); bs_buf.dma_addr =vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,0 ); bs_buf.size = (size_t )dst_buf->vb2_buf.planes[0 ].length;
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +4 -4
@@ -69,8 +69,8 @@ enum mtk_encode_param {* @framerate_denom: frame rate denominator. ex: framerate_num=30 and * framerate_denom=1 means FPS is 30 * @h264_max_qp: Max value for H.264 quantization parameter -* @h264_profile: V4L2 defined H.264 profile -* @h264_level: V4L2 defined H.264 level +* @profile: V4L2 defined profile +* @level: V4L2 defined level * @force_intra: force/insert intra frame */ struct mtk_enc_params {
@@ -84,8 +84,8 @@ struct mtk_enc_params {unsigned int framerate_num;unsigned int framerate_denom;unsigned int h264_max_qp; -unsigned int h264_profile; -unsigned int h264_level; +unsigned int profile; +unsigned int level;unsigned int force_intra; };
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if.c new file +667 -0
667 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +4 -4
@@ -723,9 +723,9 @@ static void h264_enc_set_vsi_configs(struct venc_h264_inst *inst, inst->vsi->config.framerate = enc_prm->frm_rate; inst->vsi->config.intra_period = enc_prm->intra_period; inst->vsi->config.profile = -h264_get_profile (inst, enc_prm->h264_profile); +h264_get_profile (inst, enc_prm->profile); inst->vsi->config.level = -h264_get_level (inst, enc_prm->h264_level); +h264_get_level (inst, enc_prm->level); inst->vsi->config.wfd =0 ; }
@@ -742,9 +742,9 @@ static void h264_enc_set_vsi_34_configs(struct venc_h264_inst *inst, inst->vsi_34->config.framerate = enc_prm->frm_rate; inst->vsi_34->config.intra_period = enc_prm->intra_period; inst->vsi_34->config.profile = -h264_get_profile (inst, enc_prm->h264_profile); +h264_get_profile (inst, enc_prm->profile); inst->vsi_34->config.level = -h264_get_level (inst, enc_prm->h264_level); +h264_get_level (inst, enc_prm->level); inst->vsi_34->config.wfd =0 ; }
drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.h +7 -4
@@ -66,8 +66,8 @@ enum venc_set_param_type {* 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 +* @profile: V4L2 defined profile +* @level: V4L2 defined level * @width: image width * @height: image height * @buf_width: buffer width
@@ -79,8 +79,8 @@ enum venc_set_param_type {*/ struct venc_enc_param {enum venc_yuv_fmt input_yuv_fmt; -unsigned int h264_profile; -unsigned int h264_level; +unsigned int profile; +unsigned int level;unsigned int width;unsigned int height;unsigned int buf_width;
@@ -107,9 +107,11 @@ struct venc_frame_info {/* * struct venc_frm_buf - frame buffer information used in venc_if_encode() * @fb_addr: plane frame buffer addresses +* @num_planes: number of planes */ struct venc_frm_buf {struct mtk_vcodec_fb fb_addr[MTK_VCODEC_MAX_PLANES ]; +unsigned int num_planes; };/*
@@ -124,6 +126,7 @@ struct venc_done_result {extern const struct venc_common_if venc_h264_if;extern const struct venc_common_if venc_vp8_if; +extern const struct venc_common_if venc_if;/* * venc_if_init - Create the driver handle
Signature · 1 line
2.45.2
PATCH v2 2/6 media: mediatek: encoder: Add support for common firmware interface
In reply to Irui WangThe existing encoder firmware interface implied just one type of codec:
H.264. Future encoders may support additional codecs; however adding entire sets of interfaces for them is not scalable.
Instead, a new "common" firmware interface is defined for non codec specific messages. The new messages encapsulate the old ones for backward compatibility.
This patch adds support for these new messages.
--- .../vcodec/encoder/mtk_vcodec_enc_drv.h | 3 ++ .../mediatek/vcodec/encoder/venc_drv_if.c | 3 +- .../mediatek/vcodec/encoder/venc_ipi_msg.h | 26 +++++++++++++ .../mediatek/vcodec/encoder/venc_vpu_if.c | 37 ++++++++++++------- 4 files changed, 54 insertions(+), 15 deletions(-)
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +3 -0
@@ -16,6 +16,7 @@#define MTK_ENC_CTX_IS_EXT (ctx) ((ctx)->dev->venc_pdata->uses_ext)#define MTK_ENC_IOVA_IS_34BIT (ctx) ((ctx)->dev->venc_pdata->uses_34bit) +#define MTK_ENC_DRV_IS_COMM (ctx) (((ctx)->dev->venc_pdata->uses_common_fw_iface))/** * struct mtk_vcodec_enc_pdata - compatible data for each IC
@@ -29,6 +30,7 @@* @num_output_formats: number of entries in output_formats * @core_id: stand for h264 or vp8 encode index * @uses_34bit: whether the encoder uses 34-bit iova +* @uses_common_fw_iface: whether the encoder uses common driver interface */ struct mtk_vcodec_enc_pdata {bool uses_ext;
@@ -40,6 +42,7 @@ struct mtk_vcodec_enc_pdata {size_t num_output_formats;u8 core_id;bool uses_34bit; +bool uses_common_fw_iface; };/*
drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c +2 -1
@@ -19,13 +19,14 @@int venc_if_init (struct mtk_vcodec_enc_ctx *ctx,unsigned int fourcc) {int ret =0 ; +const bool uses_common_fw_iface =MTK_ENC_DRV_IS_COMM (ctx);switch (fourcc) {case V4L2_PIX_FMT_VP8 : ctx->enc_if = &venc_vp8_if;break ;case V4L2_PIX_FMT_H264 : - ctx->enc_if = &venc_h264_if; + ctx->enc_if = uses_common_fw_iface ? &venc_if : &venc_h264_if;break ;default :return -EINVAL ;
drivers/media/platform/mediatek/vcodec/encoder/venc_ipi_msg.h +26 -0
@@ -45,6 +45,20 @@ struct venc_ap_ipi_msg_init {uint64_t venc_inst; }; +/** +* struct venc_ap_ipi_msg_init_comm - AP to VPU init cmd structure +* @base: AP to VPU init cmd structure +* @codec_type: encoder type +* @reserved: reserved field +* @shared_iova: shared iova +*/ +struct venc_ap_ipi_msg_init_comm { +struct venc_ap_ipi_msg_init base; +u32 codec_type; +u32 reserved; +u64 shared_iova; +}; +/** * struct venc_ap_ipi_msg_set_param - AP to VPU set_param cmd structure * @msg_id: message id (AP_IPIMSG_XXX_ENC_SET_PARAM)
@@ -175,6 +189,18 @@ struct venc_vpu_ipi_msg_init {uint32_t venc_abi_version; }; +/** +* struct venc_vpu_ipi_msg_init_comm - VPU ack AP init cmd structure +* @init_ack: AP init cmd structure +* @vpu_vsi_addr: VSI address from VPU +* @reserved: reserved field +*/ +struct venc_vpu_ipi_msg_init_comm { +struct venc_vpu_ipi_msg_init init_ack; +u32 vpu_vsi_addr; +u32 reserved; +}; +/** * struct venc_vpu_ipi_msg_set_param - VPU ack AP set_param cmd structure * @msg_id: message id (VPU_IPIMSG_XXX_ENC_SET_PARAM_DONE)
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c +23 -14
@@ -10,24 +10,25 @@static void handle_enc_init_msg (struct venc_vpu_inst *vpu,const void *data) { -const struct venc_vpu_ipi_msg_init *msg = data; +const struct venc_vpu_ipi_msg_init_comm *msg = data; +struct mtk_vcodec_fw *fw = vpu->ctx->dev->fw_handler; - vpu->inst_addr = msg->vpu_inst_addr; - vpu->vsi =mtk_vcodec_fw_map_dm_addr (vpu->ctx->dev->fw_handler, - msg->vpu_inst_addr); + vpu->inst_addr = msg->init_ack.vpu_inst_addr; + vpu->vsi =mtk_vcodec_fw_map_dm_addr (fw, vpu->inst_addr);/* Firmware version field value is unspecified on MT8173. */ -if (mtk_vcodec_fw_get_type (vpu->ctx->dev->fw_handler) ==VPU ) +if (mtk_vcodec_fw_get_type (fw) ==VPU )return ;/* Check firmware version. */ -mtk_venc_debug (vpu->ctx,"firmware version: 0x%x\n" , msg->venc_abi_version); -switch (msg->venc_abi_version) { +mtk_venc_debug (vpu->ctx,"firmware version: 0x%x\n" , + msg->init_ack.venc_abi_version); +switch (msg->init_ack.venc_abi_version) {case 1 :break ;default :mtk_venc_err (vpu->ctx,"unhandled firmware version 0x%x\n" , - msg->venc_abi_version); + msg->init_ack.venc_abi_version); vpu->failure =1 ;break ; }
@@ -132,7 +133,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,int vpu_enc_init (struct venc_vpu_inst *vpu) {int status; -struct venc_ap_ipi_msg_init out; +size_t msg_size; +struct venc_ap_ipi_msg_init_comm out;init_waitqueue_head (&vpu->wq_hd); vpu->signaled =0 ;
@@ -149,9 +151,16 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) }memset (&out,0 ,sizeof (out)); - out.msg_id =AP_IPIMSG_ENC_INIT ; - out.venc_inst = (unsigned long )vpu; -if (vpu_enc_send_msg (vpu, &out,sizeof (out))) { + out.base.msg_id =AP_IPIMSG_ENC_INIT ; + out.base.venc_inst = (unsigned long )vpu; +if (MTK_ENC_DRV_IS_COMM (vpu->ctx)) { + out.codec_type = vpu->ctx->q_data[MTK_Q_DATA_DST ].fmt->fourcc; + msg_size =sizeof (struct venc_ap_ipi_msg_init_comm ); + }else { + msg_size =sizeof (struct venc_ap_ipi_msg_init ); + } + +if (vpu_enc_send_msg (vpu, &out, msg_size)) {mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_INIT fail" );return -EINVAL ; }
@@ -260,7 +269,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu,sizeof (struct venc_ap_ipi_msg_enc );struct venc_ap_ipi_msg_enc_ext out; -mtk_venc_debug (vpu->ctx,"bs_mode %d ->" , bs_mode); +mtk_venc_debug (vpu->ctx,"%s, bs_mode %d ->" , __func__, bs_mode);memset (&out,0 ,sizeof (out)); out.base.msg_id =AP_IPIMSG_ENC_ENCODE ;
@@ -305,7 +314,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu,struct venc_ap_ipi_msg_enc_ext_34 out;size_t msg_size =sizeof (struct venc_ap_ipi_msg_enc_ext_34 ); -mtk_venc_debug (vpu->ctx,"bs_mode %d ->" , bs_mode); +mtk_venc_debug (vpu->ctx,"%s, bs_mode %d ->" , __func__, bs_mode);memset (&out,0 ,sizeof (out)); out.msg_id =AP_IPIMSG_ENC_ENCODE ;
Signature · 1 line
2.45.2
PATCH v2 3/6 media: mediatek: encoder: Add support for VCP encode process
In reply to Irui WangWhen encoding by VCP interface, encoder driver need change to VCP path:
Firstly, set encoder driver fw type to 'VCP'. Then, allocate RC buffers by the VCP device. Finally, send the shared memory address into VCP and map the encoder vsi address by the VCP shared memory address.
--- .../mediatek/vcodec/common/mtk_vcodec_fw.c | 6 +++++ .../mediatek/vcodec/common/mtk_vcodec_fw.h | 1 + .../vcodec/common/mtk_vcodec_fw_priv.h | 1 + .../vcodec/common/mtk_vcodec_fw_vcp.c | 6 +++++ .../vcodec/encoder/mtk_vcodec_enc_drv.c | 3 +++ .../vcodec/encoder/venc/venc_common_if.c | 23 ++++++++++++++----- .../mediatek/vcodec/encoder/venc_vpu_if.c | 14 ++++++++++- 7 files changed, 47 insertions(+), 7 deletions(-)
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.c +6 -0
@@ -105,3 +105,9 @@ int mtk_vcodec_fw_get_type(struct mtk_vcodec_fw *fw)return fw->type; }EXPORT_SYMBOL_GPL (mtk_vcodec_fw_get_type); + +struct device *mtk_vcodec_fw_get_dev (struct mtk_vcodec_fw *fw) +{ +return fw->ops->get_fw_dev (fw); +} +EXPORT_SYMBOL_GPL (mtk_vcodec_fw_get_dev);
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw.h +1 -0
@@ -43,5 +43,6 @@ int mtk_vcodec_fw_ipi_send(struct mtk_vcodec_fw *fw, int id,int mtk_vcodec_fw_get_type (struct mtk_vcodec_fw *fw);int mtk_vcodec_fw_get_ipi (enum mtk_vcodec_fw_type type,int hw_id);int mtk_vcodec_fw_get_venc_ipi (enum mtk_vcodec_fw_type type); +struct device *mtk_vcodec_fw_get_dev (struct mtk_vcodec_fw *fw);#endif /* _MTK_VCODEC_FW_H_ */
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_priv.h +1 -0
@@ -29,6 +29,7 @@ struct mtk_vcodec_fw_ops {int (*ipi_send)(struct mtk_vcodec_fw *fw,int id,void *buf,unsigned int len,unsigned int wait);void (*release)(struct mtk_vcodec_fw *fw); +struct device *(*get_fw_dev)(struct mtk_vcodec_fw *fw); };#if IS_ENABLED (CONFIG_VIDEO_MEDIATEK_VCODEC_VPU )
drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_vcp.c +6 -0
@@ -432,6 +432,11 @@ static void mtk_vcodec_vcp_release(struct mtk_vcodec_fw *fw) { } +static struct device *mtk_vcodec_vcp_get_fw_dev (struct mtk_vcodec_fw *fw) +{ +return fw->vcp->vcp_device->dev; +} +static const struct mtk_vcodec_fw_ops mtk_vcodec_vcp_msg = { .load_firmware = mtk_vcodec_vcp_load_firmware, .get_vdec_capa = mtk_vcodec_vcp_get_vdec_capa,
@@ -440,6 +445,7 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vcp_msg = { .ipi_register = mtk_vcodec_vcp_set_ipi_register, .ipi_send = mtk_vcodec_vcp_ipi_send, .release = mtk_vcodec_vcp_release, + .get_fw_dev = mtk_vcodec_vcp_get_fw_dev, };struct mtk_vcodec_fw *mtk_vcodec_fw_vcp_init (void *priv,enum mtk_vcodec_fw_use fw_use)
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +3 -0
@@ -252,6 +252,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev) }else if (!of_property_read_u32 (pdev->dev.of_node,"mediatek,scp" , &rproc_phandle)) { fw_type =SCP ; + }else if (!of_property_read_u32 (pdev->dev.of_node,"mediatek,vcp" , + &rproc_phandle)) { + fw_type =VCP ; }else {dev_err (&pdev->dev,"[MTK VCODEC] Could not get venc IPI device" );return -ENODEV ;
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if.c +17 -6
@@ -478,8 +478,13 @@ static void venc_free_rc_buf(struct venc_inst *inst, {int i;struct device *dev; +struct mtk_vcodec_fw *fw = inst->ctx->dev->fw_handler; + +if (mtk_vcodec_fw_get_type (fw) ==VCP ) + dev =mtk_vcodec_fw_get_dev (fw); +else + dev = &inst->ctx->dev->plat_dev->dev; - dev = &inst->ctx->dev->plat_dev->dev;mtk_venc_mem_free (inst, dev, &bufs->rc_code);for (i =0 ; i < core_num; i++)
@@ -528,12 +533,18 @@ static int venc_alloc_rc_buf(struct venc_inst *inst,struct device *dev;void *tmp_va; - dev = &inst->ctx->dev->plat_dev->dev; -if (mtk_venc_mem_alloc (inst, dev, &bufs->rc_code)) -return -ENOMEM ; +if (mtk_vcodec_fw_get_type (fw) ==VCP ) { + dev =mtk_vcodec_fw_get_dev (fw); +if (mtk_venc_mem_alloc (inst, dev, &bufs->rc_code)) +return -ENOMEM ; + }else { + dev = &inst->ctx->dev->plat_dev->dev; +if (mtk_venc_mem_alloc (inst, dev, &bufs->rc_code)) +return -ENOMEM ; - tmp_va =mtk_vcodec_fw_map_dm_addr (fw, bufs->rc_code.pa); -memcpy (bufs->rc_code.va, tmp_va, bufs->rc_code.size); + tmp_va =mtk_vcodec_fw_map_dm_addr (fw, bufs->rc_code.pa); +memcpy (bufs->rc_code.va, tmp_va, bufs->rc_code.size); + }for (i =0 ; i < core_num; i++) {if (mtk_venc_mem_alloc (inst, dev, &bufs->rc_info[i]))
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c +13 -1
@@ -8,13 +8,23 @@#include "venc_ipi_msg.h" #include "venc_vpu_if.h" +#define VSI_OFFSET_MASK 0x0FFFFFFF +static void handle_enc_init_msg (struct venc_vpu_inst *vpu,const void *data) {const struct venc_vpu_ipi_msg_init_comm *msg = data;struct mtk_vcodec_fw *fw = vpu->ctx->dev->fw_handler; +u64 pa_start, vsi_offset; vpu->inst_addr = msg->init_ack.vpu_inst_addr; - vpu->vsi =mtk_vcodec_fw_map_dm_addr (fw, vpu->inst_addr); + +if (mtk_vcodec_fw_get_type (fw) ==VCP ) { + pa_start = (u64 )fw->vcp->iova_addr; + vsi_offset = (msg->vpu_vsi_addr &VSI_OFFSET_MASK ) - (pa_start &VSI_OFFSET_MASK ); + vpu->vsi =mtk_vcodec_fw_map_dm_addr (fw,ENCODER_MEM ) + vsi_offset; + }else { + vpu->vsi =mtk_vcodec_fw_map_dm_addr (fw, vpu->inst_addr); + }/* Firmware version field value is unspecified on MT8173. */ if (mtk_vcodec_fw_get_type (fw) ==VPU )
@@ -155,6 +165,8 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) out.base.venc_inst = (unsigned long )vpu;if (MTK_ENC_DRV_IS_COMM (vpu->ctx)) { out.codec_type = vpu->ctx->q_data[MTK_Q_DATA_DST ].fmt->fourcc; +if (mtk_vcodec_fw_get_type (vpu->ctx->dev->fw_handler) ==VCP ) + out.shared_iova = vpu->ctx->dev->fw_handler->vcp->iova_addr; msg_size =sizeof (struct venc_ap_ipi_msg_init_comm ); }else { msg_size =sizeof (struct venc_ap_ipi_msg_init );
Signature · 1 line
2.45.2
PATCH v2 4/6 media: mediatek: encoder: Add a new platform data member
In reply to Irui WangAdd a new platform data member to indicate each encoder IC, so that the get chip name function by 'of_device_is_compatible' can be removed.
--- .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 23 ++----------------- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 6 +++++ .../vcodec/encoder/mtk_vcodec_enc_drv.h | 2 ++ 3 files changed, 10 insertions(+), 21 deletions(-)
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +2 -21
@@ -198,34 +198,15 @@ static int vidioc_enum_fmt_vid_out(struct file *file, void *priv, pdata->num_output_formats); } -static int mtk_vcodec_enc_get_chip_name (void *priv) -{ -struct mtk_vcodec_enc_ctx *ctx =fh_to_enc_ctx (priv); -struct device *dev = &ctx->dev->plat_dev->dev; - -if (of_device_is_compatible (dev->of_node,"mediatek,mt8173-vcodec-enc" )) -return 8173 ; -else if (of_device_is_compatible (dev->of_node,"mediatek,mt8183-vcodec-enc" )) -return 8183 ; -else if (of_device_is_compatible (dev->of_node,"mediatek,mt8192-vcodec-enc" )) -return 8192 ; -else if (of_device_is_compatible (dev->of_node,"mediatek,mt8195-vcodec-enc" )) -return 8195 ; -else if (of_device_is_compatible (dev->of_node,"mediatek,mt8188-vcodec-enc" )) -return 8188 ; -else -return 8173 ; -} -static int vidioc_venc_querycap (struct file *file,void *priv,struct v4l2_capability *cap) {struct mtk_vcodec_enc_ctx *ctx =fh_to_enc_ctx (priv); +const struct mtk_vcodec_enc_pdata *pdata = ctx->dev->venc_pdata;struct device *dev = &ctx->dev->plat_dev->dev; -int platform_name =mtk_vcodec_enc_get_chip_name (priv);strscpy (cap->driver, dev->driver->name,sizeof (cap->driver)); -snprintf (cap->card,sizeof (cap->card),"MT%d video encoder" , platform_name); +snprintf (cap->card,sizeof (cap->card),"MT%d video encoder" , pdata->venc_model_num);return 0 ; }
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +6 -0
@@ -380,6 +380,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) }static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = { + .venc_model_num =8173 , .capture_formats = mtk_video_formats_capture_h264, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264), .output_formats = mtk_video_formats_output,
@@ -390,6 +391,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_avc_pdata = { };static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { + .venc_model_num =8173 , .capture_formats = mtk_video_formats_capture_vp8, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_vp8), .output_formats = mtk_video_formats_output,
@@ -400,6 +402,7 @@ static const struct mtk_vcodec_enc_pdata mt8173_vp8_pdata = { };static const struct mtk_vcodec_enc_pdata mt8183_pdata = { + .venc_model_num =8183 , .uses_ext = true, .capture_formats = mtk_video_formats_capture_h264, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264),
@@ -411,6 +414,7 @@ static const struct mtk_vcodec_enc_pdata mt8183_pdata = { };static const struct mtk_vcodec_enc_pdata mt8188_pdata = { + .venc_model_num =8188 , .uses_ext = true, .capture_formats = mtk_video_formats_capture_h264, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264),
@@ -423,6 +427,7 @@ static const struct mtk_vcodec_enc_pdata mt8188_pdata = { };static const struct mtk_vcodec_enc_pdata mt8192_pdata = { + .venc_model_num =8192 , .uses_ext = true, .capture_formats = mtk_video_formats_capture_h264, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264),
@@ -434,6 +439,7 @@ static const struct mtk_vcodec_enc_pdata mt8192_pdata = { };static const struct mtk_vcodec_enc_pdata mt8195_pdata = { + .venc_model_num =8195 , .uses_ext = true, .capture_formats = mtk_video_formats_capture_h264, .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264),
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +2 -0
@@ -21,6 +21,7 @@/** * struct mtk_vcodec_enc_pdata - compatible data for each IC * +* @venc_model_num: encoder model number * @uses_ext: whether the encoder uses the extended firmware messaging format * @min_bitrate: minimum supported encoding bitrate * @max_bitrate: maximum supported encoding bitrate
@@ -33,6 +34,7 @@* @uses_common_fw_iface: whether the encoder uses common driver interface */ struct mtk_vcodec_enc_pdata { +u16 venc_model_num;bool uses_ext;u64 min_bitrate;u64 max_bitrate;
Signature · 1 line
2.45.2
PATCH v2 5/6 dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
In reply to Irui WangAdd MT8196 encoder compatible string, which will reference VCP device.
--- .../bindings/media/mediatek,vcodec-encoder.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +12 -0
@@ -24,6 +24,7 @@ properties: - mediatek,mt8188-vcodec-enc - mediatek,mt8192-vcodec-enc - mediatek,mt8195-vcodec-enc + - mediatek,mt8196-vcodec-enc - items: - const: mediatek,mt8186-vcodec-enc - const: mediatek,mt8183-vcodec-enc
@@ -76,6 +77,17 @@ required: - iommus allOf: + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8196-vcodec-enc + + then: + required: + - mediatek,vcp + - if: properties: compatible:
Signature · 1 line
2.45.2
Rob Herring
maintainerRe: [PATCH v2 5/6] dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
Quoted 23 lines · Irui Wang
Add MT8196 encoder compatible string, which will reference VCP device.
Signed-off-by Irui Wang <[email protected]>--- .../bindings/media/mediatek,vcodec-encoder.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +1
-0@@ -24,6 +24,7 @@ properties: - mediatek,mt8188-vcodec-enc - mediatek,mt8192-vcodec-enc - mediatek,mt8195-vcodec-enc + - mediatek,mt8196-vcodec-enc - items: - const: mediatek,mt8186-vcodec-enc - const: mediatek,mt8183-vcodec-enc@@ -76,6 +77,17 @@ required: - iommus allOf:
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml required: · line 89
Quoted 10 lines
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +10
-0+ - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8196-vcodec-enc + + then: + required: + - mediatek,vcp
Where is this property defined?
Quoted 7 lines
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +1
-0+ - if: properties: compatible:Signature · 1 line
2.45.2
Re: [PATCH v2 5/6] dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
Dear Rob,
Thanks for your reviewing.
Quoted 35 lines · Rob Herring
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 30 lines · Irui Wang
Add MT8196 encoder compatible string, which will reference VCP device.
Signed-off-by Irui Wang <[email protected]>--- .../bindings/media/mediatek,vcodec-encoder.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-
encoder.yamlb/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
indexebc615584f92..7675391d7eb0100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yamlDocumentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +1
-0@@ -24,6 +24,7 @@ properties: - mediatek,mt8188-vcodec-enc - mediatek,mt8192-vcodec-enc - mediatek,mt8195-vcodec-enc + - mediatek,mt8196-vcodec-enc - items: - const: mediatek,mt8186-vcodec-enc - const: mediatek,mt8183-vcodec-enc@@ -76,6 +77,17 @@ required: - iommus
Quoted 13 lines
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml required: · line 89
Quoted 11 lines
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +10
-0allOf: + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8196-vcodec-enc + + then: + required: + - mediatek,vcpWhere is this property defined?
The definition is missing, we will add it in next patch.
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +1
-1+ - if: properties: compatible: --2.45.2
Rob Herring
maintainerRe: [PATCH v2 5/6] dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
In reply to Irui WangQuoted 1 line · Irui Wang
Add MT8196 encoder compatible string, which will reference VCP device.
Also work on your subject. No need to say dt-bindings and encoder twice:
media: dt-bindings: mediatek,vcodec-encoder: Add MT8196
Quoted 39 lines
Signed-off-by Irui Wang <[email protected]>--- .../bindings/media/mediatek,vcodec-encoder.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +12
-0@@ -24,6 +24,7 @@ properties: - mediatek,mt8188-vcodec-enc - mediatek,mt8192-vcodec-enc - mediatek,mt8195-vcodec-enc + - mediatek,mt8196-vcodec-enc - items: - const: mediatek,mt8186-vcodec-enc - const: mediatek,mt8183-vcodec-enc@@ -76,6 +77,17 @@ required: - iommus allOf: + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8196-vcodec-enc + + then: + required: + - mediatek,vcp + - if: properties: compatible:Signature · 1 line
2.45.2
Re: [PATCH v2 5/6] dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
Quoted 4 lines · Rob Herring
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 8 lines
Quoted 2 lines · Irui Wang
Add MT8196 encoder compatible string, which will reference VCP device.
Also work on your subject. No need to say dt-bindings and encoder twice:
media: dt-bindings: mediatek,vcodec-encoder: Add MT8196
OK, thanks. will fix it in next patch.
Quoted 47 lines
Quoted 47 lines
Signed-off-by Irui Wang <[email protected]>--- .../bindings/media/mediatek,vcodec-encoder.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+)diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-
encoder.yamlb/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
indexebc615584f92..7675391d7eb0100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-encoder.yamlDocumentation/devicetree/bindings/media/mediatek,vcodec-encoder.yaml +12
-1@@ -24,6 +24,7 @@ properties: - mediatek,mt8188-vcodec-enc - mediatek,mt8192-vcodec-enc - mediatek,mt8195-vcodec-enc + - mediatek,mt8196-vcodec-enc - items: - const: mediatek,mt8186-vcodec-enc - const: mediatek,mt8183-vcodec-enc@@ -76,6 +77,17 @@ required: - iommus allOf: + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8196-vcodec-enc + + then: + required: + - mediatek,vcp + - if: properties: compatible: --2.45.2
PATCH v2 6/6 media: mediatek: encoder: Add MT8196 encoder compatible data
In reply to Irui WangMT8196 encoder use common firmware interface, add compatible data to support MT8196 encoding, and need set dma mask to support 34bit.
--- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 19 +++++++++++++++++++ .../vcodec/encoder/mtk_vcodec_enc_drv.h | 2 ++ 2 files changed, 21 insertions(+)
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +19 -0
@@ -20,6 +20,8 @@#include "mtk_vcodec_enc_pm.h" #include "../common/mtk_vcodec_intr.h" +#define VENC_DMA_BIT_MASK 34 +static const struct mtk_video_fmt mtk_video_formats_output[] = { { .fourcc =V4L2_PIX_FMT_NV12M ,
@@ -299,6 +301,9 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_res; } +if (dev->venc_pdata->set_dma_bit_mask) +dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (VENC_DMA_BIT_MASK )); +mutex_init (&dev->enc_mutex);mutex_init (&dev->dev_mutex);mutex_init (&dev->dev_ctx_lock);
@@ -450,6 +455,19 @@ static const struct mtk_vcodec_enc_pdata mt8195_pdata = { .core_id = VENC_SYS, }; +static const struct mtk_vcodec_enc_pdata mt8196_pdata = { + .venc_model_num =8196 , + .capture_formats = mtk_video_formats_capture_h264, + .num_capture_formats =ARRAY_SIZE (mtk_video_formats_capture_h264), + .output_formats = mtk_video_formats_output, + .num_output_formats =ARRAY_SIZE (mtk_video_formats_output), + .min_bitrate =64 , + .max_bitrate =100000000 , + .core_id =VENC_SYS , + .uses_common_fw_iface = true, + .set_dma_bit_mask = true, +}; +static const struct of_device_id mtk_vcodec_enc_match[] = { {.compatible ="mediatek,mt8173-vcodec-enc" , .data = &mt8173_avc_pdata},
@@ -459,6 +477,7 @@ static const struct of_device_id mtk_vcodec_enc_match[] = { {.compatible = "mediatek,mt8188-vcodec-enc", .data = &mt8188_pdata}, {.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata}, {.compatible = "mediatek,mt8195-vcodec-enc", .data = &mt8195_pdata}, + {.compatible = "mediatek,mt8196-vcodec-enc", .data = &mt8196_pdata}, {}, };MODULE_DEVICE_TABLE (of, mtk_vcodec_enc_match);
drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h +2 -0
@@ -32,6 +32,7 @@* @core_id: stand for h264 or vp8 encode index * @uses_34bit: whether the encoder uses 34-bit iova * @uses_common_fw_iface: whether the encoder uses common driver interface +* @set_dma_bit_mask: whether the encoder need set extra DMA bit mask */ struct mtk_vcodec_enc_pdata {u16 venc_model_num;
@@ -45,6 +46,7 @@ struct mtk_vcodec_enc_pdata {u8 core_id;bool uses_34bit;bool uses_common_fw_iface; +bool set_dma_bit_mask; };/*
Signature · 1 line
2.45.2
Hi,
Le mercredi 28 mai 2025 à 14:36 +0800, Irui Wang a écrit :
Quoted 7 lines
This patch series add support for MT8196 video encoder. patch 1~3: Add a new encoder driver interface for new VCP firmware. patch 4~6: Add MT8196 encoder driver platform data.
About adding new driver support, the v4l2-compliance report shows:
"Total for mtk-vcodec-enc device/dev/video3: 47, Succeeded: 46, Failed: 1, Warnings: 0" The 1 Failed case is not caused by current patch set.
We really want to see the full report, simply reply to this cover letter with the entire report to fix it.
Nicolas
Quoted 37 lines
This patch set depends on "media: mediatek: vcodec: support video decoder in mt8196"[1]
[1] https://patchwork.linuxtv.org/project/linux-media/list/?series=15232
Change in v2:
- Add support for VCP encode process.
- Add MT8196 encoder driver platform data.
- Rebase encoder patch onto decoder's patch set.
- Fix some review comments in v1.Irui Wang (6):
media: mediatek: encoder: Add a new encoder driver interface
media: mediatek: encoder: Add support for common firmware interface
media: mediatek: encoder: Add support for VCP encode process
media: mediatek: encoder: Add a new platform data member
dt-bindings: media: mediatek: encoder: Add encoder dt-bindings for MT8196
media: mediatek: encoder: Add MT8196 encoder compatible data.../media/mediatek,vcodec-encoder.yaml | 12 + .../mediatek/vcodec/common/mtk_vcodec_fw.c | 19 + .../mediatek/vcodec/common/mtk_vcodec_fw.h | 2 + .../vcodec/common/mtk_vcodec_fw_priv.h | 1 + .../vcodec/common/mtk_vcodec_fw_vcp.c | 6 + .../platform/mediatek/vcodec/encoder/Makefile | 1 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 28 + .../vcodec/encoder/mtk_vcodec_enc_drv.h | 15 +- .../vcodec/encoder/venc/venc_common_if.c | 678 ++++++++++++++++++ .../vcodec/encoder/venc/venc_h264_if.c | 8 +- .../mediatek/vcodec/encoder/venc_drv_if.c | 3 +- .../mediatek/vcodec/encoder/venc_drv_if.h | 11 +- .../mediatek/vcodec/encoder/venc_ipi_msg.h | 26 + .../mediatek/vcodec/encoder/venc_vpu_if.c | 51 +-
15 files changed, 843 insertions(+), 55 deletions(-)create mode 100644
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if.c
Dear Nicolas,
Thank you for your reply.
the failed case is VIDIOC_(UN)SUBSCRIBE_EVENT
fail: v4l2-test-controls.cpp(1171): node->codec_mask &
STATEFUL_ENCODER
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
because encoder driver is not register v4l2_ioctl_ops .vidioc_(un)subscribe_event
The full report is below:
v4l2-compliance -d /dev/video3
v4l2-compliance 1.28.1, 64 bits, 64-bit time_t
Compliance test for mtk-vcodec-enc device /dev/video3:
Driver Info:
Driver name : mtk-vcodec-enc
Card type : MT8196 video encoder
Bus info : platform:38020000.video-codec
Driver version : 6.6.76
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Encoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video3 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
fail: v4l2-test-controls.cpp(1171): node->codec_mask &STATEFUL_ENCODER
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 16 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK
test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for mtk-vcodec-enc device /dev/video3: 47, Succeeded: 46, Failed:
1, Warnings:0
Quoted 66 lines · Nicolas Dufresne
External email : Please do not click links or open attachments until you have verified the sender or the content.
Hi,
Quoted 8 lines · Irui Wang
This patch series add support for MT8196 video encoder. patch 1~3: Add a new encoder driver interface for new VCP firmware. patch 4~6: Add MT8196 encoder driver platform data.
About adding new driver support, the v4l2-compliance report shows:
"Total for mtk-vcodec-enc device/dev/video3: 47, Succeeded: 46,
Failed: 1, Warnings: 0"
The 1 Failed case is not caused by current patch set.We really want to see the full report, simply reply to this cover letter with
the entire report to fix it.Nicolas
Quoted 44 lines
This patch set depends on "media: mediatek: vcodec: support video decoder in mt8196"[1]
Change in v2:
- Add support for VCP encode process.
- Add MT8196 encoder driver platform data.
- Rebase encoder patch onto decoder's patch set.
- Fix some review comments in v1.Irui Wang (6):
media: mediatek: encoder: Add a new encoder driver interface
media: mediatek: encoder: Add support for common firmware
interface
media: mediatek: encoder: Add support for VCP encode process
media: mediatek: encoder: Add a new platform data member
dt-bindings: media: mediatek: encoder: Add encoder dt-bindings
forMT8196media: mediatek: encoder: Add MT8196 encoder compatible data
.../media/mediatek,vcodec-encoder.yaml | 12 + .../mediatek/vcodec/common/mtk_vcodec_fw.c | 19 + .../mediatek/vcodec/common/mtk_vcodec_fw.h | 2 + .../vcodec/common/mtk_vcodec_fw_priv.h | 1 + .../vcodec/common/mtk_vcodec_fw_vcp.c | 6 + .../platform/mediatek/vcodec/encoder/Makefile | 1 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 28 + .../vcodec/encoder/mtk_vcodec_enc_drv.h | 15 +- .../vcodec/encoder/venc/venc_common_if.c | 678 ++++++++++++++++++ .../vcodec/encoder/venc/venc_h264_if.c | 8 +- .../mediatek/vcodec/encoder/venc_drv_if.c | 3 +- .../mediatek/vcodec/encoder/venc_drv_if.h | 11 +- .../mediatek/vcodec/encoder/venc_ipi_msg.h | 26 + .../mediatek/vcodec/encoder/venc_vpu_if.c | 51 +- 15 files changed, 843 insertions(+), 55 deletions(-) create mode 100644
drivers/media/platform/mediatek/vcodec/encoder/venc/venc_common_if. c