Project

General

Profile

Graphics » History » Version 26

Denis 'GNUtoo' Carikli, 01/24/2020 01:32 PM
Improve introduction

1 1 Wolfgang Wiedmeyer
h1. Graphics
2
3 26 Denis 'GNUtoo' Carikli
h2. History
4 1 Wolfgang Wiedmeyer
5 26 Denis 'GNUtoo' Carikli
Replicant doesn't reply on the GPU for accelerated graphics rendering. Instead it uses the CPU with a technique known as software rendering.
6
7
At the begining of Replicant, using the dedicated graphics processor (GPU) required non-free software on all of the supported devices. As of today free-software replacements exist for some (but not all) of the GPUs used in Replicant compatible devices, but the drivers are not ready yet for Replicant.
8
9
They also implemnet a subset of the OpenGL/OpenGL-ES API and don't support Vulkan yet which is now the default for the latest Android versions.
10
11
The free GPU drivers would also need to be integrated in Replicant in a way that doesn't make things worse. As it's not possible to use GPU acceleration and software rendering at the same time, the GPU accelerated graphics could be integrated but switched off by default, and scripts could be made to switch between both.
12
13
There are more details on the various options we are considering in the [[GraphicsResearch]] wiki page. 
14
15
Software rendering is the reason why Replicant devices appear slow at times and is responsible for a lot of crashes that can happen during usage.
16
17
h2. Using llvmpipe
18
19 18 dl lud
Until [[Images#Replicant-60-0003-images|version 6.0 0003]], Replicant used the [[GraphicsResearch#Android-software-renderer|Android software renderer]], also known as libagl. libagl is fast, but [[Graphics#Known-issues-with-libagl|caused several issues]] due to lack of OpenGL ES (GLES) 2.0 support.
20 16 doak complex
21 18 dl lud
As of "Replicant 6.0 0004 rc1":https://ftp.osuosl.org/pub/replicant/images/replicant-6.0/0004-rc1/, [[GraphicsResearch#Mesas-llvmpipe|llvmpipe]] is used as the default software renderer. llvmpipe has a more complete GLES implementation than libagl (see #705), so more apps work with it, like Firefox-based browsers or more recent WebViews (see #1780). Unfortunately, llvmpipe is too slow for certain system components, which may also be true for some apps. Furthermore, certain apps still crash with llvmpipe, although less frequently. Usually the screen stays black if an app does not work with llvmpipe.
22 16 doak complex
23 1 Wolfgang Wiedmeyer
To cater for these issues, Replicant 6.0 0004 includes a "mechanism to choose between llvmpipe and ligagl, on a per process basis":https://lists.osuosl.org/pipermail/replicant/2019-August/002054.html. Such mechanism is "actually used":https://lists.osuosl.org/pipermail/replicant/2020-January/002421.html on the Replicant 6.0 0004 images to force some system components (bootanimation, SurfaceFlinger and system_server) to use libagl.
24 17 dl lud
25 26 Denis 'GNUtoo' Carikli
h3. Methods to choose the software renderer
26 1 Wolfgang Wiedmeyer
27
For all the methods bellow you must have [[ADB]] installed on your computer. Make sure that it can access the device's [[ADB#Accessing-root-shell|root shell]] and that the [[ADB#Modifying-the-system-partition|system partition is mounted as writable]].
28 19 dl lud
29 26 Denis 'GNUtoo' Carikli
h4. Choosing the default software renderer
30 17 dl lud
31 1 Wolfgang Wiedmeyer
The following command switches between llvmpipe and libagl:
32
<pre>
33
adb shell "grep -q "ro.libagl=1" /system/build.prop && sed "s/ro.libagl=1/ro.libagl=0/" -i /system/build.prop || sed "s/ro.libagl=0/ro.libagl=1/" -i /system/build.prop" 
34 17 dl lud
</pre>
35 1 Wolfgang Wiedmeyer
36
Then reboot the device. To switch back to previous renderer, run the above command again and reboot the device.
37 20 dl lud
38 18 dl lud
This method works on both Replicant 6.0 0003 and 0004. Do note that: on 0003 you will start with libagl by default, whereas on 0004 the default is llvmpipe.
39 19 dl lud
40 26 Denis 'GNUtoo' Carikli
h4. Choosing the software renderer for a specific app
41 18 dl lud
42 19 dl lud
# Find out the app ID. Example: @org.gnu.icecat@
43 18 dl lud
# Force the app to always use libagl by creating empty file named @libGLES_android@ on it's data directory (e.g. @/data/data/org.gnu.icecat/@). Example command:
44 1 Wolfgang Wiedmeyer
<pre>
45 18 dl lud
adb shell touch /data/data/org.gnu.icecat/libGLES_android
46 19 dl lud
</pre>
47 24 dl lud
To force llvmpipe instead, use a file named @libGLES_mesa@.
48 19 dl lud
# Restart the app. For instance: kill it and open again.
49 1 Wolfgang Wiedmeyer
# Get back to the default renderer by removing the file. Example command:
50
<pre>
51
adb shell rm /data/data/org.gnu.icecat/libGLES_android
52
</pre>
53
54
This method only works for Replicant 6.0 0004.
55
56 26 Denis 'GNUtoo' Carikli
h4. Choosing the software renderer for a system component
57 1 Wolfgang Wiedmeyer
58 19 dl lud
System components usually lack a directory in the data partition. Thus, another method must be used to switch their software renderer.
59 1 Wolfgang Wiedmeyer
60 19 dl lud
# Find out the full path of the executable. You can use @which@ for that:
61
<pre>
62
root@i9300:/ # which surfaceflinger
63
/system/bin/surfaceflinger
64
</pre>
65 23 dl lud
# Force the component to always use libagl by creating an empty file at @/system/etc/libGLES_android/<executable_full_path>@. Example commands:
66 19 dl lud
<pre>
67
adb shell mkdir -p /system/etc/libGLES_android/system/bin
68
adb shell touch /system/etc/libGLES_android/system/bin/surfaceflinger
69
</pre>
70
To force llvmpipe instead, create the file under @/system/etc/libGLES_mesa/@.
71 24 dl lud
# Reboot your device, or restart the specific system component individualy (if possible).
72 19 dl lud
# Get back to the default renderer by removing the file. Example command:
73
<pre>
74
adb shell rm /system/etc/libGLES_android/system/bin/surfaceflinger
75
</pre>
76
77
This method only works for Replicant 6.0 0004.
78
79 1 Wolfgang Wiedmeyer
h2. Known issues with libagl
80 16 doak complex
81 14 doak complex
* Selecting the third option besides photo and video (Panorama mode) will crash the Camera app.
82
* Video playback in the browser does not work. (issue #1533)
83
* Screenshots do not work. (see [[Screenshots]] for a workaround)
84 1 Wolfgang Wiedmeyer
* Selecting wallpapers from storage does not work.
85
* Screen content is sometimes shortly visible before unlocking. (issue #1275, happens with llvmpipe as well)
86
* Previews of the windows in the tasks switcher are missing.
87
* Switching between apps, apps and the launcher or different views inside an app is sometimes slow and the device may seem unresponsive.
88
* There are issues with using folders with the Trebuchet launcher. (issue #1790, happens with llvmpipe as well)
89 14 doak complex
90 19 dl lud
h3. Popular apps from F-Droid that do not work with libagl
91 14 doak complex
92 16 doak complex
* All Firefox-based browsers like "IceCatMobile":https://f-droid.org/repository/browse/?fdfilter=icecat&fdid=org.gnu.icecat and Orfox
93 1 Wolfgang Wiedmeyer
* "Document Viewer":https://f-droid.org/repository/browse/?fdfilter=document+viewer&fdid=org.sufficientlysecure.viewer
94
* "LibreOffice Viewer":https://f-droid.org/repository/browse/?fdfilter=libreoffice&fdid=org.documentfoundation.libreoffice
95 16 doak complex
* "RedReader":https://f-droid.org/repository/browse/?fdfilter=redreader&fdid=org.quantumbadger.redreader cannot display images ("upstream bug":https://github.com/QuantumBadger/RedReader/issues/279)
96 2 Wolfgang Wiedmeyer
97 19 dl lud
h2. Known issues with llvmpipe
98
99
* Too slow to use in SurfaceFlinger (screen compositor).
100
* If SurfaceFlinger uses llvmpipe, Gallery and Orbot render some GUI elements are visible while the main screen is black. The GUI of Simple File Manager works as long as no image is viewed in fullscreen.
101
102 8 Denis 'GNUtoo' Carikli
h2. See also
103 9 Denis 'GNUtoo' Carikli
104 19 dl lud
There is a page about [[GraphicsResearch]] that gathers information to improve graphics support.