mmpeg4: fix timeout repeatedly when vfifo empty. [1/1]
authorshihong.zheng <shihong.zheng@amlogic.com>
Wed, 3 Jul 2019 12:25:32 +0000 (20:25 +0800)
committershihong.zheng <shihong.zheng@amlogic.com>
Fri, 5 Jul 2019 02:36:05 +0000 (10:36 +0800)
PD#SWPL-8550

Problem:
mpeg4 stuck, consuming input data,
decode timeout repeatedly.

Solution:
retry and result done if it can't dec out.
do not save incomplete context.
ucode gerrit id: 79111
ucode change id: I40176d

Verify:
x301

Change-Id: Ie2b18508ebba1891ea52d82898a762b281eb025e
Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
drivers/frame_provider/decoder/mpeg4/vmpeg4_multi.c
firmware/video_ucode.bin

index 6483c96f1af7750a3bab06da897e505480920e03..05b2bec631643ae867cf78ae45a51a23efc7b6df 100644 (file)
@@ -290,6 +290,7 @@ struct vdec_mpeg4_hw_s {
        struct firmware_s *fw;
        u32 blkmode;
        wait_queue_head_t wait_q;
+       u32 dec_again_cnt;
 };
 static void vmpeg4_local_init(struct vdec_mpeg4_hw_s *hw);
 static int vmpeg4_hw_ctx_restore(struct vdec_mpeg4_hw_s *hw);
@@ -752,7 +753,15 @@ static irqreturn_t vmpeg4_isr_thread_fn(struct vdec_s *vdec, int irq)
                        READ_VREG(VIFF_BIT_CNT));
 
                if (vdec_frame_based(vdec)) {
-                       vmpeg4_save_hw_context(hw);
+                       if (++hw->dec_again_cnt > 3) {
+                               hw->dec_again_cnt = 0;
+                               hw->dec_result = DEC_RESULT_DONE;
+                               vdec_schedule_work(&hw->work);
+                       } else {
+                               //vmpeg4_save_hw_context(hw);
+                               hw->dec_result = DEC_RESULT_AGAIN;
+                               vdec_schedule_work(&hw->work);
+                       }
                } else {
                        reset_process_time(hw);
                        hw->dec_result = DEC_RESULT_AGAIN;
@@ -1083,8 +1092,7 @@ static void vmpeg4_work(struct work_struct *work)
                vdec_vframe_dirty(vdec, hw->chunk);
                hw->chunk = NULL;
        } else if (hw->dec_result == DEC_RESULT_AGAIN
-       && (vdec->next_status !=
-               VDEC_STATUS_DISCONNECTED)) {
+               && (vdec->next_status != VDEC_STATUS_DISCONNECTED)) {
                /*
                        stream base: stream buf empty or timeout
                        frame base: vdec_prepare_input fail
@@ -1470,7 +1478,7 @@ static void timeout_process(struct vdec_mpeg4_hw_s *hw)
                amvdec_stop();
                hw->stat &= ~STAT_VDEC_RUN;
        }
-       mmpeg4_debug_print(DECODE_ID(hw), PRINT_FLAG_TIMEOUT_STATUS,
+       mmpeg4_debug_print(DECODE_ID(hw), 0,
                "%s decoder timeout\n", __func__);
        reset_process_time(hw);
        hw->first_i_frame_ready = 0;
@@ -1671,6 +1679,7 @@ static void vmpeg4_local_init(struct vdec_mpeg4_hw_s *hw)
        hw->buffer_not_ready = 0;
        hw->init_flag = 0;
        hw->dec_result = DEC_RESULT_NONE;
+       hw->dec_again_cnt = 0;
 
        for (i = 0; i < DECODE_BUFFER_NUM_MAX; i++)
                hw->vfbuf_use[i] = 0;
index 024f54951d4b63aa27c80b0c2f22da6264c65cec..ca6cc7dc9fd26c6f14dd92cd0b0feedaf0dfd95b 100644 (file)
Binary files a/firmware/video_ucode.bin and b/firmware/video_ucode.bin differ