media: mtk-vcodec: venc: variouse bug fixes
Subsystems (2)
cover media: mtk-vcodec: venc: variouse bug fixes
Some bug fixes mainly in case of error handling
Dafna Hirschfeld (5):
media: mtk-vcodec: enter ABORT state if encoding failed
media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is
released
media: mtk-vcodec: change the venc handler funcs to return int
media: mtk-vcodec: Add two error cases upon vpu irq handling
media: mtk-vcodec: venc: Fail if a msg sent to VPU was not signaled
.../platform/mtk-vcodec/mtk_vcodec_enc.c | 1 + .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 +- .../media/platform/mtk-vcodec/venc_vpu_if.c | 27 +++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-)
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 1/5 media: mtk-vcodec: enter ABORT state if encoding failed
In case the encoding failed, we should set ctx->state = MTK_STATE_ABORT, since this indicates a fatal error and there is no point to continue trying to encode in that case.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +1 -0
@@ -1109,6 +1109,7 @@ static void mtk_venc_worker(struct work_struct *work) dst_buf->vb2_buf.planes[0 ].bytesused =0 ;v4l2_m2m_buf_done (dst_buf,VB2_BUF_STATE_ERROR );mtk_v4l2_err ("venc_if_encode failed=%d" , ret); + ctx->state =MTK_STATE_ABORT ; }else {v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_DONE ); dst_buf->vb2_buf.planes[0 ].bytesused = enc_result.bs_size;
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 2/5 media: mtk-vcodec: call v4l2_m2m_ctx_release first when file is released
In reply to Dafna HirschfeldThe func v4l2_m2m_ctx_release waits for currently running jobs to finish and then stop streaming both queues and frees the buffers. All this should be done before the call to mtk_vcodec_enc_release which frees the encoder handler. This fixes use-after-free bug.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +1 -1
@@ -218,11 +218,11 @@ static int fops_vcodec_release(struct file *file)mtk_v4l2_debug (1 ,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex); +v4l2_m2m_ctx_release (ctx->m2m_ctx);mtk_vcodec_enc_release (ctx);v4l2_fh_del (&ctx->fh);v4l2_fh_exit (&ctx->fh);v4l2_ctrl_handler_free (&ctx->ctrl_hdl); -v4l2_m2m_ctx_release (ctx->m2m_ctx);list_del_init (&ctx->list);kfree (ctx);
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 3/5 media: mtk-vcodec: change the venc handler funcs to return int
In reply to Dafna HirschfeldCurrently the functions handle_enc_init_msg, handle_enc_encode_msg return void and set vpu->failure to 1 in case of failure. Instead, change the functions to return non 0 in case of failure and then the vpu->failure is updated to their return value.
--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +8 -7
@@ -9,7 +9,7 @@#include "venc_ipi_msg.h" #include "venc_vpu_if.h" -static void handle_enc_init_msg (struct venc_vpu_inst *vpu,const void *data) +static int handle_enc_init_msg (struct venc_vpu_inst *vpu,const void *data) {const struct venc_vpu_ipi_msg_init *msg = data;
@@ -19,7 +19,7 @@ static void handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data)/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 ) -return ; +return 0 ;/* Check firmware version. */ mtk_vcodec_debug(vpu, "firmware version: 0x%x\n",
@@ -30,18 +30,19 @@ static void handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data)default :mtk_vcodec_err (vpu,"unhandled firmware version 0x%x\n" , msg->venc_abi_version); - vpu->failure =1 ; -break ; +return -EINVAL ; } +return 0 ; } -static void handle_enc_encode_msg (struct venc_vpu_inst *vpu,const void *data) +static int handle_enc_encode_msg (struct venc_vpu_inst *vpu,const void *data) {const struct venc_vpu_ipi_msg_enc *msg = data; vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +return 0 ; }static void vpu_enc_ipi_handler (void *data,unsigned int len,void *priv)
@@ -60,12 +61,12 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)switch (msg->msg_id) {case VPU_IPIMSG_ENC_INIT_DONE : -handle_enc_init_msg (vpu, data); + vpu->failure =handle_enc_init_msg (vpu, data);break ;case VPU_IPIMSG_ENC_SET_PARAM_DONE :break ;case VPU_IPIMSG_ENC_ENCODE_DONE : -handle_enc_encode_msg (vpu, data); + vpu->failure =handle_enc_encode_msg (vpu, data);break ;case VPU_IPIMSG_ENC_DEINIT_DONE :break ;
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 4/5 media: mtk-vcodec: Add two error cases upon vpu irq handling
In reply to Dafna Hirschfeld1. Fail if the function mtk_vcodec_fw_map_dm_addr returns ERR pointer.
2. Fail if the state from the vpu msg is either VEN_IPI_MSG_ENC_STATE_ERROR or VEN_IPI_MSG_ENC_STATE_PART
--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +8 -0
@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi =mtk_vcodec_fw_map_dm_addr (vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0 ;
@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data) vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) { +mtk_vcodec_err (vpu,"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; + }return 0 ; }
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 27 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi =mtk_vcodec_fw_map_dm_addr (vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)
drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) { +mtk_vcodec_err (vpu,"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; + }
Hi Dafna,
This state check is useless, the enc result will check in "vpu_enc_ipi_handler".
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}
Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 41 lines · Irui Wang (王瑞)
Quoted 27 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi =mtk_vcodec_fw_map_dm_addr (vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0;
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) { +mtk_vcodec_err (vpu,"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; + }Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".
Hi, thanks for reviewing. I see that the vpu_enc_ipi_handler only test the msg->status and I see that the states are not tested anywhere except of "skip" state in the h264 enc.
Can't there be a scenario where msg->status is ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
Thanks,
Dafna
Quoted 5 lines
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}
A message that is not in the archive (sent off-list or not yet received): HK0PR03MB302713CFF1F1E79AD99737679DF69@HK0PR03MB3027.apcprd03.prod.outlook.com
Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 4 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 1 line
Quoted 1 line
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on vp8_enc_wait_venc_done
Quoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000 /usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=-*NV12Dmabuf* --codec=vp8 /usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator
The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 6 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.
Quoted 9 lines
Quoted 3 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
Dafna
Quoted 82 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu (吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected] 主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 39 lines · Irui Wang (王瑞)
Quoted 25 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi =mtk_vcodec_fw_map_dm_addr (vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0;
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) { +mtk_vcodec_err (vpu,"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 2 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}************* MEDIATEK Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Hi Dafna,
Quoted 7 lines
Quoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
Quoted 3 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests--gtest_filter=-*NV12Dmabuf* -->>codec=vp8 >/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did you have check VENC clock info during encoding:
cat /sys/kernel/debug/clk/clk_summary | grep venc:
venc_sel > it's H.264 clockvenclt_sel > it's VP8 clock
the enable&prepare count is not 0 during encoding process.
Thanks
Best Regards
-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra 主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 4 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 1 line
Quoted 1 line
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on vp8_enc_wait_venc_done
Quoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000 /usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=-*NV12Dmabuf* --codec=vp8 /usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator
The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 6 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.
Quoted 10 lines
Quoted 3 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
Dafna
Quoted 92 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected] 抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu (吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 41 lines · Irui Wang (王瑞)
Quoted 27 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0;
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err (vpu, +"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}************* MEDIATEK Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 10 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 7 lines
Quoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
Quoted 3 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests--gtest_filter=-*NV12Dmabuf* -->>codec=vp8 >/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 8 lines
It seems mean VP8 encoding function OK, but failed sometimes, did you have check VENC clock info during encoding:
cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
I see that the values are indeed incremented while streaming.
When timeout occurs it is always in the beginning of the encoding. So upon the first call to vp8_enc_wait_venc_done.
Thanks,
Dafna
Quoted 51 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra 主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 4 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 1 line
Quoted 1 line
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on
vp8_enc_wait_venc_doneQuoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests--gtest_filter=-*NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv--disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 6 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 10 lines
Quoted 3 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
Quoted 97 lines
I uses the latest firmware.
Thanks,
DafnaQuoted 92 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected] 抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu (吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 41 lines · Irui Wang (王瑞)
Quoted 27 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err (vpu, +"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}************* MEDIATEK Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
In reply to Irui Wang (王瑞)Quoted 53 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 7 lines
Quoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
Quoted 3 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests--gtest_filter=-*NV12Dmabuf* -->>codec=vp8 >/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did you have check VENC clock info during encoding:
cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra 主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 4 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 1 line
Quoted 1 line
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on
vp8_enc_wait_venc_doneQuoted 1 line
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests--gtest_filter=-*NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv--disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoder
Quoted 8 lines
Quoted 1 line
I was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 3 lines
Quoted 3 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219: venc_if_encode failed=-5
Hi,
I test the driver on debian now, I stream several instances of vp8 and h264 in parallel. I see that those errors always occur after an iommu page fault:
[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-iommu 10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0 layer=1 write
[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243: venc_if_encode failed=-5
I suspect that maybe this is because the iova of the working_buffers is handed to the vpu in the function vp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;
Maybe the vpu keep writing to those addresses after they are already unmapped?
Thanks,
Dafna
Quoted 105 lines
Quoted 7 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59I uses the latest firmware.
Thanks,
DafnaQuoted 92 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected] 抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu (吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 41 lines · Irui Wang (王瑞)
Quoted 27 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev->fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip ==MTK_MT8173 )return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data)drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 54
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err (vpu, +"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0return 0 ;}************* MEDIATEK Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Hi,
Quoted 107 lines · Dafna Hirschfeld
Quoted 70 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 11 lines
Quoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
Quoted 8 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 1 line
/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did you have check VENC clock info during encoding:
cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 7 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 3 lines
Quoted 3 lines
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on
vp8_enc_wait_venc_doneQuoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 14 lines
Quoted 2 lines
I was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 7 lines
Quoted 7 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of vp8 and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-iommu 10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0 layer=1 write
[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243: venc_if_encodefailed=-5
I suspect that maybe this is because the iova of the
working_buffersis handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;
Quoted 5 lines
Maybe the vpu keep writing to those addresses after they are already unmapped?
Thanks,
Dafna
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there any h264 encoding failed at that time? I have no ideas why these errors happened on your platform, but when we got the "iommu: fault", the possible reason is related to power or clock.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 121 lines
Quoted 121 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 113 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected] 抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu
(吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu
irq handlingQuoted 46 lines · Irui Wang (王瑞)
Quoted 32 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev- >fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */
if (vpu->ctx->dev->venc_pdata->chip==MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data) vpu->state = msg->state;drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 55
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err (vpu, +"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended
to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or
believe that you have received this e-mail in error, please notify the
sender immediately (by replying to this e-mail), delete any and all
copies of this e-mail (including any attachments) from your system,
and do not disclose the content of this e-mail to any other person. Thank you!
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 113 lines · Irui Wang
Hi,
Quoted 110 lines · Dafna Hirschfeld
Quoted 70 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 11 lines
Quoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
Quoted 8 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 1 line
/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did you have check VENC clock info during encoding:
cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handlingQuoted 7 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 3 lines
Quoted 3 lines
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The timeout is on
vp8_enc_wait_venc_doneQuoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 14 lines
Quoted 2 lines
I was told you have met another H.264 encoding failed before, did you find reasons about that ?
No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 7 lines
Quoted 7 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of vp8 and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-iommu 10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0 layer=1 write
[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243: venc_if_encodefailed=-5
I suspect that maybe this is because the iova of the
working_buffersis handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Maybe the vpu keep writing to those addresses after they are already unmapped?
Quoted 7 lines
Quoted 2 lines
Thanks,
Dafnafailed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there any h264 encoding failed at that time? I have no ideas why these errors happened on your platform, but when we got the "iommu: fault", the possible reason is related to power or clock.
Once the iommu fault fires, both encoders constantly fail and never recover (also not when starting new instance).
With the falut:mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
I looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096
gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480
gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688
gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480
gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688
gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480
gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536
gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536
gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096
kworker/0:0-537 [000] d.h.. 714.636191: io_page_fault: IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova range)
you can see the first line unmapping 00000000ebede000 which is the faulting iova.
So it seems that the problem is due to a device trying to access an address that is already unmapped. This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I suspect it might be the vpu device, what do you think?
Thanks,
Dafna
Quoted 135 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 113 lines
Quoted 113 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 105 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected] 抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected]; [email protected]; [email protected]; Yunfei Dong (董云飞); Yong Wu
(吴勇); [email protected]; [email protected]; Andrew-CT Chen (陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu
irq handlingQuoted 46 lines · Irui Wang (王瑞)
Quoted 32 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev- > fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */
if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static int handle_enc_encode_msg(struct venc_vpu_inst *vpu, const void *data) vpu->state = msg->state;drivers/media/platform/mtk-vcodec/venc_vpu_if.c static int handle_enc_encode_msg(struct · line 55
Quoted 10 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +6
-0vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm; +if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err (vpu, +"bad ipi-enc-state: %s" , + vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR ?"ERR" :"PART" ); +return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state is error?
I am testing the vp8 encoder on chromeos and at some point the encoder interrupts stop arriving so I try to figure out why and report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended
to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or
believe that you have received this e-mail in error, pleaseQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
notify the
sender immediately (by replying to this e-mail), delete any and all
copies of this e-mail (including any attachments) from your system,
and do not disclose the content of this e-mail to any other person. Thank you!_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 192 lines · Dafna Hirschfeld
Quoted 134 lines · Irui Wang
Hi,
Quoted 124 lines · Dafna Hirschfeld
Quoted 82 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 4 lines
Quoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?Quoted 11 lines
The commands that I run is:
Quoted 10 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 2 lines
/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon
vpu irq handlingQuoted 9 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 5 lines
I am testing the vp8 encoder on chromeos and at some point
the encoder interrupts stop arriving so I try to figure out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The
timeout is onvp8_enc_wait_venc_doneQuoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at
some point after few attempts I start to get those timeout errors.Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 15 lines
Quoted 3 lines
I was told you have met another H.264 encoding failed before,
did you find reasons about that ?No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 7 lines
Quoted 7 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-iommu 10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 6 lines
Maybe the vpu keep writing to those addresses after they are already
unmapped?Thanks,
DafnaQuoted 6 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there
any h264 encoding failed at that time? I have no ideas why these errors
happened on your platform, but when we got the "iommu: fault", the possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU:iova=0x00000000ebede000 -
0x00000000ebedf000size=4096 unmapped_size=4096
gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU:
iova=0x00000000ebed0000 -0x00000000ebed5000size=20480 unmapped_size=20480
gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU:
iova=0x00000000eb800000 -0x00000000ebb0a000size=3186688 unmapped_size=3186688
gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU:
iova=0x00000000eb700000 -0x00000000eb7ff000size=1044480 unmapped_size=1044480
gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU:
iova=0x00000000eb000000 -0x00000000eb30a000size=3186688 unmapped_size=3186688
gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU:
iova=0x00000000eaf00000 -0x00000000eafff000size=1044480 unmapped_size=1044480
gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU:
iova=0x00000000eaef0000 -0x00000000eaf00000size=65536 unmapped_size=65536
gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU:
iova=0x00000000eaee0000 -0x00000000eaef0000size=65536 unmapped_size=65536
gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU:
iova=0x00000000eaedf000 -0x00000000eaee0000size=4096 unmapped_size=4096kworker/0:0-537 [000] d.h.. 714.636191: io_page_fault:IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001
(I changed the iommu map/unmap trace events to print the iova range) you can see the first line unmapping
00000000ebede000which is the faulting iova.
So it seems that the problem is due to a device trying to access an address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I suspect it might be the vpu device, what do you think?
Quoted 2 lines
Thanks,
Dafna
vpu device won't access the address, the fault logs:
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder hardware through iommu, but why unmap happended at this time? it seems encoding process still going on....
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 145 lines
Quoted 145 lines
Quoted 131 lines
Quoted 131 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 123 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected] ;
[email protected]; [email protected]; Yunfei Dong (董云飞); Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon
vpu
irq handlingQuoted 51 lines · Irui Wang (王瑞)
Quoted 45 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev- > fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");drivers/media/platform/mtk-vcodec/venc_vpu_if.c
Quoted 2 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly
test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state
is error?
I am testing the vp8 encoder on chromeos and at some point the
encoder interrupts stop arriving so I try to figure out why and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended
to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this e- mail,
or
believe that you have received this e-mail in error, please notify theQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
sender immediately (by replying to this e-mail), delete any and
all
copies of this e-mail (including any attachments) from your system,
and do not disclose the content of this e-mail to any other person. Thank you!_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 193 lines · Irui Wang
Quoted 192 lines · Dafna Hirschfeld
Quoted 134 lines · Irui Wang
Hi,
Quoted 124 lines · Dafna Hirschfeld
Quoted 82 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 4 lines
Quoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?Quoted 11 lines
The commands that I run is:
Quoted 10 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 2 lines
/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially then at some point after few attempts I start to get those timeout errors.
It seems mean VP8 encoding function OK, but failed sometimes, did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon
vpu irq handlingQuoted 9 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 5 lines
I am testing the vp8 encoder on chromeos and at some point
the encoder interrupts stop arriving so I try to figure out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt. The
timeout is onvp8_enc_wait_venc_doneQuoted 2 lines
2. Always happened issue ? timeout at the beginning or in processing ?
The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/video
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at
some point after few attempts I start to get those timeout errors.Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 15 lines
Quoted 3 lines
I was told you have met another H.264 encoding failed before,
did you find reasons about that ?No,
But since I see that the google meetup uses the vp8 encoder I decided to test the vp8 first.Quoted 7 lines
Quoted 7 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-iommu 10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 6 lines
Maybe the vpu keep writing to those addresses after they are already
unmapped?Thanks,
DafnaQuoted 6 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there
any h264 encoding failed at that time? I have no ideas why these errors
happened on your platform, but when we got the "iommu: fault", the possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096 gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480 gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096 kworker/0:0-537 [000] d.h.. 714.636191: io_page_fault:IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001
(I changed the iommu map/unmap trace events to print the iova range) you can see the first line unmapping
00000000ebede000which is the faulting iova.
So it seems that the problem is due to a device trying to access an address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I suspect it might be the vpu device, what do you think?
Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;
in both vp8 and h264 it seems that the codec drivers give the vpu access to the allocated iova address. If the vpu doesn't access those addresses then what is the purpose of this line?
Quoted 5 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder hardware through iommu, but why unmap happended at this time? it seems encoding process still going on....
Why is it seems so?
Quoted 158 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 145 lines
Quoted 145 lines
Quoted 131 lines
Quoted 131 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 123 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:[email protected]] 发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊); [email protected]; Maoguang Meng (孟毛广); [email protected] ;
[email protected]; [email protected]; Yunfei Dong (董云飞); Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon
vpu
irq handlingQuoted 51 lines · Irui Wang (王瑞)
Quoted 45 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addrreturns ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 8 ++++++++ 1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0@@ -17,6 +17,8 @@ static int handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data) vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx->dev- > fw_handler, msg->vpu_inst_addr); +if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on MT8173. */ if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");drivers/media/platform/mtk-vcodec/venc_vpu_if.c
Quoted 2 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+return -EINVAL ; +}Hi Dafna,
Quoted 3 lines
This state check is useless, the enc result will check in "
vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handleronly
test themsg->statusand I see that the states are not tested anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state
is error?
I am testing the vp8 encoder on chromeos and at some point the
encoder interrupts stop arriving so I try to figure out why and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended
to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this e- mail,
or
believe that you have received this e-mail in error, please notify theQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
sender immediately (by replying to this e-mail), delete any and
all
copies of this e-mail (including any attachments) from your system,
and do not disclose the content of this e-mail to any other person. Thank you!_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 239 lines · Dafna Hirschfeld
Quoted 231 lines · Irui Wang
Quoted 230 lines · Dafna Hirschfeld
Quoted 153 lines · Irui Wang
Hi,
Quoted 143 lines · Dafna Hirschfeld
Quoted 93 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 4 lines
Quoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?Quoted 14 lines
The commands that I run is:
Quoted 13 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 3 lines
/usr/local/share/tast/data/chromiumos/tast/local/bundles/
cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially
then at some point after few attempts I start to get those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu irq handlingQuoted 10 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 6 lines
Quoted 6 lines
I am testing the vp8 encoder on chromeos and at some point
the encoder interrupts stop arriving so I try to figure
out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at
some point after few attempts I start to get those timeout errors.Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 18 lines
Quoted 3 lines
I was told you have met another H.264 encoding failed before,
did you find reasons about that ?No,
But since I see that the google meetup uses the vp8 encoder I
decided to test the vp8 first.Quoted 9 lines
Quoted 9 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk- iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 6 lines
Maybe the vpu keep writing to those addresses after they are already
unmapped?Thanks,
DafnaQuoted 8 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there
any h264 encoding failed at that time? I have no ideas why these
errors
happened on your platform, but when we got the "iommu: fault", the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096 gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480 gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096 kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova range)
you can see the first line unmapping00000000ebede000which is the
faulting iova.
So it seems that the problem is due to a device trying to access an
address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Quoted 8 lines
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;in both vp8 and h264 it seems that the codec drivers give the vpu access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of this line?
"wb" is a shared buffer between AP-kernel and VPU firmware, to store these encoder working buffers informations, the architecture like this:
1. VPU firmware will set working buffers informations(size, iova(is 0 now));
2. AP-kernel allocate these working buffers and get a truly memory(iova), so VPU firmware can get these wbs' iova after allocate done.
3. when encoding, these iova will set to encoder hardware in VPU firmware.
4. encoder hardware can get the data from these "iova" to do encoding.
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver ?
Quoted 9 lines
Quoted 7 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder hardware through iommu, but why unmap happended at this time? it seems
encoding process still going on....Why is it seems so?
the fault means errors happended while reading prepared encode data, so I think encoding is still going on.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 174 lines
Quoted 174 lines
Quoted 174 lines
Quoted 174 lines
Quoted 160 lines
Quoted 160 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 152 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊);
[email protected]; Maoguang Meng (孟毛广); [email protected]
;
[email protected]; [email protected]; Yunfei Dong (董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu
irq handlingQuoted 59 lines · Irui Wang (王瑞)
Quoted 52 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld < [email protected]>
---
drivers/media/platform/mtk-vcodec/venc_vpu_if.c
| 8
++++++++1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -17,6 +17,8 @@ static inthandle_enc_init_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx-Quoted 2 lines
dev-
fw_handler,msg->vpu_inst_addr);drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on
MT8173.
*/if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");drivers/media/platform/mtk-vcodec/venc_vpu_if.c
Quoted 2 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+return -EINVAL ; +}Hi Dafna,
Quoted 4 lines
This state check is useless, the enc result will check in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states are not tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state
is error?
I am testing the vp8 encoder on chromeos and at some point
the
encoder interrupts stop arriving so I try to figure out why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or
otherwise exempt from disclosure under applicable laws. It is
intended
to be conveyed only to the designated recipient(s). Any use,
dissemination, distribution, printing, retaining or copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this e-
mail,
or
believe that you have received this e-mail in error, please
notify the
sender immediately (by replying to this e-mail), delete any
andQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
all
copies of this e-mail (including any attachments) from your
system,
and do not disclose the content of this e-mail to any other
person. Thank you!_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 248 lines · Irui Wang
Quoted 239 lines · Dafna Hirschfeld
Quoted 231 lines · Irui Wang
Quoted 230 lines · Dafna Hirschfeld
Quoted 153 lines · Irui Wang
Hi,
Quoted 143 lines · Dafna Hirschfeld
Quoted 93 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 4 lines
Quoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?Quoted 14 lines
The commands that I run is:
Quoted 13 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* -->>codec=vp8Quoted 3 lines
/usr/local/share/tast/data/chromiumos/tast/local/bundles/
cros/video/data/tulip2-320x180.yuv --disable_validator The command sometime succeed but when I run it sequentially
then at some point after few attempts I start to get those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding process.
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu irq handlingQuoted 10 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 6 lines
Quoted 6 lines
I am testing the vp8 encoder on chromeos and at some point
the encoder interrupts stop arriving so I try to figure
out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cros/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially then at
some point after few attempts I start to get those timeout errors.Quoted 5 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderQuoted 18 lines
Quoted 3 lines
I was told you have met another H.264 encoding failed before,
did you find reasons about that ?No,
But since I see that the google meetup uses the vp8 encoder I
decided to test the vp8 first.Quoted 9 lines
Quoted 9 lines
[ 81.918747] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR] mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk- iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3 port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR] mtk_vcodec_wait_for_done_ctx:32: [2706] ctx->type=1, cmd=1, wait_event_interruptible_timeout time=1000ms out 0 0! [ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 6 lines
Maybe the vpu keep writing to those addresses after they are already
unmapped?Thanks,
DafnaQuoted 8 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is there
any h264 encoding failed at that time? I have no ideas why these
errors
happened on your platform, but when we got the "iommu: fault", the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096 gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480 gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096 kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova range)
you can see the first line unmapping00000000ebede000which is the
faulting iova.
So it seems that the problem is due to a device trying to access an
address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Quoted 8 lines
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;in both vp8 and h264 it seems that the codec drivers give the vpu access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of this line?
Quoted 10 lines
"wb" is a shared buffer between AP-kernel and VPU firmware, to store these encoder working buffers informations, the architecture like this:
1. VPU firmware will set working buffersinformations(size, iova(is 0 now));
2. AP-kernel allocate these working buffers and get a truly memory(iova), so VPU firmware can get these wbs' iova after allocate done.
3. when encoding, these iova will set to encoder hardware in VPU firmware
4. encoder hardware can get the data from these "iova" to do encoding.
ok, thanks for the explanation, so vpu firmware only hand the iova adresses further to the encoder hw but never access them itself?
Quoted 2 lines
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver ?
yes,
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder hardware through iommu, but why unmap happended at this time? it seems
encoding process still going on....
Quoted 4 lines
Quoted 1 line
Why is it seems so?
the fault means errors happended while reading prepared encode data, so I think encoding is still going on.
I added more trace_printk debug, adding log before and after the working buffers are freed: see 'BEFORE/AFTER' log
gst-launch-1.0-590 [000] ..... 353.825276: h264_enc_free_work_buf: h264 BEFORE unmapping work buffers
gst-launch-1.0-590 [000] ..... 353.825282: unmap: IOMMU: iova=0x00000000e5dff000 - 0x00000000e5e00000 size=4096 unmapped_size=4096
gst-launch-1.0-590 [000] ..... 353.825300: unmap: IOMMU: iova=0x00000000e5df0000 - 0x00000000e5df5000 size=20480 unmapped_size=20480
gst-launch-1.0-590 [000] ..... 353.825317: unmap: IOMMU: iova=0x00000000e5800000 - 0x00000000e5b0a000 size=3186688 unmapped_size=3186688
gst-launch-1.0-590 [000] ..... 353.825740: unmap: IOMMU: iova=0x00000000e5500000 - 0x00000000e55ff000 size=1044480 unmapped_size=1044480
gst-launch-1.0-590 [000] ..... 353.825854: unmap: IOMMU: iova=0x00000000e1000000 - 0x00000000e130a000 size=3186688 unmapped_size=3186688
gst-launch-1.0-590 [000] ..... 353.826273: unmap: IOMMU: iova=0x00000000e0f00000 - 0x00000000e0fff000 size=1044480 unmapped_size=1044480
gst-launch-1.0-590 [000] ..... 353.826477: unmap: IOMMU: iova=0x00000000e0ef0000 - 0x00000000e0f00000 size=65536 unmapped_size=65536
gst-launch-1.0-590 [000] ..... 353.826494: unmap: IOMMU: iova=0x00000000e0ee0000 - 0x00000000e0ef0000 size=65536 unmapped_size=65536
gst-launch-1.0-590 [000] ..... 353.826507: unmap: IOMMU: iova=0x00000000e0edf000 - 0x00000000e0ee0000 size=4096 unmapped_size=4096
gst-launch-1.0-590 [000] ..... 353.826515: h264_enc_free_work_buf: h264 AFTER unmapping work buffers
kworker/0:3-67 [000] d.h.. 353.826631: io_page_fault: IOMMU:mtk-iommu 10205000.iommu iova=0x00000000e5dff003 flags=0x0001It is clear that the fault happen for the first working buffer that is unmapped, and the freeing of the working buffers happens only after streaming is done in the '.deinit' cb of the encoder.
So it is clear that the encoder device writes to that working buffer that was just unmapped. Maybe it is a firmware bug? Or Maybe the encoder should indeed write to those buffers and the kernel should wait a while before freeing them?
Quoted 195 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 169 lines
Quoted 169 lines
Quoted 169 lines
Quoted 169 lines
Quoted 168 lines
Quoted 168 lines
Quoted 2 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd88b59
I uses the latest firmware.
Thanks,
DafnaQuoted 160 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊);
[email protected]; Maoguang Meng (孟毛广); [email protected]
;
[email protected]; [email protected]; Yunfei Dong (董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu
irq handlingQuoted 59 lines · Irui Wang (王瑞)
Quoted 52 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld < [email protected]>
---
drivers/media/platform/mtk-vcodec/venc_vpu_if.c
| 8
++++++++1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -17,6 +17,8 @@ static inthandle_enc_init_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu->ctx-Quoted 2 lines
dev-
fw_handler,msg->vpu_inst_addr);drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (IS_ERR (vpu->vsi)) +return PTR_ERR (vpu->vsi);/* Firmware version field value is unspecified on
MT8173.
*/if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+if (vpu->state ==VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state ==VEN_IPI_MSG_ENC_STATE_PART ) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");drivers/media/platform/mtk-vcodec/venc_vpu_if.c
Quoted 2 lines
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-0+return -EINVAL ; +}Hi Dafna,
Quoted 4 lines
This state check is useless, the enc result will check in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states are not tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the state
is error?
I am testing the vp8 encoder on chromeos and at some point
the
encoder interrupts stop arriving so I try to figure out why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or
otherwise exempt from disclosure under applicable laws. It is
intended
to be conveyed only to the designated recipient(s). Any use,
dissemination, distribution, printing, retaining or copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this e-
mail,
or
believe that you have received this e-mail in error, please
notify the
sender immediately (by replying to this e-mail), delete any
and
all
copies of this e-mail (including any attachments) from your
system,
and do not disclose the content of this e-mail to any other
person. Thank you!Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 353 lines · Dafna Hirschfeld
Quoted 274 lines · Irui Wang
Quoted 263 lines · Dafna Hirschfeld
Quoted 255 lines · Irui Wang
Quoted 254 lines · Dafna Hirschfeld
Quoted 173 lines · Irui Wang
Hi,
Quoted 162 lines · Dafna Hirschfeld
Quoted 109 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?Quoted 17 lines
The commands that I run is:
Quoted 16 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests -- gtest_filter=-
*NV12Dmabuf* -->>codec=vp8Quoted 4 lines
/usr/local/share/tast/data/chromiumos/tast/local/
bund
les/
cros/video/data/tulip2-320x180.yuv --disable_validator
The command sometime succeed but when I run it
sequentially
then at some point after few attempts I start to
get
those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding
process.Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek
SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error
cases
upon
vpu irq handlingQuoted 11 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 7 lines
Quoted 7 lines
I am testing the vp8 encoder on chromeos and at
some
point
the encoder interrupts stop arriving so I try to
figure
out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cr
os/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially
then at
some point after few attempts I start to get those timeout
errors.Quoted 9 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding
failed
before,
did you find reasons about that ?Quoted 17 lines
No,
But since I see that the google meetup uses the vp8 encoder
I
decided to test the vp8 first.Quoted 11 lines
Quoted 11 lines
[ 81.918747] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1,
wait_event_interruptible_timeouttime=1000ms out 0 0![ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR]mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances
of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk- iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3
port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32:
[2706] ctx->type=1, cmd=1,wait_event_interruptible_timeout
time=1000ms out 0 0![ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 7 lines
Maybe the vpu keep writing to those addresses after they are
already
unmapped?Thanks,
DafnaQuoted 10 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is
there
any h264 encoding failed at that time? I have no ideas why these
errors
happened on your platform, but when we got the "iommu:
fault",
the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096 gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480 gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096 kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova range)
you can see the first line unmapping00000000ebede000which is
the
faulting iova.
So it seems that the problem is due to a device trying to access
an
address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Quoted 9 lines
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;in both vp8 and h264 it seems that the codec drivers give the vpu access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of
this line?Quoted 15 lines
"wb" is a shared buffer between AP-kernel and VPU firmware, to store
these encoder working buffers informations, the architecture like this:
1. VPU firmware will set working buffers informations(size, iova(is 0
now));
2. AP-kernel allocate these working buffers and get a truly memory(iova), so VPU firmware can get these wbs' iova after allocate
done.
3. when encoding, these iova will set to encoder hardware in VPU firmware
4. encoder hardware can get the data from these "iova" to do encoding.ok, thanks for the explanation, so vpu firmware only hand the iova adresses further to the encoder hw but never access them itself?
Quoted 3 lines
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver ?
yes,
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder
hardware through iommu, but why unmap happended at this time? it
seems
encoding process still going on....Quoted 5 lines
Quoted 1 line
Why is it seems so?
the fault means errors happended while reading prepared encode data, so
I think encoding is still going on.I added more
trace_printkdebug, adding log before and after the working buffers are freed: see 'BEFORE/AFTER' loggst-launch-1.0-590 [000] ..... 353.825276:
h264_enc_free_work_buf: h264 BEFORE unmapping work buffers
gst-launch-1.0-590 [000] ..... 353.825282: unmap: IOMMU:
iova=0x00000000e5dff000 -0x00000000e5e00000size=4096 unmapped_size=4096
gst-launch-1.0-590 [000] ..... 353.825300: unmap: IOMMU:
iova=0x00000000e5df0000 -0x00000000e5df5000size=20480 unmapped_size=20480
gst-launch-1.0-590 [000] ..... 353.825317: unmap: IOMMU:
iova=0x00000000e5800000 -0x00000000e5b0a000size=3186688 unmapped_size=3186688
gst-launch-1.0-590 [000] ..... 353.825740: unmap: IOMMU:
iova=0x00000000e5500000 -0x00000000e55ff000size=1044480 unmapped_size=1044480
gst-launch-1.0-590 [000] ..... 353.825854: unmap: IOMMU:
iova=0x00000000e1000000 -0x00000000e130a000size=3186688 unmapped_size=3186688
gst-launch-1.0-590 [000] ..... 353.826273: unmap: IOMMU:
iova=0x00000000e0f00000 -0x00000000e0fff000size=1044480 unmapped_size=1044480
gst-launch-1.0-590 [000] ..... 353.826477: unmap: IOMMU:
iova=0x00000000e0ef0000 -0x00000000e0f00000size=65536 unmapped_size=65536
gst-launch-1.0-590 [000] ..... 353.826494: unmap: IOMMU:
iova=0x00000000e0ee0000 -0x00000000e0ef0000size=65536 unmapped_size=65536
gst-launch-1.0-590 [000] ..... 353.826507: unmap: IOMMU:
iova=0x00000000e0edf000 -0x00000000e0ee0000size=4096 unmapped_size=4096
gst-launch-1.0-590 [000] ..... 353.826515:h264_enc_free_work_buf: h264 AFTER unmapping work buffers
Quoted 6 lines
kworker/0:3-67 [000] d.h.. 353.826631: io_page_fault:IOMMU:mtk-iommu 10205000.iommu iova=0x00000000e5dff003 flags=0x0001
It is clear that the fault happen for the first working buffer that is unmapped, and the freeing of the working buffers happens only after streaming is done in the '.deinit' cb of the encoder.
no, free working buffers can also happen when streaming on after streaming off, call "set_param" again.
Quoted 4 lines
So it is clear that the encoder device writes to that working buffer that was just unmapped. Maybe it is a firmware bug?
Or Maybe the encoder should indeed write to those buffers and the kernel should wait a while before freeing them?
did you have tried patch:
https://git.linuxtv.org/media_stage.git/patch/?id=b375e01b796a3bdb2de93ebb15b645edb7972abd
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 197 lines
Quoted 197 lines
Quoted 186 lines
Quoted 186 lines
Quoted 186 lines
Quoted 186 lines
Quoted 185 lines
Quoted 185 lines
Quoted 3 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd8 8b59
I uses the latest firmware.
Thanks,
DafnaQuoted 176 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊);
[email protected]; Maoguang Meng (孟毛广); [email protected]
;
[email protected]; [email protected]; Yunfei Dong (董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu
irq handlingQuoted 65 lines · Irui Wang (王瑞)
Quoted 58 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>
---
drivers/media/platform/mtk-vcodec/venc_vpu_if.cQuoted 1 line
8
++++++++
1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c(quoted diff) +0
-0@@ -17,6 +17,8 @@ static inthandle_enc_init_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu-Quoted 3 lines
ctx-
dev-fw_handler,msg->vpu_inst_addr);(quoted diff) +2
-0+if (IS_ERR(vpu->vsi)) +return PTR_ERR(vpu->vsi); /* Firmware version field value isunspecified
on
MT8173.
*/if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;(quoted diff) +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;(quoted diff) +2
-0+if (vpu->state == VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state == VEN_IPI_MSG_ENC_STATE_PART) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");Review
Quoted 2 lines
(quoted diff) +2
-0+return -EINVAL; +}Hi Dafna,
Quoted 5 lines
This state check is useless, the enc result will
check
in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states are not
tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the
state
is error?
I am testing the vp8 encoder on chromeos and at some point
the
encoder interrupts stop arriving so I try to figure out
why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including
any
attachments) may be confidential, proprietary, privileged, or
otherwise exempt from disclosure under applicable laws.
It is
intended
to be conveyed only to the designated recipient(s). Any
use,
dissemination, distribution, printing, retaining or copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this
e-
mail,
or
believe that you have received this e-mail in error, please
notify the
sender immediately (by replying to this e-mail), delete
any
and
all
copies of this e-mail (including any attachments) from
your
system,
and do not disclose the content of this e-mail to any other
person. Thank you!Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 357 lines · Irui Wang
Quoted 356 lines · Dafna Hirschfeld
Quoted 274 lines · Irui Wang
Quoted 263 lines · Dafna Hirschfeld
Quoted 255 lines · Irui Wang
Quoted 254 lines · Dafna Hirschfeld
Quoted 173 lines · Irui Wang
Hi,
Quoted 162 lines · Dafna Hirschfeld
Quoted 109 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?Quoted 17 lines
The commands that I run is:
Quoted 16 lines
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests -- gtest_filter=-
*NV12Dmabuf* -->>codec=vp8Quoted 4 lines
/usr/local/share/tast/data/chromiumos/tast/local/
bund
les/
cros/video/data/tulip2-320x180.yuv --disable_validator
The command sometime succeed but when I run it
sequentially
then at some point after few attempts I start to
get
those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding
process.Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek
SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error
cases
upon
vpu irq handlingQuoted 11 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 7 lines
Quoted 7 lines
I am testing the vp8 encoder on chromeos and at
some
point
the encoder interrupts stop arriving so I try to
figure
out
why and report any possible error.1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 3 lines
2. Always happened issue ? timeout at the beginning or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests --gtest_filter=- *NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundles/cr
os/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially
then at
some point after few attempts I start to get those timeout
errors.Quoted 9 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding
failed
before,
did you find reasons about that ?Quoted 17 lines
No,
But since I see that the google meetup uses the vp8 encoder
I
decided to test the vp8 first.Quoted 11 lines
Quoted 11 lines
[ 81.918747] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32: [3] ctx->type=1, cmd=1,
wait_event_interruptible_timeouttime=1000ms out 0 0![ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR]mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances
of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk- iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3
port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32:
[2706] ctx->type=1, cmd=1,wait_event_interruptible_timeout
time=1000ms out 0 0![ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR] mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 7 lines
Maybe the vpu keep writing to those addresses after they are
already
unmapped?Thanks,
DafnaQuoted 10 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is
there
any h264 encoding failed at that time? I have no ideas why these
errors
happened on your platform, but when we got the "iommu:
fault",
the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398: unmap: IOMMU: iova=0x00000000ebede000 - 0x00000000ebedf000 size=4096 unmapped_size=4096 gst-launch-1.0-606 [000] ..... 714.634417: unmap: IOMMU: iova=0x00000000ebed0000 - 0x00000000ebed5000 size=20480 unmapped_size=20480 gst-launch-1.0-606 [000] ..... 714.634435: unmap: IOMMU: iova=0x00000000eb800000 - 0x00000000ebb0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] .N... 714.634891: unmap: IOMMU: iova=0x00000000eb700000 - 0x00000000eb7ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] .N... 714.635481: unmap: IOMMU: iova=0x00000000eb000000 - 0x00000000eb30a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-606 [000] ..... 714.635934: unmap: IOMMU: iova=0x00000000eaf00000 - 0x00000000eafff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-606 [000] ..... 714.636041: unmap: IOMMU: iova=0x00000000eaef0000 - 0x00000000eaf00000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636056: unmap: IOMMU: iova=0x00000000eaee0000 - 0x00000000eaef0000 size=65536 unmapped_size=65536 gst-launch-1.0-606 [000] ..... 714.636069: unmap: IOMMU: iova=0x00000000eaedf000 - 0x00000000eaee0000 size=4096 unmapped_size=4096 kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova range)
you can see the first line unmapping00000000ebede000which is
the
faulting iova.
So it seems that the problem is due to a device trying to access
an
address that is already unmapped.
This might be either the encoder or the vpu.
Since the wb[i].iova is not reset when freeing the working buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Quoted 9 lines
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;in both vp8 and h264 it seems that the codec drivers give the vpu access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of
this line?Quoted 15 lines
"wb" is a shared buffer between AP-kernel and VPU firmware, to store
these encoder working buffers informations, the architecture like this:
1. VPU firmware will set working buffers informations(size, iova(is 0
now));
2. AP-kernel allocate these working buffers and get a truly memory(iova), so VPU firmware can get these wbs' iova after allocate
done.
3. when encoding, these iova will set to encoder hardware in VPU firmware
4. encoder hardware can get the data from these "iova" to do encoding.ok, thanks for the explanation, so vpu firmware only hand the iova adresses further to the encoder hw but never access them itself?
Quoted 3 lines
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver ?
yes,
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder
hardware through iommu, but why unmap happended at this time? it
seems
encoding process still going on....Quoted 5 lines
Quoted 1 line
Why is it seems so?
the fault means errors happended while reading prepared encode data, so
I think encoding is still going on.I added more
trace_printkdebug, adding log before and after the working buffers are freed: see 'BEFORE/AFTER' loggst-launch-1.0-590 [000] ..... 353.825276: h264_enc_free_work_buf: h264 BEFORE unmapping work buffers gst-launch-1.0-590 [000] ..... 353.825282: unmap: IOMMU: iova=0x00000000e5dff000 - 0x00000000e5e00000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.825300: unmap: IOMMU: iova=0x00000000e5df0000 - 0x00000000e5df5000 size=20480 unmapped_size=20480 gst-launch-1.0-590 [000] ..... 353.825317: unmap: IOMMU: iova=0x00000000e5800000 - 0x00000000e5b0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.825740: unmap: IOMMU: iova=0x00000000e5500000 - 0x00000000e55ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.825854: unmap: IOMMU: iova=0x00000000e1000000 - 0x00000000e130a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.826273: unmap: IOMMU: iova=0x00000000e0f00000 - 0x00000000e0fff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.826477: unmap: IOMMU: iova=0x00000000e0ef0000 - 0x00000000e0f00000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826494: unmap: IOMMU: iova=0x00000000e0ee0000 - 0x00000000e0ef0000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826507: unmap: IOMMU: iova=0x00000000e0edf000 - 0x00000000e0ee0000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.826515: h264_enc_free_work_buf: h264 AFTER unmapping work buffers kworker/0:3-67 [000] d.h.. 353.826631: io_page_fault:IOMMU:mtk-iommu 10205000.iommu iova=0x00000000e5dff003 flags=0x0001
Quoted 5 lines
Quoted 3 lines
It is clear that the fault happen for the first working buffer that is unmapped, and the freeing of the working buffers happens only after streaming is done in the '.deinit' cb of the encoder.
no, free working buffers can also happen when streaming on after streaming off, call "
set_param" again.
There is actually a problem with the stream_start/stream_stop logic It might cause asymetricall call to runtime_pm_put/get
I sent a patch fixing it, patch 2/3 in the series:
https://lore.kernel.org/linux-media/[email protected]/T/#m01253249fb7d3b0925db9e2cabfcd638c55c28d0
could you please review it?
I test my code with this patch applied,
that means that the working buffers are freed only upon deinit which is only when streaming ends.
Thanks,
Dafna
Quoted 8 lines
Quoted 5 lines
So it is clear that the encoder device writes to that working buffer that was just unmapped. Maybe it is a firmware bug?
Or Maybe the encoder should indeed write to those buffers and the kernel should wait a while before freeing them?did you have tried patch:
https://git.linuxtv.org/media_stage.git/patch/?id=b375e01b796a3bdb2de93ebb15b645edb7972abd
The patch is already in mainline, (so yes)
Quoted 216 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 197 lines
Quoted 197 lines
Quoted 186 lines
Quoted 186 lines
Quoted 186 lines
Quoted 186 lines
Quoted 185 lines
Quoted 185 lines
Quoted 3 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5fdd8 8b59
I uses the latest firmware.
Thanks,
DafnaQuoted 176 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]; [email protected]; [email protected]
抄送: [email protected]; [email protected]; Tiffany Lin (林慧珊);
[email protected]; Maoguang Meng (孟毛广); [email protected]
;
[email protected]; [email protected]; Yunfei Dong (董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]; Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two error cases
upon
vpu
irq handlingQuoted 65 lines · Irui Wang (王瑞)
Quoted 58 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is eitherVEN_IPI_MSG_ENC_STATE_ERRORorVEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>
---
drivers/media/platform/mtk-vcodec/venc_vpu_if.cQuoted 1 line
8
++++++++
1 file changed, 8 insertions(+)(quoted diff) +0
-0
vcodec/venc_vpu_if.cb/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
index32dc844d16f9..234705ba7cd6100644
--- a/drivers/media/platform/mtk-vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-vcodec/venc_vpu_if.c(quoted diff) +0
-0@@ -17,6 +17,8 @@ static inthandle_enc_init_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->vsi = mtk_vcodec_fw_map_dm_addr(vpu-Quoted 3 lines
ctx-
dev-
fw_handler,msg->vpu_inst_addr);(quoted diff) +2
-0+if (IS_ERR(vpu->vsi)) +return PTR_ERR(vpu->vsi); /* Firmware version field value isunspecified
on
MT8173.
*/if (vpu->ctx->dev->venc_pdata->chip == MTK_MT8173) return 0;(quoted diff) +0
-0@@ -42,6 +44,12 @@ static inthandle_enc_encode_msg(struct
venc_vpu_inst*vpu, const void *data)vpu->state = msg->state; vpu->bs_size = msg->bs_size; vpu->is_key_frm = msg->is_key_frm;(quoted diff) +2
-0+if (vpu->state == VEN_IPI_MSG_ENC_STATE_ERROR || + vpu->state == VEN_IPI_MSG_ENC_STATE_PART) {mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+vpu->state==VEN_IPI_MSG_ENC_STATE_ERROR? "ERR" : "PART");Review
Quoted 2 lines
(quoted diff) +2
-0+return -EINVAL; +}Hi Dafna,
Quoted 5 lines
This state check is useless, the enc result will
check
in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states are not
tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok but the
state
is error?
I am testing the vp8 encoder on chromeos and at some point
the
encoder interrupts stop arriving so I try to figure out
why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0; }************* MEDIATEK Confidentiality Notice ******************** The
information contained in this e-mail message (including
any
attachments) may be confidential, proprietary, privileged, or
otherwise exempt from disclosure under applicable laws.
It is
intended
to be conveyed only to the designated recipient(s). Any
use,
dissemination, distribution, printing, retaining or copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited
and may
be unlawful. If you are not an intended recipient of this
e-
mail,
or
believe that you have received this e-mail in error, please
notify the
sender immediately (by replying to this e-mail), delete
any
and
all
copies of this e-mail (including any attachments) from
your
system,
and do not disclose the content of this e-mail to any other
person. Thank you!Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 413 lines · Dafna Hirschfeld
Quoted 411 lines · Irui Wang
Quoted 409 lines · Dafna Hirschfeld
Quoted 316 lines · Irui Wang
Quoted 297 lines · Dafna Hirschfeld
Quoted 286 lines · Irui Wang
Quoted 285 lines · Dafna Hirschfeld
Quoted 189 lines · Irui Wang
Hi,
Quoted 176 lines · Dafna Hirschfeld
Quoted 118 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?Quoted 21 lines
The commands that I run is:
Quoted 20 lines
sudo --user=#1000
/usr/local/libexec/chrome-
binary-
tests/video_encode_accelerator_tests --
gtest_filter=-
*NV12Dmabuf* -->>codec=vp8Quoted 5 lines
/usr/local/share/tast/data/chromiumos/tast/lo
cal/
bund
les/
cros/video/data/tulip2-320x180.yuv --
disable_validator
The command sometime succeed but when I run it
sequentially
then at some point after few attempts I start
to
get
those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding
process.Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek
SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error
cases
upon
vpu irq handlingQuoted 12 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 9 lines
Quoted 9 lines
I am testing the vp8 encoder on chromeos and
at
some
point
the encoder interrupts stop arriving so I try
to
figure
out
why and report any possible error.Quoted 1 line
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests -- gtest_filter=-
*NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundle
s/cr
os/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially
then at
some point after few attempts I start to get those timeout
errors.Quoted 9 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding
failed
before,
did you find reasons about that ?Quoted 19 lines
No,
But since I see that the google meetup uses the vp8 encoder
I
decided to test the vp8 first.Quoted 13 lines
Quoted 13 lines
[ 81.918747] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32: [3] ctx-
Quoted 1 line
type=1,
cmd=1,
wait_event_interruptible_timeouttime=1000ms
out 0
0![ 81.931392] [MTK_VCODEC][ERROR][3]: h264_encode_frame() irq_status=0 failed [ 81.938470] [MTK_V4L2][ERROR]mtk_venc_worker:1219:
venc_if_encodefailed=-5Hi,
I test the driver on debian now, I stream several instances
of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page
fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-
iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3
port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32:
[2706] ctx->type=1, cmd=1,wait_event_interruptible_timeout
time=1000ms out 0 0![ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR]mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 8 lines
Maybe the vpu keep writing to those addresses after they
are
already
unmapped?Thanks,
DafnaQuoted 11 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is
there
any h264 encoding failed at that time? I have no ideas why
these
errors
happened on your platform, but when we got the "iommu:
fault",
the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and
never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3
port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398:unmap:
IOMMU:
iova=0x00000000ebede000 -0x00000000ebedf000size=4096 unmapped_size=4096gst-launch-1.0-606 [000] ..... 714.634417:unmap:
IOMMU:
iova=0x00000000ebed0000 -0x00000000ebed5000size=20480 unmapped_size=20480gst-launch-1.0-606 [000] ..... 714.634435:unmap:
IOMMU:
iova=0x00000000eb800000 -0x00000000ebb0a000size=3186688 unmapped_size=3186688gst-launch-1.0-606 [000] .N... 714.634891:unmap:
IOMMU:
iova=0x00000000eb700000 -0x00000000eb7ff000size=1044480 unmapped_size=1044480gst-launch-1.0-606 [000] .N... 714.635481:unmap:
IOMMU:
iova=0x00000000eb000000 -0x00000000eb30a000size=3186688 unmapped_size=3186688gst-launch-1.0-606 [000] ..... 714.635934:unmap:
IOMMU:
iova=0x00000000eaf00000 -0x00000000eafff000size=1044480 unmapped_size=1044480gst-launch-1.0-606 [000] ..... 714.636041:unmap:
IOMMU:
iova=0x00000000eaef0000 -0x00000000eaf00000size=65536 unmapped_size=65536gst-launch-1.0-606 [000] ..... 714.636056:unmap:
IOMMU:
iova=0x00000000eaee0000 -0x00000000eaef0000size=65536 unmapped_size=65536gst-launch-1.0-606 [000] ..... 714.636069:unmap:
IOMMU:
iova=0x00000000eaedf000 -0x00000000eaee0000size=4096 unmapped_size=4096kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova
range)
you can see the first line unmapping00000000ebede000which
is
the
faulting iova.
So it seems that the problem is due to a device trying to access
an
address that is already unmapped.
This might be either the encoder or the vpu. Since the wb[i].iova is not reset when freeing the working
buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 7 lines
in both vp8 and h264 it seems that the codec drivers give the vpu
access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of
this line?"wb" is a shared buffer between AP-kernel and VPU firmware, to store
these encoder working buffers informations, the architecture like
this:
1. VPU firmware will set working buffers informations(size, iova(is
0
now));
2. AP-kernel allocate these working buffers and get a trulyQuoted 8 lines
memory(iova), so VPU firmware can get these wbs' iova after allocate
done.
3. when encoding, these iova will set to encoder hardware in VPU
firmware
4. encoder hardware can get the data from these "iova" to do encoding.ok, thanks for the explanation, so vpu firmware only hand the iova
adresses further to the encoder hw but never access them itself?Quoted 4 lines
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver
?yes,
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder
hardware through iommu, but why unmap happended at this time?
it
seems
encoding process still going on....Quoted 5 lines
Quoted 1 line
Why is it seems so?
the fault means errors happended while reading prepared encode data, so
I think encoding is still going on.I added more
trace_printkdebug, adding log before and after the working buffers are freed: see 'BEFORE/AFTER' loggst-launch-1.0-590 [000] ..... 353.825276: h264_enc_free_work_buf: h264 BEFORE unmapping work buffers gst-launch-1.0-590 [000] ..... 353.825282: unmap: IOMMU: iova=0x00000000e5dff000 - 0x00000000e5e00000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.825300: unmap: IOMMU: iova=0x00000000e5df0000 - 0x00000000e5df5000 size=20480 unmapped_size=20480 gst-launch-1.0-590 [000] ..... 353.825317: unmap: IOMMU: iova=0x00000000e5800000 - 0x00000000e5b0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.825740: unmap: IOMMU: iova=0x00000000e5500000 - 0x00000000e55ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.825854: unmap: IOMMU: iova=0x00000000e1000000 - 0x00000000e130a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.826273: unmap: IOMMU: iova=0x00000000e0f00000 - 0x00000000e0fff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.826477: unmap: IOMMU: iova=0x00000000e0ef0000 - 0x00000000e0f00000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826494: unmap: IOMMU: iova=0x00000000e0ee0000 - 0x00000000e0ef0000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826507: unmap: IOMMU: iova=0x00000000e0edf000 - 0x00000000e0ee0000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.826515: h264_enc_free_work_buf: h264 AFTER unmapping work buffers kworker/0:3-67 [000] d.h.. 353.826631:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000e5dff003 flags=0x0001It is clear that the fault happen for the first working buffer that
is unmapped, and the freeing of the working buffers happens only after streaming is done in the '.deinit' cb of the encoder.
Quoted 8 lines
Quoted 2 lines
no, free working buffers can also happen when streaming on after streaming off, call "
set_param" again.There is actually a problem with the stream_start/stream_stop logic It might cause asymetricall call to runtime_pm_put/get
I sent a patch fixing it, patch 2/3 in the series:
https://lore.kernel.org/linux-media/[email protected]/T/#m01253249fb7d3b0925db9e2cabfcd638c55c28d0
Quoted 3 lines
could you please review it?
Can this patch solve your current issues ?
Quoted 4 lines
I test my code with this patch applied,
that means that the working buffers are freed only upon deinit which is only when streaming ends.
Quoted 14 lines
Thanks,
DafnaQuoted 11 lines
Quoted 7 lines
So it is clear that the encoder device writes to that working buffer
that was just unmapped. Maybe it is a firmware bug? Or Maybe the encoder should indeed write to those buffers and the
kernel should wait a while before freeing them?did you have tried patch:
https://git.linuxtv.org/media_stage.git/patch/?id=b375e01b796a3bdb2de93ebb15b645edb7972abd
Quoted 23 lines
The patch is already in mainline, (so yes)
Quoted 20 lines
Quoted 18 lines
Quoted 18 lines
Quoted 16 lines
Quoted 16 lines
Quoted 14 lines
Quoted 14 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 210 lines
Quoted 210 lines
Quoted 4 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5
fdd8
8b59I uses the latest firmware.
Thanks,
DafnaQuoted 200 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]
;
[email protected];
[email protected]
抄送: [email protected]; [email protected]; Tiffany
Lin
(林慧珊);
[email protected]; Maoguang Meng (孟毛广);
[email protected]
;
[email protected]; [email protected]; Yunfei
Dong
(董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]
;
Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two
error
cases
upon
vpu
irq handlingQuoted 73 lines · Irui Wang (王瑞)
Quoted 67 lines · Dafna Hirschfeld
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is
either
VEN_IPI_MSG_ENC_STATE_ERROR or
VEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>
---
drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
8++++++++
1 file changed, 8 insertions(+)diff --git a/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
b/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
index 32dc844d16f9..234705ba7cd6 100644
--- a/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
@@ -17,6 +17,8 @@ static int
handle_enc_init_msg(struct
venc_vpu_inst *vpu, const void *data)
vpu->vsi =
mtk_vcodec_fw_map_dm_addr(vpu-
ctx-
dev-
fw_handler,msg->vpu_inst_addr);
+if (IS_ERR(vpu->vsi))
+return PTR_ERR(vpu->vsi);
/* Firmware version field value is
unspecified
on
MT8173.
*/
if (vpu->ctx->dev->venc_pdata->chip ==
MTK_MT8173)
return 0;
@@ -42,6 +44,12 @@ static int
handle_enc_encode_msg(struct
venc_vpu_inst *vpu, const void *data)
vpu->state = msg->state;
vpu->bs_size = msg->bs_size;
vpu->is_key_frm = msg->is_key_frm;
+if (vpu->state ==
VEN_IPI_MSG_ENC_STATE_ERROR ||
+ vpu->state ==
VEN_IPI_MSG_ENC_STATE_PART) {
mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+ vpu->state ==
VEN_IPI_MSG_ENC_STATE_ERROR ? "ERR" :
"PART");
+return -EINVAL;
+}Hi Dafna,
Quoted 6 lines
This state check is useless, the enc result
will
check
in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states
are
not
tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok
but
the
state
is error?
I am testing the vp8 encoder on chromeos and at
some
point
the
encoder interrupts stop arriving so I try to
figure
out
why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
Quoted 3 lines
return 0;
}************* MEDIATEK Confidentiality Notice
******************** The
information contained in this e-mail message
(including
any
attachments) may be confidential, proprietary,
privileged, or
otherwise exempt from disclosure under applicable
laws.
It is
intended
to be conveyed only to the designated
recipient(s).
Any
use,
dissemination, distribution, printing, retaining
or
copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is
strictly
prohibited
and may
be unlawful. If you are not an intended recipient
of
this
e-
mail,
or
believe that you have received this e-mail in
error,
please
notify the
sender immediately (by replying to this e-mail),
delete
any
and
all
copies of this e-mail (including any attachments)
from
your
system,
and do not disclose the content of this e-mail to
any
other
person. Thank you!
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: 答复: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error cases upon vpu irq handling
Quoted 409 lines · Irui Wang
Quoted 408 lines · Dafna Hirschfeld
Quoted 406 lines · Irui Wang
Quoted 405 lines · Dafna Hirschfeld
Quoted 316 lines · Irui Wang
Quoted 297 lines · Dafna Hirschfeld
Quoted 286 lines · Irui Wang
Quoted 285 lines · Dafna Hirschfeld
Quoted 189 lines · Irui Wang
Hi,
Quoted 176 lines · Dafna Hirschfeld
Quoted 118 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 5 lines
Quoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?Quoted 21 lines
The commands that I run is:
Quoted 20 lines
sudo --user=#1000 /usr/local/libexec/chrome-
binary-
tests/video_encode_accelerator_tests --
gtest_filter=-
*NV12Dmabuf* -->>codec=vp8
/usr/local/share/tast/data/chromiumos/tast/lo
cal/
bund
les/
cros/video/data/tulip2-320x180.yuv --
disable_validator
The command sometime succeed but when I run it
sequentially
then at some point after few attempts I start
to
get
those
timeout errors.It seems mean VP8 encoding function OK, but failed sometimes,
did
you have check VENC clock info during encoding:cat
/sys/kernel/debug/clk/clk_summary| grep venc:
venc_sel> it's H.264 clockvenclt_sel> it's VP8 clockthe enable&prepare count is not 0 during encoding
process.Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月9日 16:27
收件人: Irui Wang (王瑞)
抄送: Linux Media Mailing List; moderated list:ARM/Mediatek
SoC
support; Enric Balletbo i Serra
主题: Re: 答复: [PATCH 4/5] media: mtk-vcodec: Add two error
cases
upon
vpu irq handlingQuoted 12 lines · Irui Wang (王瑞)
Hi Dafna,
Quoted 9 lines
I am testing the vp8 encoder on chromeos and
at
some
point
the encoder interrupts stop arriving so I try
to
figure
out
why and report any possible error.Quoted 1 line
1. Log shows wait IRQ timeout ?
Hi, yes, I get timeout when waiting to the encoder interrupt.
The
timeout is onvp8_enc_wait_venc_doneQuoted 4 lines
2. Always happened issue ? timeout at the
beginning
or in
processing ?The commands that I run is:
sudo --user=#1000
/usr/local/libexec/chrome-binary-tests/video_encode_accelerator_tests -- gtest_filter=-
*NV12Dmabuf* --codec=vp8/usr/local/share/tast/data/chromiumos/tast/local/bundle
s/cr
os/v
ideo
/data/tulip2-320x180.yuv --disable_validatorThe command sometime succeed but when I run it sequentially
then at
some point after few attempts I start to get those timeout
errors.Quoted 9 lines
3. how about IRQ infos?
cat/proc/interrupts| grep vcodec
18002000.vcodec >> it's H.264 encoder
19002000.vcodec >> it's VP8 encoderI was told you have met another H.264 encoding
failed
before,
did you find reasons about that ?Quoted 19 lines
No,
But since I see that the google meetup uses the vp8 encoder
I
decided to test the vp8 first.Quoted 13 lines
Quoted 13 lines
[ 81.918747] [MTK_V4L2][ERROR]
mtk_vcodec_wait_for_done_ctx:32: [3] ctx-
type=1,
cmd=1,
wait_event_interruptible_timeout time=1000ms
out 0
0!
[ 81.931392] [MTK_VCODEC][ERROR][3]:
h264_encode_frame()
irq_status=0 failed
[ 81.938470] [MTK_V4L2][ERROR]
mtk_venc_worker:1219:
venc_if_encode failed=-5Hi,
I test the driver on debian now, I stream several instances
of
vp8
and h264 in parallel.
I see that those errors always occur after an iommu page
fault:[gst-master] root@debian:~/gst-build# [ 5743.206014] mtk-
iommu
10205000.iommu: fault type=0x5 iova=0xac2ff003 pa=0x0 larb=3
port=0
layer=1 write[ 5744.204964] [MTK_V4L2][ERROR]mtk_vcodec_wait_for_done_ctx:32:
[2706] ctx->type=1, cmd=1,wait_event_interruptible_timeout
time=1000ms out 0 0![ 5744.217849] [MTK_VCODEC][ERROR][2706]: vp8_enc_encode_frame() irq_status=0 failed [ 5744.225359] [MTK_V4L2][ERROR]mtk_venc_worker:1243:
venc_if_encode
failed=-5I suspect that maybe this is because the iova of the
working_buffers
is handed to the vpu in the functionvp8_enc_alloc_work_buf:
wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 8 lines
Maybe the vpu keep writing to those addresses after they
are
already
unmapped?Thanks,
DafnaQuoted 11 lines
failed larb=3, it's for h264 encoder, vp8 encoder is larb5, is
there
any h264 encoding failed at that time? I have no ideas why
these
errors
happened on your platform, but when we got the "iommu:
fault",
the
possible reason is related to power or clock.Once the iommu fault fires, both encoders constantly fail and
never
recover
(also not when starting new instance).With the falut:
mtk_iommu_isr: fault type=0x5 iova=0xebede003 pa=0x0 larb=3
port=0
layer=1 writeI looked at the iommu tracing log:
gst-launch-1.0-606 [000] ..... 714.634398:unmap:
IOMMU:
iova=0x00000000ebede000 -0x00000000ebedf000size=4096 unmapped_size=4096gst-launch-1.0-606 [000] ..... 714.634417:unmap:
IOMMU:
iova=0x00000000ebed0000 -0x00000000ebed5000size=20480 unmapped_size=20480gst-launch-1.0-606 [000] ..... 714.634435:unmap:
IOMMU:
iova=0x00000000eb800000 -0x00000000ebb0a000size=3186688 unmapped_size=3186688gst-launch-1.0-606 [000] .N... 714.634891:unmap:
IOMMU:
iova=0x00000000eb700000 -0x00000000eb7ff000size=1044480 unmapped_size=1044480gst-launch-1.0-606 [000] .N... 714.635481:unmap:
IOMMU:
iova=0x00000000eb000000 -0x00000000eb30a000size=3186688 unmapped_size=3186688gst-launch-1.0-606 [000] ..... 714.635934:unmap:
IOMMU:
iova=0x00000000eaf00000 -0x00000000eafff000size=1044480 unmapped_size=1044480gst-launch-1.0-606 [000] ..... 714.636041:unmap:
IOMMU:
iova=0x00000000eaef0000 -0x00000000eaf00000size=65536 unmapped_size=65536gst-launch-1.0-606 [000] ..... 714.636056:unmap:
IOMMU:
iova=0x00000000eaee0000 -0x00000000eaef0000size=65536 unmapped_size=65536gst-launch-1.0-606 [000] ..... 714.636069:unmap:
IOMMU:
iova=0x00000000eaedf000 -0x00000000eaee0000size=4096 unmapped_size=4096kworker/0:0-537 [000] d.h.. 714.636191:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000ebede003 flags=0x0001(I changed the iommu map/unmap trace events to print the iova
range)
you can see the first line unmapping00000000ebede000which
is
the
faulting iova.
So it seems that the problem is due to a device trying to access
an
address that is already unmapped.
This might be either the encoder or the vpu. Since the wb[i].iova is not reset when freeing the working
buffers I
suspect it might be the vpu device, what do you think?Quoted 4 lines
Quoted 2 lines
Thanks,
Dafnavpu device won't access the address, the fault logs:
Looking at the line:
wb[i].iova = wb[i].iova = inst->work_bufs[i].dma_addr;Quoted 7 lines
in both vp8 and h264 it seems that the codec drivers give the vpu
access to the allocated iova address.
If the vpu doesn't access those addresses then what is the purpose of
this line?"wb" is a shared buffer between AP-kernel and VPU firmware, to store
these encoder working buffers informations, the architecture like
this:
1. VPU firmware will set working buffers informations(size, iova(is
0
now));
2. AP-kernel allocate these working buffers and get a trulyQuoted 8 lines
memory(iova), so VPU firmware can get these wbs' iova after allocate
done.
3. when encoding, these iova will set to encoder hardware in VPU
firmware
4. encoder hardware can get the data from these "iova" to do encoding.ok, thanks for the explanation, so vpu firmware only hand the iova
adresses further to the encoder hw but never access them itself?Quoted 4 lines
I suppose you mean that "vpu" is "vpu firmware"? not mtk-vpu driver
?yes,
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
fault type=0x5 iova=0xebede003 pa=0x0 larb=3 port=0 layer=1 write
it's h264 encoder error when writing "RCPU" data address to encoder
hardware through iommu, but why unmap happended at this time?
it
seems
encoding process still going on....Quoted 5 lines
Quoted 1 line
Why is it seems so?
the fault means errors happended while reading prepared encode data, so
I think encoding is still going on.I added more
trace_printkdebug, adding log before and after the working buffers are freed: see 'BEFORE/AFTER' loggst-launch-1.0-590 [000] ..... 353.825276: h264_enc_free_work_buf: h264 BEFORE unmapping work buffers gst-launch-1.0-590 [000] ..... 353.825282: unmap: IOMMU: iova=0x00000000e5dff000 - 0x00000000e5e00000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.825300: unmap: IOMMU: iova=0x00000000e5df0000 - 0x00000000e5df5000 size=20480 unmapped_size=20480 gst-launch-1.0-590 [000] ..... 353.825317: unmap: IOMMU: iova=0x00000000e5800000 - 0x00000000e5b0a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.825740: unmap: IOMMU: iova=0x00000000e5500000 - 0x00000000e55ff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.825854: unmap: IOMMU: iova=0x00000000e1000000 - 0x00000000e130a000 size=3186688 unmapped_size=3186688 gst-launch-1.0-590 [000] ..... 353.826273: unmap: IOMMU: iova=0x00000000e0f00000 - 0x00000000e0fff000 size=1044480 unmapped_size=1044480 gst-launch-1.0-590 [000] ..... 353.826477: unmap: IOMMU: iova=0x00000000e0ef0000 - 0x00000000e0f00000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826494: unmap: IOMMU: iova=0x00000000e0ee0000 - 0x00000000e0ef0000 size=65536 unmapped_size=65536 gst-launch-1.0-590 [000] ..... 353.826507: unmap: IOMMU: iova=0x00000000e0edf000 - 0x00000000e0ee0000 size=4096 unmapped_size=4096 gst-launch-1.0-590 [000] ..... 353.826515: h264_enc_free_work_buf: h264 AFTER unmapping work buffers kworker/0:3-67 [000] d.h.. 353.826631:
io_page_fault:
IOMMU:mtk-iommu 10205000.iommu iova=0x00000000e5dff003 flags=0x0001
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
It is clear that the fault happen for the first working buffer that
is unmapped, and the freeing of the working buffers happens only after streaming is done in the '.deinit' cb of the encoder.no, free working buffers can also happen when streaming on after streaming off, call "
set_param" again.
Still I can't think why would we have an encoded operation executing while buffers are freed, all operations are protected with mtk_venc_lock.
Do you have any idea?
Quoted 11 lines
Quoted 6 lines
There is actually a problem with the stream_start/stream_stop logic It might cause asymetricall call to runtime_pm_put/get
I sent a patch fixing it, patch 2/3 in the series:https://lore.kernel.org/linux-media/[email protected]/T/#m01253249fb7d3b0925db9e2cabfcd638c55c28d0
Quoted 3 lines
could you please review it?
Can this patch solve your current issues ?
This patch solves a different issue in this driver. (As I already described)
Thank you,
Dafna
Quoted 273 lines
Quoted 20 lines
I test my code with this patch applied,
that means that the working buffers are freed only upon deinit which is only when streaming ends.Thanks,
DafnaQuoted 11 lines
Quoted 7 lines
So it is clear that the encoder device writes to that working buffer
that was just unmapped. Maybe it is a firmware bug? Or Maybe the encoder should indeed write to those buffers and the
kernel should wait a while before freeing them?did you have tried patch:
https://git.linuxtv.org/media_stage.git/patch/?id=b375e01b796a3bdb2de93ebb15b645edb7972abd
Quoted 23 lines
The patch is already in mainline, (so yes)
Quoted 20 lines
Quoted 18 lines
Quoted 18 lines
Quoted 16 lines
Quoted 16 lines
Quoted 14 lines
Quoted 14 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
MT8173 latest VPUD firmware:
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmwar
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 210 lines
Quoted 210 lines
Quoted 4 lines
e.git/commit/?id=aaed4a8bf9a77ec68376e8d92fb218d5
fdd8
8b59I uses the latest firmware.
Thanks,
DafnaQuoted 200 lines
Thanks
Best Regards-----邮件原件-----
发件人: Dafna Hirschfeld [mailto:
[email protected]]
发送时间: 2021年8月6日 15:49
收件人: Irui Wang (王瑞); [email protected]
;
[email protected];
[email protected]
抄送: [email protected]; [email protected]; Tiffany
Lin
(林慧珊);
[email protected]; Maoguang Meng (孟毛广);
[email protected]
;
[email protected]; [email protected]; Yunfei
Dong
(董云飞);
Yong
Wu
(吴勇); [email protected]; [email protected]
;
Andrew-CT
Chen
(陳智迪); [email protected]
主题: Re: [PATCH 4/5] media: mtk-vcodec: Add two
error
cases
upon
vpu
irq handlingQuoted 79 lines · Irui Wang (王瑞)
On Wed, 2021-08-04 at 16:27 +0200, Dafna
Hirschfeld
wrote:
1. Fail if the function
mtk_vcodec_fw_map_dm_addr
returns
ERR
pointer.
2. Fail if the state from the vpu msg is
either
VEN_IPI_MSG_ENC_STATE_ERROR or
VEN_IPI_MSG_ENC_STATE_PARTSigned-off-by: Dafna Hirschfeld <
[email protected]>
---
drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
8++++++++
1 file changed, 8 insertions(+)diff --git a/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
b/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
index 32dc844d16f9..234705ba7cd6 100644
--- a/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
+++ b/drivers/media/platform/mtk-
vcodec/venc_vpu_if.c
@@ -17,6 +17,8 @@ static int
handle_enc_init_msg(struct
venc_vpu_inst *vpu, const void *data)
vpu->vsi =
mtk_vcodec_fw_map_dm_addr(vpu-
ctx-
dev-
fw_handler,msg->vpu_inst_addr);
+if (IS_ERR(vpu->vsi))
+return PTR_ERR(vpu->vsi);
/* Firmware version field value is
unspecified
on
MT8173.
*/
if (vpu->ctx->dev->venc_pdata->chip ==
MTK_MT8173)
return 0;
@@ -42,6 +44,12 @@ static int
handle_enc_encode_msg(struct
venc_vpu_inst *vpu, const void *data)
vpu->state = msg->state;
vpu->bs_size = msg->bs_size;
vpu->is_key_frm = msg->is_key_frm;
+if (vpu->state ==
VEN_IPI_MSG_ENC_STATE_ERROR ||
+ vpu->state ==
VEN_IPI_MSG_ENC_STATE_PART) {
mtk_vcodec_err(vpu,
+"bad ipi-enc-state: %s",
+ vpu->state ==
VEN_IPI_MSG_ENC_STATE_ERROR ? "ERR" :
"PART");
+return -EINVAL;
+}Hi Dafna,
This state check is useless, the enc result
will
check
in
"vpu_enc_ipi_handler".Hi, thanks for reviewing. I see that the
vpu_enc_ipi_handler
only
test themsg->statusand I see that the states
are
not
tested
anywhere except of "skip" state in the h264 enc.Can't there be a scenario where
msg->statusis ok
but
the
state
is error?
I am testing the vp8 encoder on chromeos and at
some
point
the
encoder interrupts stop arriving so I try to
figure
out
why
and
report any possible error.Thanks,
DafnaQuoted 5 lines
Thanks
return 0;
}************* MEDIATEK Confidentiality Notice
******************** The
information contained in this e-mail message
(including
any
attachments) may be confidential, proprietary,
privileged, or
otherwise exempt from disclosure under applicable
laws.
It is
intended
to be conveyed only to the designated
recipient(s).
Any
use,
dissemination, distribution, printing, retaining
or
copying
of
this
e-mail (including its
attachments) by unintended recipient(s) is
strictly
prohibited
and may
be unlawful. If you are not an intended recipient
of
this
e-
mail,
or
believe that you have received this e-mail in
error,
please
notify the
sender immediately (by replying to this e-mail),
delete
any
and
all
copies of this e-mail (including any attachments)
from
your
system,
and do not disclose the content of this e-mail to
any
other
person. Thank you!Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Linux-mediatek mailing list
[email protected]http://lists.infradead.org/mailman/listinfo/linux-mediatek
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH 5/5 media: mtk-vcodec: venc: Fail if a msg sent to VPU was not signaled
In reply to Dafna HirschfeldEach message sent to the VPU should raise a signal. The signal handler sets vpu->signaled. Test the field and fail if it is 0.
--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +3 -1
@@ -92,6 +92,7 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, {int status; + vpu->signaled =0 ;mtk_vcodec_debug_enter (vpu);if (!vpu->ctx->dev->fw_handler) {
@@ -106,6 +107,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, *(uint32_t *)msg, len, status);return -EINVAL ; } +if (!vpu->signaled) +return -EINVAL ;if (vpu->failure)return -EINVAL ;
@@ -122,7 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)mtk_vcodec_debug_enter (vpu);init_waitqueue_head (&vpu->wq_hd); - vpu->signaled =0 ; vpu->failure =0 ; status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id,
Signature · 7 lines
2.17.1 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 5/5] media: mtk-vcodec: venc: Fail if a msg sent to VPU was not signaled
Quoted 3 lines · Dafna Hirschfeld
Each message sent to the VPU should raise a signal. The signal handler sets
vpu->signaled. Test the field and fail if it is 0.
I suppose you want to handle the message execution result, if ipi message can't send or acked successfully, the returned "status" of "mtk_vcodec_fw_ipi_send" will return, so I think you don't need to check "signaled" again.
Quoted 39 lines
Signed-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +1
-0@@ -92,6 +92,7 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, {int status; + vpu->signaled =0 ;mtk_vcodec_debug_enter (vpu);drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-1if (!vpu->ctx->dev->fw_handler) {@@ -106,6 +107,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, *(uint32_t *)msg, len, status);return -EINVAL ; } +if (!vpu->signaled) +return -EINVAL ;if (vpu->failure)return -EINVAL ;@@ -122,7 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)mtk_vcodec_debug_enter (vpu);init_waitqueue_head (&vpu->wq_hd); - vpu->signaled =0 ; vpu->failure =0 ; status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler,
vpu->id,
Re: [PATCH 5/5] media: mtk-vcodec: venc: Fail if a msg sent to VPU was not signaled
Quoted 9 lines · Irui Wang (王瑞)
Quoted 3 lines · Dafna Hirschfeld
Each message sent to the VPU should raise a signal. The signal handler sets
vpu->signaled. Test the field and fail if it is 0.I suppose you want to handle the message execution result, if ipi message can't send or acked successfully, the returned "status" of "
mtk_vcodec_fw_ipi_send" will return, so I think you don't need to check "signaled" again.
in that case, the field 'signaled' is not needed and can be removed So I can send a patch to remove it.
Thanks,
Dafna
Quoted 40 lines
Quoted 40 lines
Signed-off-by Dafna Hirschfeld <[email protected]>--- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/mtk-vcodec/venc_vpu_if.c +1
-0@@ -92,6 +92,7 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, {int status; + vpu->signaled =0 ;mtk_vcodec_debug_enter (vpu);if (!vpu->ctx->dev->fw_handler) {drivers/media/platform/mtk-vcodec/venc_vpu_if.c +2
-1@@ -106,6 +107,8 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, *(uint32_t *)msg, len, status);return -EINVAL ; } +if (!vpu->signaled) +return -EINVAL ;if (vpu->failure)return -EINVAL ;@@ -122,7 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)mtk_vcodec_debug_enter (vpu);init_waitqueue_head (&vpu->wq_hd); - vpu->signaled =0 ; vpu->failure =0 ; status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler,
vpu->id,