diff options
author | Jeremy Rand <jeremy@veclabs.net> | 2019-12-11 23:12:11 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-12-13 17:30:47 +0100 |
commit | 994026f5c05313829d54a8e44d0f26c1e90e872c (patch) | |
tree | 43cabe80765fc557a579b5d85dd501bc4b7b9d75 /display/renderer | |
parent | d806bba30f03b8d412f159160f06c364f898d653 (diff) | |
download | vendor_replicant-scripts-994026f5c05313829d54a8e44d0f26c1e90e872c.tar.gz vendor_replicant-scripts-994026f5c05313829d54a8e44d0f26c1e90e872c.tar.bz2 vendor_replicant-scripts-994026f5c05313829d54a8e44d0f26c1e90e872c.zip |
Add scripts to switch between LLVMpipe and libagl globally.
Replicant will soon merge patches to set the default renderer
for each application:
- Libagl was previously used for all applications. That prevented
to use applications like IceCatMobile, which were crashing
because libagl OpenGL implementation was incomplete.
- Some system applications or components are known to have
huge performance issues with LLVMpipe.
Replicant will hopefully have good defaults settings that satisfy
most users, however it's still interesting to be able to change
the renderer system wide to workaround potential issues with the
default settings, or do some debugging or benchmarks.
Signed-off-by: Jeremy Rand <jeremy@veclabs.net>
GNUtoo@cyberdimension.org: commit message, fixed interpreter path
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: David Ludovino <dllud@riseup.net>
Diffstat (limited to 'display/renderer')
-rw-r--r-- | display/renderer/device-files/androidsw.sh | 51 | ||||
-rw-r--r-- | display/renderer/device-files/llvmpipe.sh | 51 | ||||
-rwxr-xr-x | display/renderer/setup.sh | 5 |
3 files changed, 107 insertions, 0 deletions
diff --git a/display/renderer/device-files/androidsw.sh b/display/renderer/device-files/androidsw.sh new file mode 100644 index 0000000..175e41f --- /dev/null +++ b/display/renderer/device-files/androidsw.sh @@ -0,0 +1,51 @@ +#!/system/xbin/bash +# +# Copyright (C) 2017 Jeremy Rand <jeremy@veclabs.net> +# Partially based on code by Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> and Filippo Fil Bergamo +# +# This file is part of "Replicant Renderer Switcher", a set of shell scripts to switch between +# the Android Software Renderer and the llvmpipe renderer in Replicant. +# +# Replicant Renderer Switcher is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Replicant Renderer Switcher is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -euf -o pipefail + +grep -q "ro.libagl=0" /system/build.prop && renderer="llvmpipe" || renderer="android" + +if [ "${renderer}" == "android" ] +then + echo "Android software renderer is already enabled!" + exit 1 +fi + +echo "Remounting system partition as writable..." +mount -o rw,remount /system + +echo "Enabling Android software renderer..." +sed "s/ro.libagl=0/ro.libagl=1/" -i /system/build.prop + +echo "Syncing filesystem..." +sync +sync + +echo "Remounting system partition as read-only..." +mount -o ro,remount /system + +echo "Syncing filesystem..." +sync +sync + +# https://android.stackexchange.com/a/139139 +echo "Android software renderer will be enabled after we reboot now..." +am start -a android.intent.action.REBOOT diff --git a/display/renderer/device-files/llvmpipe.sh b/display/renderer/device-files/llvmpipe.sh new file mode 100644 index 0000000..d40c4ec --- /dev/null +++ b/display/renderer/device-files/llvmpipe.sh @@ -0,0 +1,51 @@ +#!/system/xbin/bash +# +# Copyright (C) 2017 Jeremy Rand <jeremy@veclabs.net> +# Partially based on code by Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> and Filippo Fil Bergamo +# +# This file is part of "Replicant Renderer Switcher", a set of shell scripts to switch between +# the Android Software Renderer and the llvmpipe renderer in Replicant. +# +# Replicant Renderer Switcher is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Replicant Renderer Switcher is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +set -euf -o pipefail + +grep -q "ro.libagl=0" /system/build.prop && renderer="llvmpipe" || renderer="android" + +if [ "${renderer}" == "llvmpipe" ] +then + echo "llvmpipe is already enabled!" + exit 1 +fi + +echo "Remounting system partition as writable..." +mount -o rw,remount /system + +echo "Enabling llvmpipe..." +sed "s/ro.libagl=1/ro.libagl=0/" -i /system/build.prop + +echo "Syncing filesystem..." +sync +sync + +echo "Remounting system partition as read-only..." +mount -o ro,remount /system + +echo "Syncing filesystem..." +sync +sync + +# https://android.stackexchange.com/a/139139 +echo "llvmpipe will be enabled after we reboot now..." +am start -a android.intent.action.REBOOT diff --git a/display/renderer/setup.sh b/display/renderer/setup.sh new file mode 100755 index 0000000..ac5abe8 --- /dev/null +++ b/display/renderer/setup.sh @@ -0,0 +1,5 @@ +root_dir="/data/misc/renderer" +adb root +sleep 3 +adb shell mkdir -p "$root_dir" +adb push ./device-files/* "$root_dir/" |