Dirty hack for solving video not playing in Android 7.1 with kernel 4.12

1,411 views
Skip to first unread message

Raymond Lai

unread,
Jul 7, 2017, 3:10:04 AM7/7/17
to Android-x86
Hello world,

Found a little trick to solve the problem of video playback freezes on Android 7.1rc1 with kernel 4.12.

Previously, with stock release of 7.1rc1 which uses kernel 4.9, video playback is working, but with kernel 4.12 (I used maurossi's kernel plus some modifications by Hans de Goede for my device, GPD WIN which is Z8700+brcm4356+onboard Intel graphics) video will freeze.

Seeing discussions on another thread mentioning checking the output of dumpsys SurfaceFlinger, I did the same and saw differences in the output being:

kernel 4.9
Sync configuration: [using: EGL_KHR_fence_sync EGL_KHR_wait_sync]

kernel 4.12
Sync configuration: [using: EGL_ANDROID_native_fence_sync EGL_KHR_wait_sync]

Further digging led me to frameworks/native/libs/gui/SyncFeatures.cpp, and hence this patch. Apply this patch under frameworks/native.

My intention was to make the system behave as if it's running with kernel 4.9, so I made it not answering the display's sync features include EGL_ANDROID_native_fence_sync. After this change I'm able to play videos with MX player + codec pack (without using software decoder), and watch Youtube videos too. Audio output was a bit weird sometimes, but the problem will go away after restart the playback again.

Not sure I did the right thing, but it just worked. However, I found the suspend functionality (which would mean display off + fan off on my GPD WIN) also stopped working after this change, so beware. Also stream video (Livestream streams I suppose?) was still not working.

Enjoy...


0001-Temporary-hack-for-fixing-local-Youtube-video-not-pl.patch

Povilas Staniulis

unread,
Jul 7, 2017, 3:18:31 PM7/7/17
to andro...@googlegroups.com
Had the same issue with my T100TA, will try applying this.
Maybe this will help fix other graphical glitches as well.
> --
> You received this message because you are subscribed to the Google
> Groups "Android-x86" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to android-x86...@googlegroups.com
> <mailto:android-x86...@googlegroups.com>.
> To post to this group, send email to andro...@googlegroups.com
> <mailto:andro...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/android-x86.
> For more options, visit https://groups.google.com/d/optout.


Raymond Lai

unread,
Jul 7, 2017, 8:04:01 PM7/7/17
to Android-x86
I suspect the root of the problem is the incompatibilities between mesa and kernel 4.12's i915 driver. I wish I have the ability of fixing this... as I miss the suspend functions too... and EGL_ANDROID_native_fence_sync is said to be a better way of doing sync.

BTW, off-topic but maybe useful info: tried to run Ubuntu GNOME 16.04 with their build of kernel 4.12, it does have graphical glitches which never met with linuxium's 4.10 kernel. To begin with, screen goes dark that needs wake up, then it flickers so much that it's not very usable.

2017年7月8日土曜日 3時18分31秒 UTC+8 Povilas Staniulis:

spin877

unread,
Jul 7, 2017, 9:13:44 PM7/7/17
to Android-x86

In fact, applying this patch I solved the videos. But the suspend does not work anymore. :(

youling 257

unread,
Jul 9, 2017, 9:12:24 PM7/9/17
to Android-x86
you are right,4.12 kernel lineage os mesa 13.03 hard decoding video no problem,4.12 kernel nougat 7.1.2 mesa 13.03 hard decoding video no problem,,
but,4.12 kernel nougat 7.1.2 mesa 17.14 hard decoding has problem .

在 2017年7月8日星期六 UTC+8上午8:04:01,Raymond Lai写道:
Screenshot_20170709-075801.png
Screenshot_20170709-074907.png

youling 257

unread,
Jul 9, 2017, 9:12:24 PM7/9/17
to Android-x86
I use 4.12 kernel to boot lineage os 0228 version,youtube no problem,hard decoding video no problem . needn't the patch .
android_x86:/ $ su
android_x86:/ # ls -al /dev/magisk/mirror/system/vendor/lib
total 15492
drwxr-xr-x 3 root shell 4096 2017-02-28 21:46 .
drwxr-xr-x 3 root shell 4096 2017-02-28 21:43 ..
-rw-r--r-- 1 root root 12484388 2017-02-28 21:45 libavcodec.so
-rw-r--r-- 1 root root 2046628 2017-02-28 21:45 libavformat.so
-rw-r--r-- 1 root root 415232 2017-02-28 21:43 libavutil.so
-rw-r--r-- 1 root root 91688 2017-02-28 21:46 libffmpeg_extractor.so
-rw-r--r-- 1 root root 62960 2017-02-28 21:46 libffmpeg_omx.so
-rw-r--r-- 1 root root 38388 2017-02-28 21:46 libffmpeg_utils.so
-rw-r--r-- 1 root root 120256 2017-02-28 21:43 libswresample.so
-rw-r--r-- 1 root root 574956 2017-02-28 21:43 libswscale.so
drwxr-xr-x 2 root shell 4096 2017-02-28 21:43 mediadrm
android_x86:/ #

android_x86:/ $ su
android_x86:/ # ls -al /system/vendor/lib
total 16608
drwxr-xr-x 4 root root 280 2017-07-08 10:15 .
drwxr-xr-x 4 root root 80 2017-07-08 10:15 ..
drwxr-xr-x 2 root shell 3488 2017-06-13 23:02 dri
-rwxr-xr-x 1 root shell 13177248 2017-06-08 03:00 libavcodec.so
-rwxr-xr-x 1 root shell 2206168 2017-06-08 03:01 libavformat.so
-rwxr-xr-x 1 root shell 443908 2017-06-08 02:59 libavutil.so
-rwxr-xr-x 1 root shell 91688 2017-06-08 03:01 libffmpeg_extractor.so
-rwxr-xr-x 1 root shell 67056 2017-06-08 03:01 libffmpeg_omx.so
-rwxr-xr-x 1 root shell 38388 2017-06-08 03:01 libffmpeg_utils.so
-rwxr-xr-x 1 root shell 124352 2017-06-08 02:59 libswresample.so
-rwxr-xr-x 1 root shell 574956 2017-06-08 03:01 libswscale.so
-rwxr-xr-x 1 root shell 9664 2017-06-08 02:55 libva-android.so
-rwxr-xr-x 1 root shell 140784 2017-06-08 02:55 libva.so
drwxr-xr-x 2 root root 60 2017-07-08 10:15 mediadrm
android_x86:/ #

youling 257

unread,
Jul 9, 2017, 9:12:24 PM7/9/17
to Android-x86
I need your 32bit /system/lib/libgui.so(include this patch) file to test.

youling 257

unread,
Jul 9, 2017, 9:12:24 PM7/9/17
to Android-x86
the suspend mean is “suspend to idle”,you can give command “echo freeze > /sys/power/state”
for example
[ 137.957051] PM: Syncing filesystems ... done.
[ 138.394938] PM: Preparing system for sleep (freeze)
[ 138.418158] Freezing user space processes ... (elapsed 0.004 seconds) done.
[ 138.422932] OOM killer disabled.
[ 138.422940] Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
[ 138.426045] PM: Suspending system (freeze)
[ 138.426051] Suspending console(s) (use no_console_suspend to debug)
[ 138.532033] serial 00:02: disabled
[ 138.532087] rtc_cmos 00:00: suspend, ctrl 02
[ 138.532099] rtc_cmos 00:00: System wakeup disabled by ACPI
[ 138.532128] gslx680 i2c-MSSL1680:00: gsl_ts_suspend: suspending device
[ 138.533808] RTL8723BS: suspend start
[ 138.533865] RTL8723BS: rtw_cmd_thread(wlan0) stop_req:1, break
[ 138.537396] RTL8723BS: rtw_dev_unload: driver not in IPS
[ 138.548789] RTL8723BS: rtw suspend success in 15 ms
[ 139.449014] PM: suspend of devices complete after 918.506 msecs
[ 139.493075] PM: late suspend of devices complete after 44.041 msecs
[ 139.507831] PM: noirq suspend of devices complete after 14.725 msecs
[ 139.507846] PM: suspend-to-idle
[ 145.537722] Suspended for 6.029 seconds
[ 145.538209] PM: resume from suspend-to-idle
[ 145.572896] PM: noirq resume of devices complete after 34.597 msecs
[ 145.639467] PM: early resume of devices complete after 66.154 msecs
[ 145.700907] RTL8723BS: resume start
[ 145.712016] rtl8723bs: acquire FW from file:rtlwifi/rtl8723bs_nic.bin
[ 145.759586] gslx680 i2c-MSSL1680:00: gsl_ts_resume: resuming device
[ 145.872442] rtc_cmos 00:00: Could not get RTC status
[ 145.872457] rtc_cmos 00:00: resume, ctrl 22
[ 147.237320] RTL8723BS: rtw_resume_common:0 in 1537 ms
[ 147.237544] PM: resume of devices complete after 1598.057 msecs
[ 147.239340] PM: Finishing wakeup.
[ 147.239347] OOM killer enabled.
[ 147.239356] Restarting tasks ... done.
在 2017年7月7日星期五 UTC+8下午3:10:04,Raymond Lai写道:

spin877

unread,
Jul 10, 2017, 7:05:18 PM7/10/17
to Android-x86
I made the downgrade. mesa 13.0.6 of lollipop




Without using this patch.
 And it all works. 

Someone warned Mauro Rossi about the problem?

Message has been deleted
Message has been deleted

Raymond Lai

unread,
Jul 11, 2017, 9:02:42 AM7/11/17
to Android-x86
So I suppose it's another way to avoid the EGL_ANDROID_native_fence_sync?

Not sure the problem is at mesa or kernel. As said earlier, I had display problems running kernel 4.12 with Ubuntu (using their mainline build). Not tried Maui which also access the display directly (Wayland) instead of over X11 though.

2017年7月11日火曜日 7時05分18秒 UTC+8 spin877:

Raymond Lai

unread,
Jul 11, 2017, 11:24:30 AM7/11/17
to Android-x86
Sounds good. If I can relate this to lock screen event (press power button to lock screen)...

2017年7月10日月曜日 9時12分24秒 UTC+8 youling 257:

Povilas Staniulis

unread,
Jul 11, 2017, 6:41:45 PM7/11/17
to andro...@googlegroups.com
I've disabled EGL_ANDROID_native_fence_syncextension in mesa itself.
Suspend and Youtube seem to be working fine now.
Patch attached. Tested with Mauro Rossi's mesa
17.2.0devel_nougat-x86_2017-05-31 release, but should work with other
mesa 17.x versions.
> --
> You received this message because you are subscribed to the Google
> Groups "Android-x86" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to android-x86...@googlegroups.com
> <mailto:android-x86...@googlegroups.com>.
0001-Disable-EGL_ANDROID_native_fence_sync-extension-supp.patch

youling 257

unread,
Jul 11, 2017, 6:44:56 PM7/11/17
to Android-x86
of course can do that,poweroff.doubleclick=1,sleep.earlysuspend=1 ,press button will suspend/resume,power button can wakeup ,also can use volume key to wake up on 4.9 kernel lineage os(by os support use volume key wakeup),4.12 kernel mainline can't use volume key to wakeup on lineage os.
only 4.12+ kernel has oom killer disable/enable when suspend/resume,4.9/4.11 no it .
my reply awaiting moderation .


[ 2358.656987] CPU3: update max cpu_capacity 1024
[ 2358.663145] smpboot: CPU 1 is now offline
[ 2358.701886] CPU3: update max cpu_capacity 1024
[ 2358.701890] smpboot: CPU 2 is now offline
[ 2358.719373] smpboot: CPU 3 is now offline
[ 2358.727254] PM: suspend entry 2017-06-11 19:03:37.312385222 UTC
[ 2358.727261] PM: Syncing filesystems ... done.
[ 2358.749554] PM: Preparing system for sleep (freeze)
[ 2358.750781] type=1400 audit(1497207817.333:4503): avc: denied { read } for pid=11358 comm="kworker/u8:23" name="firmware" dev="mmcblk1p9" ino=17992 scontext=u:r:kernel:s0 tcontext=u:object_r:unlabeled:s0 tclass=lnk_file permissive=1
[ 2358.750913] Freezing user space processes ... (elapsed 0.004 seconds) done.
[ 2358.755394] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[ 2358.757746] PM: Suspending system (freeze)
[ 2358.757754] Suspending console(s) (use no_console_suspend to debug)
[ 2358.773161] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 2358.776432] RTL8723BS: suspend start
[ 2358.782363] serial 00:02: disabled
[ 2358.782414] rtc_cmos 00:00: suspend, ctrl 02
[ 2358.782424] rtc_cmos 00:00: System wakeup disabled by ACPI
[ 2358.782450] gslx680 i2c-MSSL1680:00: gsl_ts_suspend: suspending device
[ 2358.990282] RTL8723BS: nolinked power save leave
[ 2359.203593] RTL8723BS: rtw_cmd_thread(wlan0) stop_req:1, break
[ 2359.206280] RTL8723BS: rtw_dev_unload: driver not in IPS
[ 2359.216620] RTL8723BS: rtw suspend success in 440 ms
[ 2359.572179] PM: suspend of devices complete after 799.645 msecs
[ 2359.611439] PM: late suspend of devices complete after 39.242 msecs
[ 2359.627096] PM: noirq suspend of devices complete after 15.626 msecs
[ 2359.627106] PM: suspend-to-idle
[ 2641.783873] Suspended for 282.156 seconds
[ 2641.784101] PM: resume from suspend-to-idle
[ 2641.816369] PM: noirq resume of devices complete after 32.202 msecs
[ 2641.869860] PM: early resume of devices complete after 53.113 msecs
[ 2641.880656] gslx680 i2c-MSSL1680:00: gsl_ts_resume: resuming device
[ 2641.883959] RTL8723BS: resume start
[ 2641.887668] rtl8723bs: accquire FW from file:rtlwifi/rtl8723bs_nic.bin
[ 2641.993604] rtc_cmos 00:00: Could not get RTC status
[ 2641.993608] rtc_cmos 00:00: resume, ctrl 22
[ 2643.417112] RTL8723BS: rtw_resume_common:0 in 1533 ms
[ 2643.417423] PM: resume of devices complete after 1547.548 msecs
[ 2643.418731] PM: Finishing wakeup.
[ 2643.418737] Restarting tasks ... done.

在 2017年7月11日星期二 UTC+8下午11:24:30,Raymond Lai写道:

youling 257

unread,
Jul 11, 2017, 6:56:38 PM7/11/17
to Android-x86
but ,i edit nougat tile add tasker quick setting, use tile to suspend to idle,not use press power button to suspend .
not use double click status bar to sleep/suspend yet.

在 2017年7月11日星期二 UTC+8下午11:24:30,Raymond Lai写道:
Sounds good. If I can relate this to lock screen event (press power button to lock screen)...
Screenshot_20170712-065134.png
Screenshot_20170712-065220.png
Screenshot_20170712-065041.png
Reply all
Reply to author
Forward
0 new messages