if (dec->eos)
return ret;
+ if (work_pending(&dec->work) ||
+ work_busy(&dec->work)) {
+ avs2_print(dec, PRINT_FLAG_VDEC_DETAIL,
+ "avs2 work pending,not ready for run.\n");
+ return 0;
+ }
if (!dec->first_sc_checked) {
int size = decoder_mmu_box_sc_check(dec->mmu_box, tvp);
dec->first_sc_checked = 1;
(struct vdec_avs_hw_s *)vdec->private;
int ret = 1;
unsigned buf_busy_mask = (1 << hw->vf_buf_num_used) - 1;
+
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work)) {
+ debug_print(hw, PRINT_FLAG_RUN_FLOW,
+ "avs work pending,not ready for run.\n");
+ return 0;
+ }
+
#ifdef DEBUG_MULTI_FRAME_INS
if ((DECODE_ID(hw) == 0) && run_count[0] > run_count[1] &&
run_count[1] < max_run_count[1])
/*
* In this very timeout point,the vh264_work arrives,
- * let it to handle the scenario.
+ * or in some cases the system become slow, then come
+ * this second timeout. In both cases we return.
*/
- if (work_pending(&hw->work))
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work) ||
+ work_pending(&hw->timeout_work) ||
+ work_busy(&hw->timeout_work)) {
+ pr_err("%s h264[%d] work pending, do nothing.\n",__func__, vdec->id);
return;
+ }
hw->timeout_num++;
amvdec_stop();
int tvp = vdec_secure(hw_to_vdec(hw)) ?
CODEC_MM_FLAGS_TVP : 0;
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work) ||
+ work_pending(&hw->timeout_work) ||
+ work_busy(&hw->timeout_work)) {
+ dpb_print(DECODE_ID(hw), PRINT_FLAG_VDEC_DETAIL,
+ "h264 work pending, not ready for run.\n");
+ return 0;
+ }
if (!hw->first_sc_checked && hw->mmu_enable) {
int size = decoder_mmu_box_sc_check(hw->mmu_box, tvp);
hw->first_sc_checked =1;
{
/*
* In this very timeout point,the vh265_work arrives,
- * let it to handle the scenario.
+ * or in some cases the system become slow, then come
+ * this second timeout. In both cases we return.
*/
if (work_pending(&hevc->work) ||
work_busy(&hevc->work) ||
work_pending(&hevc->timeout_work) ||
- work_busy(&hevc->timeout_work))
+ work_pending(&hevc->timeout_work)) {
+ pr_err("%s h265[%d] work pending, do nothing.\n",__func__, hevc->index);
return;
+ }
hevc->timeout_num++;
amhevc_stop();
if (hevc->eos)
return 0;
+ if (work_pending(&hevc->work) ||
+ work_busy(&hevc->work) ||
+ work_pending(&hevc->timeout_work) ||
+ work_pending(&hevc->timeout_work)) {
+ hevc_print(hevc, PRINT_FLAG_VDEC_STATUS,
+ "h265 work pending,not ready for run.\n");
+ return 0;
+ }
if (!hevc->first_sc_checked && hevc->mmu_enable) {
int size = decoder_mmu_box_sc_check(hevc->mmu_box, tvp);
hevc->first_sc_checked =1;
hw->not_run_ready++;
if (hw->eos)
return 0;
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work)) {
+ mmjpeg_debug_print(DECODE_ID(hw), PRINT_FLAG_RUN_FLOW,
+ "mjpeg work pending,not ready for run.\n");
+ return 0;
+ }
if (vdec_stream_based(vdec) && (hw->init_flag == 0)
&& pre_decode_buf_level != 0) {
u32 rp, wp, level;
{
struct vdec_s *vdec = hw_to_vdec(hw);
- if (work_pending(&hw->work)) {
- pr_err("timeout_process return befor do anything.");
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work) ||
+ work_pending(&hw->timeout_work) ||
+ work_busy(&hw->timeout_work)) {
+ pr_err("%s mpeg12[%d] timeout_process return befor do anything.\n",__func__, vdec->id);
return;
}
reset_process_time(hw);
* let it to handle the scenario.
*/
if (work_pending(&hw->work)) {
- pr_err("timeout_process return befor schedule.");
+ pr_err("%s mpeg12[%d] return befor schedule.", __func__, vdec->id);
return;
}
vdec_schedule_work(&hw->timeout_work);
(struct vdec_mpeg12_hw_s *)vdec->private;
if (hw->eos)
return 0;
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work) ||
+ work_pending(&hw->timeout_work) ||
+ work_busy(&hw->timeout_work)) {
+ debug_print(DECODE_ID(hw), PRINT_FLAG_VDEC_STATUS,
+ "mpeg12 work pending,not ready for run.\n");
+ return 0;
+ }
if (vdec_stream_based(vdec) && (hw->init_flag == 0)
&& pre_decode_buf_level != 0) {
u32 rp, wp, level;
(struct vdec_mpeg12_hw_s *)vdec->private;
int save_reg = READ_VREG(POWER_CTL_VLD);
int size, ret;
+
/* reset everything except DOS_TOP[1] and APB_CBUS[0]*/
WRITE_VREG(DOS_SW_RESET0, 0xfffffff0);
WRITE_VREG(DOS_SW_RESET0, 0);
if (hw->eos)
return 0;
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work)) {
+ mmpeg4_debug_print(DECODE_ID(hw), PRINT_FLAG_VDEC_STATUS,
+ "mpeg4 work pending,not ready for run.\n");
+ return 0;
+ }
if (vdec_stream_based(vdec) && (hw->init_flag == 0)
&& pre_decode_buf_level != 0) {
u32 rp, wp, level;
p->get_canvas_ex = get_canvas_ex;
p->free_canvas_ex = free_canvas_ex;
p->vdec_fps_detec = vdec_fps_detec;
- atomic_set(&p->inrelease, 0);
- atomic_set(&p->inirq_flag, 0);
- atomic_set(&p->inirq_thread_flag, 0);
/* todo */
if (!vdec_dual(vdec)) {
p->use_vfm_path =
}
}
- atomic_set(&vdec->inrelease, 1);
- while ((atomic_read(&vdec->inirq_flag) > 0)
- || (atomic_read(&vdec->inirq_thread_flag) > 0))
+ while (vdec->irq_cnt > vdec->irq_thread_cnt)
schedule();
#ifdef FRAME_CHECK
vdec = NULL;
}
- if (vdec) {
- if (atomic_read(&vdec->inrelease) > 0)
- return ret;
- atomic_set(&vdec->inirq_flag, 1);
- }
if (c->dev_isr) {
ret = c->dev_isr(irq, c->dev_id);
goto isr_done;
ret = vdec->irq_handler(vdec, c->index);
isr_done:
- if (vdec)
- atomic_set(&vdec->inirq_flag, 0);
+ if (vdec && ret == IRQ_WAKE_THREAD)
+ vdec->irq_cnt++;
+
return ret;
}
vdec = NULL;
}
- if (vdec) {
- if (atomic_read(&vdec->inrelease) > 0)
- return ret;
- atomic_set(&vdec->inirq_thread_flag, 1);
- }
if (c->dev_threaded_isr) {
ret = c->dev_threaded_isr(irq, c->dev_id);
goto thread_isr_done;
ret = vdec->threaded_irq_handler(vdec, c->index);
thread_isr_done:
if (vdec)
- atomic_set(&vdec->inirq_thread_flag, 0);
+ vdec->irq_thread_cnt++;
return ret;
}
{
unsigned long ready_mask;
struct vdec_input_s *input = &vdec->input;
+
+ /* Wait the matching irq_thread finished */
+ if (vdec->irq_cnt > vdec->irq_thread_cnt)
+ return false;
+
if ((vdec->status != VDEC_STATUS_CONNECTED) &&
(vdec->status != VDEC_STATUS_ACTIVE))
return false;
inc_profi_count(mask, vdec->run_count);
update_profi_clk_run(vdec, mask, get_current_clk());
#endif
+
vdec->run(vdec, mask, vdec_callback, core);
u64 run_clk[VDEC_MAX];
u64 start_run_clk[VDEC_MAX];
#endif
- atomic_t inirq_thread_flag;
- atomic_t inirq_flag;
- atomic_t inrelease;
+ u64 irq_thread_cnt;
+ u64 irq_cnt;
int parallel_dec;
struct vdec_frames_s *mvfrm;
struct vdec_sync sync;
CODEC_MM_FLAGS_TVP : 0;
unsigned long ret = 0;
+ if (work_pending(&hw->work) ||
+ work_busy(&hw->work)) {
+ av1_print(hw, PRINT_FLAG_VDEC_DETAIL,
+ "av1 work pending,not ready for run.\n");
+ return 0;
+ }
if (!hw->pic_list_init_done2 || hw->eos)
return ret;
CODEC_MM_FLAGS_TVP : 0;
unsigned long ret = 0;
+ if (work_pending(&pbi->work) ||
+ work_busy(&pbi->work)) {
+ vp9_print(pbi, PRINT_FLAG_VDEC_DETAIL,
+ "vp9 work pending,not ready for run.\n");
+ return 0;
+ }
if (!(pbi->pic_list_init_done && pbi->pic_list_init_done2) || pbi->eos)
return ret;
if (!pbi->first_sc_checked && pbi->mmu_enable) {