From a7aeb2aa4876dc9149787a96c4a0c5af95b3df94 Mon Sep 17 00:00:00 2001 From: Peng Yixin Date: Mon, 9 Jul 2018 17:58:51 +0800 Subject: [PATCH] PD#167020: vdec: fix cann't play all video after use aiqiyi play video 1.Delete redundant code to set the connected statu in mh264 2.add mutex, to fix core schedule statu is active but no decoder being scheduled, it cause all video cann't play. Change-Id: Ica094d8068be78d36699749c5b32e8e3ad34d4ca Signed-off-by: Peng Yixin --- .../frame_provider/decoder/h264_multi/vmh264.c | 3 +-- .../frame_provider/decoder/utils/vdec.c | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index 375e7e6ac0f0..5a995202289a 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -6236,7 +6236,7 @@ static void vmh264_reset_userdata_fifo(struct vdec_s *vdec, int bInit) if (hw) { mutex_lock(&hw->userdata_mutex); - pr_info("vmpeg12_reset_userdata_fifo: bInit: %d, ri: %d, wi: %d\n", + pr_info("vmh264_reset_userdata_fifo: bInit: %d, ri: %d, wi: %d\n", bInit, hw->userdata_info.read_index, hw->userdata_info.write_index); @@ -6490,7 +6490,6 @@ result_done: hw->stat &= ~STAT_TIMER_ARM; /* mark itself has all HW resource released and input released */ - vdec_set_status(hw_to_vdec(hw), VDEC_STATUS_CONNECTED); #ifdef CONFIG_AMLOGIC_MEDIA_ENHANCEMENT_DOLBYVISION if (hw->switch_dvlayer_flag) { diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/utils/vdec.c b/drivers/amlogic/media_modules/frame_provider/decoder/utils/vdec.c index e086fbbde25f..3c2488fe3b23 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/utils/vdec.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/utils/vdec.c @@ -1357,7 +1357,7 @@ int vdec_disconnect(struct vdec_s *vdec) (vdec->status != VDEC_STATUS_ACTIVE)) { return 0; } - + mutex_lock(&vdec_mutex); /* *when a vdec is under the management of scheduler * the status change will only be from vdec_core_thread @@ -1368,7 +1368,7 @@ int vdec_disconnect(struct vdec_s *vdec) vdec_set_next_status(vdec->slave, VDEC_STATUS_DISCONNECTED); else if (vdec->master) vdec_set_next_status(vdec->master, VDEC_STATUS_DISCONNECTED); - + mutex_unlock(&vdec_mutex); up(&vdec_core->sem); wait_for_completion(&vdec->inactive_done); @@ -1799,7 +1799,7 @@ void vdec_core_finish_run(struct vdec_s *vdec, unsigned long mask) { unsigned long i; unsigned long t = mask; - + mutex_lock(&vdec_mutex); while (t) { i = __ffs(t); clear_bit(i, &vdec->active_mask); @@ -1808,6 +1808,8 @@ void vdec_core_finish_run(struct vdec_s *vdec, unsigned long mask) if (vdec->active_mask == 0) vdec_set_status(vdec, VDEC_STATUS_CONNECTED); + + mutex_unlock(&vdec_mutex); } EXPORT_SYMBOL(vdec_core_finish_run); /* @@ -2077,7 +2079,7 @@ static int vdec_core_thread(void *data) if (kthread_should_stop()) break; - + mutex_lock(&vdec_mutex); /* clean up previous active vdec's input */ list_for_each_entry(vdec, &core->connected_vdec_list, list) { unsigned long mask = vdec->sched_mask & @@ -2139,7 +2141,7 @@ static int vdec_core_thread(void *data) list_move(&vdec->list, &disconnecting_list); } } - + mutex_unlock(&vdec_mutex); /* elect next vdec to be scheduled */ vdec = core->active_vdec; if (vdec) {