author | xiaojing.huang <xiaojing.huang@amlogic.com> | 2019-04-15 08:22:37 (GMT) |
---|---|---|
committer | xiaojing.huang <xiaojing.huang@amlogic.com> | 2019-04-15 08:22:41 (GMT) |
commit | ddf78011ace3a9fcae19543d209caa1ef0eea9e8 (patch) | |
tree | c70d9377d15e80914fbe6404dfa1151fab759873 | |
parent | c777ea7347c3b6226537aa168ff580a475a3118b (diff) | |
download | common-ddf78011ace3a9fcae19543d209caa1ef0eea9e8.zip common-ddf78011ace3a9fcae19543d209caa1ef0eea9e8.tar.gz common-ddf78011ace3a9fcae19543d209caa1ef0eea9e8.tar.bz2 |
osd: fix hotplug hdmi causes system crash[1/1]
PD#OTT-1858
Problem:
hotplug hdmi causes system crash
when unplug hdmi display mode is null, hwc hasn't received
event and post frame normal but osd vsync lost, which caused
wait hw vsync timeout(1s), and fd leak.
Solution:
when process every frame, if display mode is null, exit frame process
just process fence.
Verify:
verified on ATOM
Change-Id: Ic7e7a53f1a381b7fb9f04218b5fa040cb73f7804
-rw-r--r-- | drivers/amlogic/media/osd/osd_hw.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/amlogic/media/osd/osd_hw.c b/drivers/amlogic/media/osd/osd_hw.c index 6838055..bd08edf 100644 --- a/drivers/amlogic/media/osd/osd_hw.c +++ b/drivers/amlogic/media/osd/osd_hw.c @@ -952,7 +952,8 @@ static int sync_render_single_fence(u32 index, u32 yres, mutex_unlock(&post_fence_list_lock); kthread_queue_work(&buffer_toggle_worker, &buffer_toggle_work); request->out_fen_fd = out_fence_fd; - __close_fd(current->files, request->in_fen_fd); + if (request->in_fen_fd >= 0) + __close_fd(current->files, request->in_fen_fd); return out_fence_fd; } @@ -1006,7 +1007,8 @@ static int sync_render_layers_fence(u32 index, u32 yres, fence_map->layer_map[index].in_fd, fence_map->layer_map[index].out_fd); request->out_fen_fd = out_fence_fd; - __close_fd(current->files, in_fence_fd); + if (in_fence_fd >= 0) + __close_fd(current->files, in_fence_fd); return out_fence_fd; } @@ -1738,8 +1740,16 @@ void osd_wait_vsync_hw(void) if (pxp_mode) timeout = msecs_to_jiffies(50); - else - timeout = msecs_to_jiffies(1000); + else { + struct vinfo_s *vinfo; + + vinfo = get_current_vinfo(); + if (vinfo && (!strcmp(vinfo->name, "invalid") || + !strcmp(vinfo->name, "null"))) { + timeout = msecs_to_jiffies(1); + } else + timeout = msecs_to_jiffies(1000); + } wait_event_interruptible_timeout( osd_vsync_wq, vsync_hit, timeout); } @@ -3548,6 +3558,14 @@ static void osd_pan_display_single_fence(struct osd_fence_map_s *fence_map) if (index >= OSD2) goto out; + vinfo = get_current_vinfo(); + if (vinfo && (!strcmp(vinfo->name, "invalid") || + !strcmp(vinfo->name, "null"))) + goto out; + + osd_hw.vinfo_width = vinfo->width; + osd_hw.vinfo_height = vinfo->height; + if (timeline_created) { /* out fence created success. */ ret = osd_wait_buf_ready(fence_map); if (ret < 0) @@ -3569,11 +3587,6 @@ static void osd_pan_display_single_fence(struct osd_fence_map_s *fence_map) AFBC_EN | BLOCK_SPLIT | YUV_TRANSFORM | SUPER_BLOCK_ASPECT; } - vinfo = get_current_vinfo(); - if (vinfo) { - osd_hw.vinfo_width = vinfo->width; - osd_hw.vinfo_height = vinfo->height; - } /* Todo: */ if (fence_map->ext_addr && fence_map->width && fence_map->height) { @@ -3763,17 +3776,17 @@ static void osd_pan_display_single_fence(struct osd_fence_map_s *fence_map) osd_wait_vsync_hw(); } } +#ifdef CONFIG_AMLOGIC_MEDIA_FB_EXT + if (ret) + osd_ext_clone_pan(index); +#endif +out: if (timeline_created) { if (ret) osd_timeline_increase(); else osd_log_err("------NOT signal out_fence ERROR\n"); } -#ifdef CONFIG_AMLOGIC_MEDIA_FB_EXT - if (ret) - osd_ext_clone_pan(index); -#endif -out: if (fence_map->in_fence) osd_put_fenceobj(fence_map->in_fence); @@ -8440,9 +8453,9 @@ void osd_page_flip(struct osd_plane_map_s *plane_map) osd_enable = (plane_map->enable & 1) ? ENABLE : DISABLE; vinfo = get_current_vinfo(); - if (vinfo) { - osd_hw.vinfo_width = vinfo->width; - osd_hw.vinfo_height = vinfo->height; + if (vinfo && (!strcmp(vinfo->name, "invalid") || + !strcmp(vinfo->name, "null"))) { + return; } osd_hw.osd_afbcd[index].enable = (plane_map->afbc_inter_format & AFBC_EN) >> 31; |