surfaceflinger crash when DP plugged after unplug HDMI

85 views
Skip to first unread message

hpo14

unread,
Jan 3, 2018, 1:38:24 PM1/3/18
to Android-x86
Hi android-x86 devs

i got a wired hotplug issue between HDMI and DP. ill just keep the description clearly as i can.

OK, here the story is.

# Hardware Desc:
--------------------------------------------------------------------------------
Board or PC: UP Squared (official link, with output DP x1, HDMI x1)
monitor: ViewSonic VS16261 (with input DP x1, HDMI x1)

# Software 
--------------------------------------------------------------------------------
Android Version: Android-x86 7.1.2-rc1
Kernel Version: 4.9.31

# when Issue happened (also this is the steps to repoduce)
--------------------------------------------------------------------------------
1. Boot up with HDMI connected. 
2. Plug-out HDMI from board after boot to home.
3. Plug-in DP to the board.
4. monitor screen show android logo again. (this was caused by zygote restart due to surfaceflinger crashed)

# when Issue *NOT* happen
--------------------------------------------------------------------------------
1. Boot up with DP connected. 
2. Plug-out HDMI from board, after boot to home.
3. Plug-in HDMI to the board.
4. nothing happened.


# Crash log of surfaceflinger
--------------------------------------------------------------------------------
12-22 09:41:08.713  2246  2246 F DEBUG   : * * * * * * * * * * * * * * * *
12-22 09:41:08.714  2246  2246 F DEBUG   : Revision: ‘0’
12-22 09:41:08.714  2246  2246 F DEBUG   : ABI: ‘x86_64’
12-22 09:41:08.714  2246  2246 F DEBUG   : pid: 1220, tid: 1269, name: surfaceflinger  >>> /system/bin/surfaceflinger <<<
12-22 09:41:08.714  2246  2246 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0×10
12-22 09:41:08.714  2246  2246 F DEBUG   :     rax 0000000000000000  rbx 000079d06b05e1c0  rcx 8f46cce8f92b8f55  rdx 0000000000000002
12-22 09:41:08.714  2246  2246 F DEBUG   :     rsi 000079d06907f3e0  rdi 000079d06b05e1c0
12-22 09:41:08.714  2246  2246 F DEBUG   :     r8  ffffffffffffffe8  r9  0000000000000000  r10 fffffffffffff945  r11 0000000000000246
12-22 09:41:08.714  2246  2246 F DEBUG   :     r12 000079d06aaf68e3  r13 0000000000000000  r14 000079d06aaf63ca  r15 0000000000000000
12-22 09:41:08.714  2246  2246 F DEBUG   :     cs  0000000000000033  ss  000000000000002b
12-22 09:41:08.714  2246  2246 F DEBUG   :     rip 000079d06aaf1cee  rbp 000079d06907f3e0  rsp 000079d06a00e350  eflags 0000000000010206
12-22 09:41:08.860  2246  2246 F DEBUG   : 
12-22 09:41:08.860  2246  2246 F DEBUG   : backtrace:
12-22 09:41:08.860  2246  2246 F DEBUG   :     #00 pc 0000000000004cee  /system/lib64/libgralloc_drm.so
12-22 09:41:08.860  2246  2246 F DEBUG   :     #01 pc 0000000000004ec2  /system/lib64/libgralloc_drm.so
12-22 09:41:08.860  2246  2246 F DEBUG   :     #02 pc 0000000000089831  /system/lib64/libc.so (_ZL15__pthread_startPv+177)
12-22 09:41:08.860  2246  2246 F DEBUG   :     #03 pc 0000000000029aab  /system/lib64/libc.so (start_thread+11)
12-22 09:41:08.860  2246  2246 F DEBUG   :     #04 pc 000000000001cb25  /system/lib64/libc.so (bionic_clone+53)

# backtrace with addr2line
--------------------------------------------------------------------------------
addr2line -Cfe symbols/system/lib64/libgralloc_drm.so 4cee
Routine init_external_output at external/drm_gralloc/gralloc_drm_kms.c:1127

1121: static int init_external_output(struct gralloc_drm_t *drm,
1122:     drmModeConnectorPtr connector)
1123: {
1124:     struct gralloc_drm_output *output;
1125:     output = drm_kms_init_with_new_connector(drm, connector);   // return NULL due to no outputs[] could use,  
1126:
1127:      ALOGD("%s, allocate private buffer for hdmi [%dx%d]",         // >>>>>> then cause surfaceflinger crash 
1128:         __func__, output->mode.hdisplay, output->mode.vdisplay);
11xx: ......
11xx: } /* end of init_external_output */
--------------------------------------------------------------------------------

ill upload logcat later for "issue not happen" and "issue happened". 

Also according my observation and analysis of logcat.
this issue seems may relative with drm_gralloc receive hotplug event more than once (here is TWICE)
which sent from i915 driver through uevent.

correct me if i was wrong, please
Thanks

Chih-Wei Huang

unread,
Jan 3, 2018, 11:49:27 PM1/3/18
to Android-x86
Indeed drm_kms_init_with_new_connector() may return NULL.
The code should check it before using.
I've just pushed a fix that you can try.


> 1126:
> 1127: ALOGD("%s, allocate private buffer for hdmi [%dx%d]", //
>>>>>>> then cause surfaceflinger crash
> 1128: __func__, output->mode.hdisplay, output->mode.vdisplay);
> 11xx: ......
> 11xx: } /* end of init_external_output */
> --------------------------------------------------------------------------------
>
> ill upload logcat later for "issue not happen" and "issue happened".
>
> Also according my observation and analysis of logcat.
> this issue seems may relative with drm_gralloc receive hotplug event more
> than once (here is TWICE)
> which sent from i915 driver through uevent.



--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Message has been deleted

hpo14

unread,
Jan 4, 2018, 1:44:20 AM1/4/18
to Android-x86
Hi CW

this patch resolved my issue, thank you.

Just in i guess.
Maybe be the *real* root cause is "i915 driver send hotplug event to uevent for a connector with same status more than once".

About hotplug event relative patch:

1. [v2] drm/i915: Enable hotplug polling after registering the outputs

   i have no test it yet.

2. drm/i915: Fix DisplayPort Hotplug

    Tested, but not work.
Reply all
Reply to author
Forward
0 new messages