Moving v4l2_ctrl_request_complete to before of function v4l2_m2m_buf_done to make sure the status of request correctly. Replace v4l2_m2m_next_src_buf with v4l2_m2m_src_buf_remove to make sure the src buffer won't be removed for some unknown reason leading to buffer done error. Patch 1 setting request complete before buffer done Patch 3 flush decoder before remove all source buffer Patch 2 change flush decode from capture to output when stream off Patch 4 replace v4l2_m2m_next_src_buf with v4l2_m2m_src_buf_remove --- compared with v1: - add patch 2/3/4 to fix timing issue. --- Yunfei Dong (4): media: mediatek: vcodec: setting request complete before buffer done media: mediatek: vcodec: change flush decode from capture to output when stream off media: mediatek: vcodec: flush decoder before remove all source buffer media: mediatek: vcodec: replace v4l2_m2m_next_src_buf with v4l2_m2m_src_buf_remove .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 52 +++++++++---------- .../vcodec/decoder/mtk_vcodec_dec_drv.h | 3 +- .../vcodec/decoder/mtk_vcodec_dec_stateless.c | 28 +++++++--- .../vcodec/decoder/vdec/vdec_av1_req_lat_if.c | 28 +++++----- .../decoder/vdec/vdec_h264_req_multi_if.c | 3 +- .../decoder/vdec/vdec_hevc_req_multi_if.c | 3 +- .../vcodec/decoder/vdec/vdec_vp9_req_lat_if.c | 37 ++++++------- .../mediatek/vcodec/decoder/vdec_msg_queue.h | 2 + 8 files changed, 84 insertions(+), 72 deletions(-) -- 2.18.0