Replicant doesn't reply on the GPU for accelerated graphics rendering. Instead it uses the CPU with a technique known as software rendering.
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.
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.
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.
There are more details on the various options we are considering in the GraphicsResearch wiki page.
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.
Until version 6.0 0003, Replicant used the Android software renderer, also known as libagl. libagl is fast, but caused several issues due to lack of OpenGL ES (GLES) 2.0 support.
As of Replicant 6.0 0004 rc1, 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.
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.
For all the methods bellow you must have ADB installed on your computer. Make sure that it can access the device's root shell and that the system partition is mounted as writable.
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"
Then reboot the device. To switch back to previous renderer, run the above command again and reboot the device.
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.
The following command switches everything back to libagl:
androidsw.sh
And to switch back to the default (libagl for some system components, and llvmpipe for all the rest)
llvmpipe.sh
Then the device will reboot.
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.
org.gnu.icecat
libGLES_android
on it's data directory (e.g. /data/data/org.gnu.icecat/
). Example command:adb shell touch /data/data/org.gnu.icecat/libGLES_android
libGLES_mesa
.adb shell rm /data/data/org.gnu.icecat/libGLES_android
This method only works for Replicant 6.0 0004.
The following method only works for Replicant 6.0 0004.
System components usually lack a directory in the data partition. Thus, another method must be used to switch their software renderer.
ps
or pidof
and then looking at /proc/<pid>/cmdline.For instance for surfaceflinger:
shell@i9300:/ $ pidof surfaceflinger 1984 shell@i9300:/ $ cat /proc/1984/cmdline ; echo /system/bin/surfaceflinger
/system/bin/surfaceflinger
.
or for system_server:
shell@i9300:/ $ pidof system_server 2362 shell@i9300:/ $ cat /proc/2362/cmdline ; echo system_server
system_server
.
/system/etc/libGLES_android/<process_name>
.For surfaceflinger:
adb shell mkdir -p /system/etc/libGLES_android/system/bin adb shell touch /system/etc/libGLES_android/system/bin/surfaceflinger
adb shell mkdir -p /system/etc/libGLES_android/ adb shell touch /system/etc/libGLES_android/system_serverTo force llvmpipe instead, create the file under
/system/etc/libGLES_mesa/
.
For surfaceflinger:
adb shell rm /system/etc/libGLES_android/system/bin/surfaceflinger
For system_server:
adb shell rm /system/etc/libGLES_android/system_server
There is a page about GraphicsResearch that gathers information to improve graphics support.