Graphics » History » Version 42
dl lud, 07/12/2020 10:31 AM
Document Viewer does work with libagl.
1 | 1 | Wolfgang Wiedmeyer | h1. Graphics |
---|---|---|---|
2 | |||
3 | 26 | Denis 'GNUtoo' Carikli | h2. History |
4 | 1 | Wolfgang Wiedmeyer | |
5 | 32 | dl lud | Replicant doesn't rely on the dedicated graphics processor (GPU) for accelerated graphics rendering. Instead it uses the CPU with a technique known as software rendering. 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. |
6 | 26 | Denis 'GNUtoo' Carikli | |
7 | 32 | dl lud | At the beginning of Replicant, using the GPU required non-free software on all of the supported devices. As of today free-software replacements exist for some (but not all) the GPUs used in Replicant compatible devices, but the drivers are not ready yet for Replicant. |
8 | 26 | Denis 'GNUtoo' Carikli | |
9 | 32 | dl lud | These drivers implement a subset of the OpenGL ES (GLES) API, and don't support Vulkan, which is now the default for the latest Android versions. They still need to be integrated in Replicant in a way that doesn't make things worse. For instance, due to their incomplete implementation of GLES, it may be needed to configure Replicant to use software rendering for specific apps or system components. |
10 | 26 | Denis 'GNUtoo' Carikli | |
11 | 33 | dl lud | There are more details on the various options we are considering in the [[GraphicsResearch]] and [[GraphicsReplicant9]] wiki pages. |
12 | 26 | Denis 'GNUtoo' Carikli | |
13 | 33 | dl lud | h2. Software renderers |
14 | 26 | Denis 'GNUtoo' Carikli | |
15 | 39 | dl lud | Until [[Images#Replicant-60-0003-images|version 6.0 0003]], Replicant used [[GraphicsResearch#libagl|libagl]]. libagl is fast, but [[Graphics#Known-issues-with-libagl|caused several issues]] due to lack of GLES 2.0 support. |
16 | 16 | doak complex | |
17 | 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. |
18 | 16 | doak complex | |
19 | 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. |
20 | 17 | dl lud | |
21 | 26 | Denis 'GNUtoo' Carikli | h3. Methods to choose the software renderer |
22 | 1 | Wolfgang Wiedmeyer | |
23 | 40 | Denis 'GNUtoo' Carikli | h4. Installation |
24 | 19 | dl lud | |
25 | 40 | Denis 'GNUtoo' Carikli | The script should be shipped in Replicant 6.0 0004 RC2. |
26 | 1 | Wolfgang Wiedmeyer | |
27 | 40 | Denis 'GNUtoo' Carikli | If you run a Replicant version that is before 6.0 0004 RC2, you will need to install the scripts. |
28 | |||
29 | To do that, from your PC, clone the user-scripts repository: |
||
30 | 1 | Wolfgang Wiedmeyer | <pre> |
31 | 40 | Denis 'GNUtoo' Carikli | git clone https://git.replicant.us/replicant/vendor_replicant-scripts -b replicant-6.0 |
32 | 1 | Wolfgang Wiedmeyer | </pre> |
33 | |||
34 | 41 | dl lud | For the next steps, [[ADB]] needs to be set up and [[ADB#Accessing-root-shell|running as root]]. Connect the device to your PC. The scripts are in the @networking/modem@ folder. Run the setup script from that folder to push the scripts to the device: |
35 | 40 | Denis 'GNUtoo' Carikli | <pre> |
36 | cd vendor_replicant-scripts |
||
37 | cd display/renderer/ |
||
38 | ./setup.sh |
||
39 | </pre> |
||
40 | 1 | Wolfgang Wiedmeyer | |
41 | 40 | Denis 'GNUtoo' Carikli | Then disconnect the device. Make sure [[UsageNotes#Enabling-root-access|root access for apps]] is enabled. |
42 | 1 | Wolfgang Wiedmeyer | |
43 | 40 | Denis 'GNUtoo' Carikli | h4. Usage |
44 | 27 | Denis 'GNUtoo' Carikli | |
45 | 40 | Denis 'GNUtoo' Carikli | Open a [[UsageNotes#Terminal-emulator|terminal emulator]]. If the terminal is not running as root, you can gain root by running: |
46 | 1 | Wolfgang Wiedmeyer | <pre> |
47 | 40 | Denis 'GNUtoo' Carikli | su |
48 | </pre> |
||
49 | |||
50 | To switch everything back to libagl, run the following command: |
||
51 | <pre> |
||
52 | graphics.sh faster |
||
53 | 1 | Wolfgang Wiedmeyer | </pre> |
54 | 40 | Denis 'GNUtoo' Carikli | It will then switch to libagl and reboot. |
55 | 1 | Wolfgang Wiedmeyer | |
56 | 40 | Denis 'GNUtoo' Carikli | To switch back use llvmpipe by default, run the following command: |
57 | 1 | Wolfgang Wiedmeyer | <pre> |
58 | 40 | Denis 'GNUtoo' Carikli | graphics.sh compatible |
59 | 1 | Wolfgang Wiedmeyer | </pre> |
60 | 40 | Denis 'GNUtoo' Carikli | It will then switch back to llvmpipe by default and reboot. |
61 | 27 | Denis 'GNUtoo' Carikli | |
62 | 40 | Denis 'GNUtoo' Carikli | h4. Directly from the command line |
63 | |||
64 | If you don't want to install any scripts, you can use the following command line to switch back and forth between llvmpipe and libagl: |
||
65 | <pre> |
||
66 | 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" |
||
67 | </pre> |
||
68 | |||
69 | Then, you will need to reboot the device. To switch back to previous renderer, you can run the above command again and reboot the device again. |
||
70 | |||
71 | 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. |
||
72 | 20 | dl lud | |
73 | 26 | Denis 'GNUtoo' Carikli | h4. Choosing the software renderer for a specific app |
74 | 18 | dl lud | |
75 | 19 | dl lud | # Find out the app ID. Example: @org.gnu.icecat@ |
76 | 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: |
77 | 1 | Wolfgang Wiedmeyer | <pre> |
78 | 18 | dl lud | adb shell touch /data/data/org.gnu.icecat/libGLES_android |
79 | 19 | dl lud | </pre> |
80 | 24 | dl lud | To force llvmpipe instead, use a file named @libGLES_mesa@. |
81 | 19 | dl lud | # Restart the app. For instance: kill it and open again. |
82 | 1 | Wolfgang Wiedmeyer | # Get back to the default renderer by removing the file. Example command: |
83 | <pre> |
||
84 | adb shell rm /data/data/org.gnu.icecat/libGLES_android |
||
85 | </pre> |
||
86 | |||
87 | This method only works for Replicant 6.0 0004. |
||
88 | |||
89 | 26 | Denis 'GNUtoo' Carikli | h4. Choosing the software renderer for a system component |
90 | 1 | Wolfgang Wiedmeyer | |
91 | 28 | Denis 'GNUtoo' Carikli | The following method only works for Replicant 6.0 0004. |
92 | |||
93 | 1 | Wolfgang Wiedmeyer | System components usually lack a directory in the data partition. Thus, another method must be used to switch their software renderer. |
94 | |||
95 | 28 | Denis 'GNUtoo' Carikli | # Find out the process name. This can be done by getting the process pid with @ps@ or @pidof@ and then looking at /proc/<pid>/cmdline. |
96 | For instance for surfaceflinger: |
||
97 | 1 | Wolfgang Wiedmeyer | <pre> |
98 | 36 | dl lud | root@i9300:/ $ pidof surfaceflinger |
99 | 28 | Denis 'GNUtoo' Carikli | 1984 |
100 | 36 | dl lud | root@i9300:/ $ cat /proc/1984/cmdline ; echo |
101 | 1 | Wolfgang Wiedmeyer | /system/bin/surfaceflinger |
102 | </pre> |
||
103 | Here the process name is @/system/bin/surfaceflinger@. |
||
104 | 35 | dl lud | Or for system_server: |
105 | 1 | Wolfgang Wiedmeyer | <pre> |
106 | 36 | dl lud | root@i9300:/ $ pidof system_server |
107 | 28 | Denis 'GNUtoo' Carikli | 2362 |
108 | 36 | dl lud | root@i9300:/ $ cat /proc/2362/cmdline ; echo |
109 | 28 | Denis 'GNUtoo' Carikli | system_server |
110 | </pre> |
||
111 | Here the process name is @system_server@. |
||
112 | # Force the component to always use libagl by creating an empty file at @/system/etc/libGLES_android/<process_name>@. |
||
113 | For surfaceflinger: |
||
114 | <pre> |
||
115 | 1 | Wolfgang Wiedmeyer | adb shell mkdir -p /system/etc/libGLES_android/system/bin |
116 | adb shell touch /system/etc/libGLES_android/system/bin/surfaceflinger |
||
117 | </pre> |
||
118 | 28 | Denis 'GNUtoo' Carikli | Or for system_server: |
119 | 1 | Wolfgang Wiedmeyer | <pre> |
120 | 28 | Denis 'GNUtoo' Carikli | adb shell mkdir -p /system/etc/libGLES_android/ |
121 | adb shell touch /system/etc/libGLES_android/system_server |
||
122 | </pre> |
||
123 | 1 | Wolfgang Wiedmeyer | To force llvmpipe instead, create the file under @/system/etc/libGLES_mesa/@. |
124 | 35 | dl lud | # Reboot your device, or restart the specific system component individually (if possible). |
125 | 28 | Denis 'GNUtoo' Carikli | # Get back to the default renderer by removing the file. |
126 | For surfaceflinger: |
||
127 | 1 | Wolfgang Wiedmeyer | <pre> |
128 | adb shell rm /system/etc/libGLES_android/system/bin/surfaceflinger |
||
129 | 19 | dl lud | </pre> |
130 | 28 | Denis 'GNUtoo' Carikli | For system_server: |
131 | <pre> |
||
132 | adb shell rm /system/etc/libGLES_android/system_server |
||
133 | </pre> |
||
134 | 19 | dl lud | |
135 | 1 | Wolfgang Wiedmeyer | h2. Known issues with libagl |
136 | 16 | doak complex | |
137 | 14 | doak complex | * Selecting the third option besides photo and video (Panorama mode) will crash the Camera app. |
138 | * Video playback in the browser does not work. (issue #1533) |
||
139 | * Screenshots do not work. (see [[Screenshots]] for a workaround) |
||
140 | 1 | Wolfgang Wiedmeyer | * Selecting wallpapers from storage does not work. |
141 | * Screen content is sometimes shortly visible before unlocking. (issue #1275, happens with llvmpipe as well) |
||
142 | * Previews of the windows in the tasks switcher are missing. |
||
143 | * Switching between apps, apps and the launcher or different views inside an app is sometimes slow and the device may seem unresponsive. |
||
144 | * There are issues with using folders with the Trebuchet launcher. (issue #1790, happens with llvmpipe as well) |
||
145 | 14 | doak complex | |
146 | 19 | dl lud | h3. Popular apps from F-Droid that do not work with libagl |
147 | 14 | doak complex | |
148 | 16 | doak complex | * All Firefox-based browsers like "IceCatMobile":https://f-droid.org/repository/browse/?fdfilter=icecat&fdid=org.gnu.icecat and Orfox |
149 | 1 | Wolfgang Wiedmeyer | * "LibreOffice Viewer":https://f-droid.org/repository/browse/?fdfilter=libreoffice&fdid=org.documentfoundation.libreoffice |
150 | * "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) |
||
151 | 42 | dl lud | * -"Document Viewer":https://f-droid.org/repository/browse/?fdfilter=document+viewer&fdid=org.sufficientlysecure.viewer- (current version works with libagl) |
152 | 2 | Wolfgang Wiedmeyer | |
153 | 19 | dl lud | h2. Known issues with llvmpipe |
154 | |||
155 | * Too slow to use in SurfaceFlinger (screen compositor). |
||
156 | * 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. |
||
157 | |||
158 | 8 | Denis 'GNUtoo' Carikli | h2. See also |
159 | 9 | Denis 'GNUtoo' Carikli | |
160 | 19 | dl lud | There is a page about [[GraphicsResearch]] that gathers information to improve graphics support. |