ionvideo: fix ionvideo_thread panic [1/1]
authorJian Wang <jian.wang@amlogic.com>
Mon, 12 Mar 2018 12:20:14 +0000 (20:20 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Wed, 4 Apr 2018 03:09:16 +0000 (19:09 -0800)
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 <jian.wang@amlogic.com>
drivers/amlogic/media/video_processor/ionvideo/ionvideo.c
drivers/amlogic/media/video_processor/ionvideo/ionvideo.h

index 9005473b834795dd195ac0a784d5c1c9e3d4d0ee..1b5978b9465430978437a9af18b0356067fcd7dc 100644 (file)
@@ -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);*/
index 14bb5f97971f0dc2d4519ce845dfd95f904800bf..8ab646b06477e9a060edd5a6904cd54a5480a702 100644 (file)
@@ -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);