mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-12-26 11:17:44 +01:00
[vproc]: Adjust vproc thread flow to fix dead lock
Change-Id: I0ae8e0f44a4a8df03183511086f47e5ba561042a Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
parent
293157e10f
commit
e2764751b4
2 changed files with 40 additions and 15 deletions
|
|
@ -556,12 +556,17 @@ static void mpp_dec_put_frame(Mpp *mpp, RK_S32 index, HalDecTaskFlag flags)
|
|||
do {
|
||||
ret = hal_task_get_hnd(group, TASK_IDLE, &hnd);
|
||||
if (ret) {
|
||||
msleep(10);
|
||||
if (dec->reset_flag) {
|
||||
MppBuffer buffer = NULL;
|
||||
mpp_buf_slot_get_prop(slots, index, SLOT_BUFFER, &buffer);
|
||||
if (buffer)
|
||||
mpp_buffer_put(buffer);
|
||||
return;
|
||||
} else {
|
||||
msleep(10);
|
||||
}
|
||||
}
|
||||
} while (ret);
|
||||
|
||||
mpp_assert(ret == MPP_OK);
|
||||
|
||||
vproc_task->flags.val = 0;
|
||||
vproc_task->flags.eos = eos;
|
||||
vproc_task->input = index;
|
||||
|
|
@ -632,7 +637,15 @@ static void mpp_dec_put_frame(Mpp *mpp, RK_S32 index, HalDecTaskFlag flags)
|
|||
do {
|
||||
ret = hal_task_get_hnd(group, TASK_IDLE, &hnd);
|
||||
if (ret) {
|
||||
msleep(10);
|
||||
if (dec->reset_flag) {
|
||||
MppBuffer buffer = NULL;
|
||||
mpp_buf_slot_get_prop(slots, index, SLOT_BUFFER, &buffer);
|
||||
if (buffer)
|
||||
mpp_buffer_put(buffer);
|
||||
return;
|
||||
} else {
|
||||
msleep(10);
|
||||
}
|
||||
}
|
||||
} while (ret);
|
||||
|
||||
|
|
@ -2050,6 +2063,9 @@ MPP_RET mpp_dec_notify(MppDec ctx, RK_U32 flag)
|
|||
notify = 1;
|
||||
}
|
||||
|
||||
if (dec->vproc && (flag & MPP_DEC_NOTIFY_BUFFER_MATCH))
|
||||
dec_vproc_signal(dec->vproc);
|
||||
|
||||
if (notify) {
|
||||
dec_dbg_notify("%p status %08x notify control signal\n", dec,
|
||||
dec->parser_wait_flag, dec->parser_notify_flag);
|
||||
|
|
|
|||
|
|
@ -559,6 +559,22 @@ static void dec_vproc_update_ref(MppDecVprocCtxImpl *ctx, MppFrame frm, RK_U32 i
|
|||
return;
|
||||
}
|
||||
|
||||
static void dev_vproc_reset(MppThread *thd, MppDecVprocCtxImpl *ctx)
|
||||
{
|
||||
AutoMutex autolock_reset(thd->mutex(THREAD_CONTROL));
|
||||
|
||||
if (ctx->reset) {
|
||||
vproc_dbg_reset("reset start\n");
|
||||
dec_vproc_clr_prev(ctx);
|
||||
|
||||
ctx->reset = 0;
|
||||
sem_post(&ctx->reset_sem);
|
||||
ctx->task_status.val = 0;
|
||||
ctx->task_wait.val = 0;
|
||||
vproc_dbg_reset("reset done\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void *dec_vproc_thread(void *data)
|
||||
{
|
||||
MppDecVprocCtxImpl *ctx = (MppDecVprocCtxImpl *)data;
|
||||
|
|
@ -584,17 +600,8 @@ static void *dec_vproc_thread(void *data)
|
|||
break;
|
||||
|
||||
if (ctx->task_wait.task_in) {
|
||||
AutoMutex autolock_reset(thd->mutex(THREAD_CONTROL));
|
||||
if (ctx->reset) {
|
||||
vproc_dbg_reset("reset start\n");
|
||||
dec_vproc_clr_prev(ctx);
|
||||
|
||||
ctx->reset = 0;
|
||||
sem_post(&ctx->reset_sem);
|
||||
ctx->task_status.val = 0;
|
||||
ctx->task_wait.val = 0;
|
||||
vproc_dbg_reset("reset done\n");
|
||||
continue;
|
||||
goto RESET;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -688,6 +695,8 @@ static void *dec_vproc_thread(void *data)
|
|||
|
||||
vproc_dbg_status("vproc task done");
|
||||
}
|
||||
RESET:
|
||||
dev_vproc_reset(thd, ctx);
|
||||
}
|
||||
mpp_dbg_info("mpp_dec_post_proc_thread exited\n");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue