From: Jian Wang Date: Mon, 12 Mar 2018 12:20:14 +0000 (+0800) Subject: ionvideo: fix ionvideo_thread panic [1/1] X-Git-Tag: khadas-vims-v0.9.6-release~2237 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1a47a1a0affb9967407b0b77d8982376d80078f;p=platform%2Fkernel%2Flinux-amlogic.git ionvideo: fix ionvideo_thread panic [1/1] PD# 161775: fix ionvideo_thread panic merge from jintao.xu 3.14 jane commit: [PATCH] NEEDLEPLAT-4635: fix ionvideo_thread panic[1/1] [Problem] Kernel panic (ionvideo_thread+0x5ac/0x6bc) in the field [Solution] Add ge2d timeout protect [Platform] Needle/Stark [Test] Change-Id: Iee8a6930bbb6b3a140db73e74aa287f2367b71b0 Signed-off-by: Jian Wang --- diff --git a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c index 9005473b8347..1b5978b94654 100644 --- a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c +++ b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.c @@ -310,12 +310,14 @@ static int ionvideo_fillbuff(struct ionvideo_dev *dev, vf_put(vf, dev->vf_receiver_name); return ret; } + if (dev->wait_ge2d_timeout) { + IONVID_INFO("ppmgr2_process timeout\n"); + dev->wait_ge2d_timeout = false; + return -EAGAIN; + } + dev->wait_ge2d_timeout = false; videoc_omx_compute_pts(dev, vf); buf->timecode.frames = 0; - if (vf->flag & VFRAME_FLAG_ERROR_RECOVERY) - buf->timecode.frames |= 1; - if (vf->flag & VFRAME_FLAG_SYNCFRAME) - buf->timecode.frames |= 2; vf_put(vf, dev->vf_receiver_name); buf->timestamp.tv_sec = dev->pts >> 32; buf->timestamp.tv_usec = dev->pts & 0xFFFFFFFF; @@ -361,6 +363,7 @@ static void ionvideo_thread_tick(struct ionvideo_dev *dev) if (dev->active_state == ION_INACTIVE) return; + dev->wait_ge2d_timeout = false; vf = vf_peek(dev->vf_receiver_name); if (!vf) { dev->vf_wait_cnt++; @@ -920,15 +923,21 @@ static int ionvideo_v4l2_release(void) static int video_receiver_event_fun(int type, void *data, void *private_data) { struct ionvideo_dev *dev = (struct ionvideo_dev *)private_data; - + int timeout = 0; if (type == VFRAME_EVENT_PROVIDER_UNREG) { dev->receiver_register = 0; dev->is_omx_video_started = 0; if (dev->active_state == ION_ACTIVE) { /*if player killed thread may have exit.*/ dev->active_state = ION_INACTIVE_REQ; - wait_for_completion_timeout(&dev->inactive_done, - msecs_to_jiffies(100)); + dev->wait_ge2d_timeout = false; + timeout = wait_for_completion_timeout( + &dev->inactive_done, + msecs_to_jiffies(200)); + if (!timeout) { + IONVID_INFO("unreg:wait timeout\n"); + dev->wait_ge2d_timeout = true; + } } /*tsync_avevent(VIDEO_STOP, 0);*/ diff --git a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h index 14bb5f97971f..8ab646b06477 100644 --- a/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h +++ b/drivers/amlogic/media/video_processor/ionvideo/ionvideo.h @@ -302,6 +302,7 @@ struct ionvideo_dev { struct mutex mutex_input; struct mutex mutex_output; struct v4l2_buffer ionvideo_input[IONVIDEO_POOL_SIZE + 1]; + bool wait_ge2d_timeout; }; unsigned int get_ionvideo_debug(void);