Skip to content
Snippets Groups Projects
Commit 89cfea81 authored by ming_qian's avatar ming_qian
Browse files

MA-10250: VPU Decoder: restart firmware if seq hdr is not found


if seq header is not found before user streamoff.
and user streamon again.
the firmware is keeping parsing seq state.
but it don't really parse seq header
because it has been canceled by streamoff.
The firmware needs driver trigger again to start parse next seq.
In this case, driver will send stop cmd to firmware first,
and send start cmd to firmware to restart parse seq header.
And the user need transfer spspps before I frame again.

Signed-off-by: default avatarming_qian <ming.qian@nxp.com>
parent 458736a5
No related merge requests found
...@@ -1275,9 +1275,6 @@ static int v4l2_ioctl_streamon(struct file *file, ...@@ -1275,9 +1275,6 @@ static int v4l2_ioctl_streamon(struct file *file,
if (ctx->hang_status) { if (ctx->hang_status) {
vpu_dbg(LVL_ERR, "%s(): not succeed and some instance are blocked\n", __func__); vpu_dbg(LVL_ERR, "%s(): not succeed and some instance are blocked\n", __func__);
return -EINVAL; return -EINVAL;
} else if (ctx->firmware_stopped) {
vpu_dbg(LVL_ERR, "%s(): not succeed and firmware is stopped\n", __func__);
return -EINVAL;
} else } else
return ret; return ret;
} }
...@@ -1332,9 +1329,6 @@ static int v4l2_ioctl_streamoff(struct file *file, ...@@ -1332,9 +1329,6 @@ static int v4l2_ioctl_streamoff(struct file *file,
if (ctx->hang_status) { if (ctx->hang_status) {
vpu_dbg(LVL_ERR, "%s(): not succeed and some instance are blocked\n", __func__); vpu_dbg(LVL_ERR, "%s(): not succeed and some instance are blocked\n", __func__);
return -EINVAL; return -EINVAL;
} else if (ctx->firmware_stopped) {
vpu_dbg(LVL_ERR, "%s(): not succeed and firmware is stopped\n", __func__);
return -EINVAL;
} else } else
return ret; return ret;
} }
...@@ -2244,7 +2238,7 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32 ...@@ -2244,7 +2238,7 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
return; return;
} }
if (ctx->firmware_stopped) { if (ctx->firmware_stopped && uEvent != VID_API_EVENT_START_DONE) {
vpu_dbg(LVL_ERR, "receive event: 0x%X after stopped, ignore it\n", uEvent); vpu_dbg(LVL_ERR, "receive event: 0x%X after stopped, ignore it\n", uEvent);
return; return;
} }
...@@ -2253,10 +2247,13 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32 ...@@ -2253,10 +2247,13 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
switch (uEvent) { switch (uEvent) {
case VID_API_EVENT_START_DONE: case VID_API_EVENT_START_DONE:
ctx->firmware_stopped = false;
ctx->firmware_finished = false;
break; break;
case VID_API_EVENT_STOPPED: { case VID_API_EVENT_STOPPED: {
vpu_dbg(LVL_INFO, "receive VID_API_EVENT_STOPPED\n"); vpu_dbg(LVL_INFO, "receive VID_API_EVENT_STOPPED\n");
ctx->firmware_stopped = true; ctx->firmware_stopped = true;
ctx->start_flag = true;
complete(&ctx->completion);//reduce possibility of abort hang if decoder enter stop automatically complete(&ctx->completion);//reduce possibility of abort hang if decoder enter stop automatically
complete(&ctx->stop_cmp); complete(&ctx->stop_cmp);
} }
...@@ -2671,7 +2668,11 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32 ...@@ -2671,7 +2668,11 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
i, bufstat[p_data_req->status]); i, bufstat[p_data_req->status]);
} }
up(&This->drv_q_lock); up(&This->drv_q_lock);
complete(&ctx->completion); if (ctx->b_firstseq)
v4l2_vpu_send_cmd(ctx, ctx->str_index,
VID_API_CMD_STOP, 0, NULL);
else
complete(&ctx->completion);
} }
break; break;
case VID_API_EVENT_RET_PING: case VID_API_EVENT_RET_PING:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment