Graphics » History » Version 38

dl lud, 01/24/2020 08:16 PM
Add 6.0 (Replicant version) to the section title.

1 1 Wolfgang Wiedmeyer
h1. Graphics
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 33 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 GLES 2.0 support.
16 16 doak complex
17 18 dl lud
As of "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": Such mechanism is "actually used": 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
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]].
24 19 dl lud
25 37 dl lud
h4. Choosing the default software renderer on Replicant 6.0 0003
26 17 dl lud
27 1 Wolfgang Wiedmeyer
The following command switches between llvmpipe and libagl:
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" 
30 17 dl lud
31 1 Wolfgang Wiedmeyer
Then reboot the device. To switch back to previous renderer, run the above command again and reboot the device.
33 27 Denis 'GNUtoo' Carikli
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.
36 38 dl lud
h4. Choosing the default software renderer on Replicant 6.0 0004
37 27 Denis 'GNUtoo' Carikli
The following command switches everything back to libagl:
And to switch back to the default (libagl for some system components, and llvmpipe for all the rest)
Then the device will reboot.
49 20 dl lud
50 26 Denis 'GNUtoo' Carikli
h4. Choosing the software renderer for a specific app
51 18 dl lud
52 19 dl lud
# Find out the app ID. Example: @org.gnu.icecat@
53 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:
54 1 Wolfgang Wiedmeyer
55 18 dl lud
adb shell touch /data/data/org.gnu.icecat/libGLES_android
56 19 dl lud
57 24 dl lud
To force llvmpipe instead, use a file named @libGLES_mesa@.
58 19 dl lud
# Restart the app. For instance: kill it and open again.
59 1 Wolfgang Wiedmeyer
# Get back to the default renderer by removing the file. Example command:
adb shell rm /data/data/org.gnu.icecat/libGLES_android
This method only works for Replicant 6.0 0004.
66 26 Denis 'GNUtoo' Carikli
h4. Choosing the software renderer for a system component
67 1 Wolfgang Wiedmeyer
68 28 Denis 'GNUtoo' Carikli
The following method only works for Replicant 6.0 0004.
70 1 Wolfgang Wiedmeyer
System components usually lack a directory in the data partition. Thus, another method must be used to switch their software renderer.
72 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. 
For instance for surfaceflinger:
74 1 Wolfgang Wiedmeyer
75 36 dl lud
root@i9300:/ $ pidof surfaceflinger
76 28 Denis 'GNUtoo' Carikli
77 36 dl lud
root@i9300:/ $ cat /proc/1984/cmdline ; echo                                  
78 1 Wolfgang Wiedmeyer
Here the process name is @/system/bin/surfaceflinger@.
81 35 dl lud
Or for system_server:
82 1 Wolfgang Wiedmeyer
83 36 dl lud
root@i9300:/ $ pidof system_server
84 28 Denis 'GNUtoo' Carikli
85 36 dl lud
root@i9300:/ $ cat /proc/2362/cmdline ; echo                                  
86 28 Denis 'GNUtoo' Carikli
Here the process name is @system_server@.
# Force the component to always use libagl by creating an empty file at @/system/etc/libGLES_android/<process_name>@.
For surfaceflinger:
92 1 Wolfgang Wiedmeyer
adb shell mkdir -p /system/etc/libGLES_android/system/bin
adb shell touch /system/etc/libGLES_android/system/bin/surfaceflinger
95 28 Denis 'GNUtoo' Carikli
Or for system_server:
96 1 Wolfgang Wiedmeyer
97 28 Denis 'GNUtoo' Carikli
adb shell mkdir -p /system/etc/libGLES_android/
adb shell touch /system/etc/libGLES_android/system_server
100 1 Wolfgang Wiedmeyer
To force llvmpipe instead, create the file under @/system/etc/libGLES_mesa/@.
101 35 dl lud
# Reboot your device, or restart the specific system component individually (if possible).
102 28 Denis 'GNUtoo' Carikli
# Get back to the default renderer by removing the file.
For surfaceflinger:
104 1 Wolfgang Wiedmeyer
adb shell rm /system/etc/libGLES_android/system/bin/surfaceflinger
106 19 dl lud
107 28 Denis 'GNUtoo' Carikli
For system_server:
adb shell rm /system/etc/libGLES_android/system_server
111 19 dl lud
112 1 Wolfgang Wiedmeyer
h2. Known issues with libagl
113 16 doak complex
114 14 doak complex
* Selecting the third option besides photo and video (Panorama mode) will crash the Camera app.
* Video playback in the browser does not work. (issue #1533)
* Screenshots do not work. (see [[Screenshots]] for a workaround)
117 1 Wolfgang Wiedmeyer
* Selecting wallpapers from storage does not work.
* Screen content is sometimes shortly visible before unlocking. (issue #1275, happens with llvmpipe as well)
* Previews of the windows in the tasks switcher are missing.
* Switching between apps, apps and the launcher or different views inside an app is sometimes slow and the device may seem unresponsive.
* There are issues with using folders with the Trebuchet launcher. (issue #1790, happens with llvmpipe as well)
122 14 doak complex
123 19 dl lud
h3. Popular apps from F-Droid that do not work with libagl
124 14 doak complex
125 16 doak complex
* All Firefox-based browsers like "IceCatMobile": and Orfox
126 1 Wolfgang Wiedmeyer
* "Document Viewer":
* "LibreOffice Viewer":
128 16 doak complex
* "RedReader": cannot display images ("upstream bug":
129 2 Wolfgang Wiedmeyer
130 19 dl lud
h2. Known issues with llvmpipe
* Too slow to use in SurfaceFlinger (screen compositor).
* 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.
135 8 Denis 'GNUtoo' Carikli
h2. See also
136 9 Denis 'GNUtoo' Carikli
137 19 dl lud
There is a page about [[GraphicsResearch]] that gathers information to improve graphics support.