summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorHuang Chaofan <chaofan.huang@nxp.com>2018-05-21 10:38:06 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitc74f27c3cab9dcff654baff5887bc1f0a4fed802 (patch)
treeeb798bdd5c940ab55a1d0aaaf7cb27e4f519ec20 /drivers/mxc
parent0ec5c5c8461be64c9eadb78edf65b81f379510f9 (diff)
MLK-18353 VPU: Fix eos hang issue for vpu decoder
Fix eos hang issue for vpu decoder on mek B0 board Signed-off-by: Huang Chaofan <chaofan.huang@nxp.com>
Diffstat (limited to 'drivers/mxc')
-rw-r--r--drivers/mxc/vpu-decoder-b0/vpu_b0.c15
-rw-r--r--drivers/mxc/vpu-decoder-b0/vpu_b0.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/drivers/mxc/vpu-decoder-b0/vpu_b0.c b/drivers/mxc/vpu-decoder-b0/vpu_b0.c
index 5c7e8b8a1828..6678286c81e0 100644
--- a/drivers/mxc/vpu-decoder-b0/vpu_b0.c
+++ b/drivers/mxc/vpu-decoder-b0/vpu_b0.c
@@ -767,6 +767,17 @@ static int v4l2_ioctl_decoder_cmd(struct file *file,
// the driver should respond by inserting an EOS
ctx->stream_feed_complete = true;
vpu_dbg(LVL_INFO, "END OF STREAM FED - waiting for VID_API_EVENT_FIFO_LOW\n");
+
+ ctx->stream_feed_complete = true;
+ vpu_dbg(LVL_ALL, "END OF STREAM FED - waiting for VID_API_EVENT_FIFO_LOW\n");
+ if (!wait_for_completion_timeout(&ctx->eos_cmp, msecs_to_jiffies(2000))) {
+ vpu_dbg(LVL_ERR, "wait FIFO LOW timeout, insert eos directly\n");
+ ctx->eos_stop_added = true;
+ ctx->stream_feed_complete = false;
+ v4l2_update_stream_addr(ctx, 0);
+ add_eos(ctx, 0);
+ }
+
} else {
vpu_dbg(LVL_ERR, "Firmware already stopped !\n");
}
@@ -1727,8 +1738,9 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
// Set ctx->stream_feed_complete = false so that we don't try
// to insert another EOS on the next VID_API_EVENT_FIFO_LOW event
ctx->stream_feed_complete = false;
- add_eos(ctx, 0);
v4l2_update_stream_addr(ctx, uStrBufIdx);
+ add_eos(ctx, 0);
+ complete(&ctx->eos_cmp);
vpu_dbg(LVL_INFO, "%s - VID_API_EVENT_FIFO_LOW - After wptr(%x) rptr(%x) start(%x) end(%x) uStrIdx(%d)\n",
__func__, pStrBufDesc->wptr, pStrBufDesc->rptr, pStrBufDesc->start, pStrBufDesc->end, uStrIdx);
} else {
@@ -2315,6 +2327,7 @@ static int v4l2_open(struct file *filp)
mutex_unlock(&dev->dev_mutex);
init_completion(&ctx->completion);
init_completion(&ctx->stop_cmp);
+ init_completion(&ctx->eos_cmp);
v4l2_fh_init(&ctx->fh, video_devdata(filp));
filp->private_data = &ctx->fh;
diff --git a/drivers/mxc/vpu-decoder-b0/vpu_b0.h b/drivers/mxc/vpu-decoder-b0/vpu_b0.h
index 918df09dba3a..b8c041f23eed 100644
--- a/drivers/mxc/vpu-decoder-b0/vpu_b0.h
+++ b/drivers/mxc/vpu-decoder-b0/vpu_b0.h
@@ -225,6 +225,7 @@ struct vpu_ctx {
struct workqueue_struct *instance_wq;
struct completion completion;
struct completion stop_cmp;
+ struct completion eos_cmp;
MediaIPFW_Video_SeqInfo *pSeqinfo;
bool b_firstseq;
bool start_flag;