[Replicant] [PATCH 0/1] EGL Loader patch to use both LLVMpipe and libagl at once
Wellton Costa
contato at wellton.com.br
Tue Jan 16 12:58:30 UTC 2018
phenomenal, congratulations on the work, I'll test it on my i9300 in a
moment.
Thanks for sharing.
----------------------------------------
From: "Jookia" <166291 at gmail.com>
Sent: Monday, December 4, 2017 5:04 PM
To: replicant at osuosl.org
Subject: [Replicant] [PATCH 0/1] EGL Loader patch to use both LLVMpipe and
libagl at once
Hey Replicant!
There's been an issue of having llvmpipe be too slow, so I cooked up a
patch
to allow people to use both LLVMpipe and libagl at the same time.
The patch follows and includes a large amount of documentation in the
code.
Apply it to frameworks/native.
I've attached a tarball with binary patches that works for i9100 and
i9300.
Extract it then follow these instructions to test it.
Connect your phone and run this adb command:
adb root
adb remount
adb shell "getprop ro.zygote.disable_gl_preload"
This should output two values. The first should be "true". If this isn't
the
case, please tell me since it means the patch will not work on your phone.
Now run this:
find system/ -type f | while read f; do adb shell mv /$f /$f.bak; adb push
$f /$f; done
adb shell "find /system/lib/ -type f -name \"*.bak\""
It should say something like this:
3188 KB/s (461324 bytes in 0.141s)
764 KB/s (34408 bytes in 0.043s)
2673 KB/s (54888 bytes in 0.020s)
/system/lib/libEGL.so.bak
/system/lib/libGLESv1_CM.so.bak
/system/lib/libGLESv2.so.bak
This has installed the binary patch. To revert this patch, run this:
find system/ -type f | while read f; do adb shell mv /$f.bak /$f; done
Now that the patch is installed, find a program on your phone that you
suspect
crashes because of the graphics renderer. A good example is Orfox or
Fennec
F-Droid. Try and run them until they crash to verify this is the case.
Now open the app info (hold down the app name in the launcher to get this
option) and find the name of the application. It looks like a reverse DNS
name.
Now from adb run something like:
adb shell "setprop persist.egl."$(cut -c -19 <<<
"info.guardianproject.orfox")" /system/lib/libEGL/libGLES_mesa.so"
To remove an override run the same thing but with '' as the value:
adb shell "setprop persist.egl."$(cut -c -19 <<<
"info.guardianproject.orfox")" ''"
This makes Orfox use llvmpipe. Now run this then start Orfox while it
logs:
adb logcat | grep libEGL
It should log something like:
11-08 07:29:20.715 24869 24888 I Gecko : Attempting load of libEGL.so
11-08 07:29:20.716 24869 24888 D libEGL : checking persist.egl._uid_10079
then persist.egl.info.guardianprojec for overrides...
11-08 07:29:20.716 24869 24888 D libEGL : override found:
/system/lib/egl/libGLES_mesa.so
11-08 07:29:20.749 24869 24888 D libEGL : loaded
/system/lib/egl/libGLES_mesa.so
This also works for any application so I suppose you could get the name
this way too.
For instance, this is what the default browser does:
11-08 07:30:49.683 24994 24994 D libEGL : checking persist.egl._uid_10033
then persist.egl.com.android.browser for overrides...
11-08 07:30:49.683 24994 24994 D libEGL : no override found
11-08 07:30:49.683 24994 24994 D libEGL : Emulator without GPU support
detected. Fallback to software renderer.
11-08 07:30:49.708 24994 24994 D libEGL : loaded
/system/lib/egl/libGLES_android.so
You can use this to find out the names/uids and why your overrides don't
work.
Additionally, you might even have your phone use llvmpipe by default
already.
In that case you could set something like the launcher to use the software
renderer by specifying /system/lib/egl/libGLES_android.so instead of
/system/lib/libEGL/libGLES_mesa.so !
Finally, GL libraries are only loaded when the application starts. Make
sure to
force close an application for overrides to take effect.
Overrides persist between reboots and only need to be set once.
So far the biggest criticism of this patch is that due to the truncated
nature
of using system properties it's unambiguous. I've also heard of two
security-related complaints:
You could somehow trick applications in to loading with the wrong driver,
and
having the properties global like this means applications could figure out
what
might be on someone's phone. I don't see an issue with loading the wrong
driver,
or exposing what applications someone has set to use a specific renderer.
That's about it, cheers.
Jookia.
Jookia (1):
egl loader: add ability to override the opengl renderer at runtime
opengl/libs/EGL/Loader.cpp | 132
++++++++++++++++++++++++++++++++++++---------
1 file changed, 106 insertions(+), 26 deletions(-)
--
2.12.2
_______________________________________________
Replicant mailing list
Replicant at osuosl.org
https://lists.osuosl.org/mailman/listinfo/replicant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/replicant/attachments/20180116/c34db608/attachment.html>
More information about the Replicant
mailing list