mirror of
https://github.com/brain-hackers/brain-config.git
synced 2025-02-08 19:50:07 +09:00
Added option for fake KMS to GL driver switching.
This commit is contained in:
parent
276370a1b1
commit
7de9b01ca2
111
raspi-config
111
raspi-config
@ -22,7 +22,7 @@ fi
|
|||||||
is_pione() {
|
is_pione() {
|
||||||
if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then
|
if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then
|
||||||
return 0
|
return 0
|
||||||
elif grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$" /proc/cpuinfo ; then
|
elif grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$" /proc/cpuinfo ; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@ -1151,14 +1151,6 @@ do_onewire() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_gldriver() {
|
|
||||||
if grep -q -E "^dtoverlay=vc4-kms-v3d" $CONFIG; then
|
|
||||||
echo 0
|
|
||||||
else
|
|
||||||
echo 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
do_gldriver() {
|
do_gldriver() {
|
||||||
if is_pione || is_pizero; then
|
if is_pione || is_pizero; then
|
||||||
whiptail --msgbox "GL driver cannot be used on Pi 1 or Pi 0" 20 60 2
|
whiptail --msgbox "GL driver cannot be used on Pi 1 or Pi 0" 20 60 2
|
||||||
@ -1172,29 +1164,69 @@ do_gldriver() {
|
|||||||
whiptail --msgbox "libgl1-mesa-dri not found - please install" 20 60 2
|
whiptail --msgbox "libgl1-mesa-dri not found - please install" 20 60 2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
GLOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "GL Driver" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \
|
||||||
DEFAULT=--defaultno
|
"G1 GL (Full KMS)" "OpenGL desktop driver with full KMS" \
|
||||||
CURRENT=0
|
"G2 GL (Fake KMS)" "OpenGL desktop driver with fake KMS" \
|
||||||
if [ $(get_gldriver) -eq 0 ]; then
|
"G3 Legacy" "Original non-GL desktop driver" \
|
||||||
DEFAULT=
|
3>&1 1>&2 2>&3)
|
||||||
CURRENT=1
|
if [ $? -eq 0 ]; then
|
||||||
fi
|
case "$GLOPT" in
|
||||||
if [ "$INTERACTIVE" = True ]; then
|
G1*)
|
||||||
whiptail --yesno "Would you like the experimental GL driver for desktop to be enabled?" $DEFAULT 20 60 2
|
if ! grep -q -E "^dtoverlay=vc4-kms-v3d" $CONFIG; then
|
||||||
RET=$?
|
ASK_TO_REBOOT=1
|
||||||
|
fi
|
||||||
|
sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/"
|
||||||
|
sed $CONFIG -i -e "s/^#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/"
|
||||||
|
if ! grep -q -E "^dtoverlay=vc4-kms-v3d" $CONFIG; then
|
||||||
|
printf "dtoverlay=vc4-kms-v3d\n" >> $CONFIG
|
||||||
|
fi
|
||||||
|
STATUS="The full KMS GL driver is enabled."
|
||||||
|
;;
|
||||||
|
G2*)
|
||||||
|
if ! grep -q -E "^dtoverlay=vc4-fkms-v3d" $CONFIG; then
|
||||||
|
ASK_TO_REBOOT=1
|
||||||
|
fi
|
||||||
|
sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/"
|
||||||
|
sed $CONFIG -i -e "s/^#dtoverlay=vc4-fkms-v3d/dtoverlay=vc4-fkms-v3d/"
|
||||||
|
if ! grep -q -E "^dtoverlay=vc4-fkms-v3d" $CONFIG; then
|
||||||
|
printf "dtoverlay=vc4-fkms-v3d\n" >> $CONFIG
|
||||||
|
fi
|
||||||
|
STATUS="The fake KMS GL driver is enabled."
|
||||||
|
;;
|
||||||
|
G3*)
|
||||||
|
if grep -q -E "^dtoverlay=vc4-f?kms-v3d" $CONFIG; then
|
||||||
|
ASK_TO_REBOOT=1
|
||||||
|
fi
|
||||||
|
sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/"
|
||||||
|
sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/"
|
||||||
|
STATUS="The GL driver is disabled."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
else
|
else
|
||||||
RET=$1
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ $RET -eq $CURRENT ]; then
|
if echo "$GLOPT" | grep -q -E "1|2" ; then
|
||||||
ASK_TO_REBOOT=1
|
if grep -q "splash" $CMDLINE ; then
|
||||||
fi
|
sed -i $CMDLINE -e "s/ quiet//"
|
||||||
if [ $RET -eq 0 ]; then # enable driver
|
sed -i $CMDLINE -e "s/ splash//"
|
||||||
sed $CONFIG -i -e "s/^#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/"
|
sed -i $CMDLINE -e "s/ plymouth.ignore-serial-consoles//"
|
||||||
if ! grep -q -E "^dtoverlay=vc4-kms-v3d" $CONFIG; then
|
fi
|
||||||
printf "dtoverlay=vc4-kms-v3d\n" >> $CONFIG
|
if [ -e /usr/share/X11/xorg.conf.d/99-fbturbo.conf ] ; then
|
||||||
|
mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.~
|
||||||
fi
|
fi
|
||||||
do_boot_splash 1
|
sed $CONFIG -i -e "s/^gpu_mem/#gpu_mem/"
|
||||||
cat << EOF > /etc/xdg/autostart/xcompmgr.desktop
|
else
|
||||||
|
if [ -e /usr/share/X11/xorg.conf.d/99-fbturbo.~ ] ; then
|
||||||
|
mv /usr/share/X11/xorg.conf.d/99-fbturbo.~ /usr/share/X11/xorg.conf.d/99-fbturbo.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if echo "$GLOPT" | grep -q -E "1" ; then
|
||||||
|
if [ ! -e /etc/xdg/autostart/xcompmgr.desktop ] ; then
|
||||||
|
cat << EOF > /etc/xdg/autostart/xcompmgr.desktop
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Type=Application
|
Type=Application
|
||||||
Name=compton
|
Name=compton
|
||||||
@ -1202,24 +1234,17 @@ Comment=Start Compton compositor
|
|||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
Exec=compton --backend glx --unredir-if-possible --glx-swap-method buffer-age --glx-no-stencil --paint-on-overlay --vsync opengl
|
Exec=compton --backend glx --unredir-if-possible --glx-swap-method buffer-age --glx-no-stencil --paint-on-overlay --vsync opengl
|
||||||
EOF
|
EOF
|
||||||
mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf /usr/share/X11/xorg.conf.d/99-fbturbo.~
|
fi
|
||||||
sed $CONFIG -i -e "s/^gpu_mem/#gpu_mem/"
|
|
||||||
if [ ! -e /usr/bin/compton ]; then
|
if [ ! -e /usr/bin/compton ]; then
|
||||||
sudo apt-get -y install compton
|
sudo apt-get -y install compton
|
||||||
fi
|
fi
|
||||||
STATUS=enabled
|
|
||||||
elif [ $RET -eq 1 ]; then # disable driver
|
|
||||||
sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/"
|
|
||||||
rm /etc/xdg/autostart/xcompmgr.desktop
|
|
||||||
mv /usr/share/X11/xorg.conf.d/99-fbturbo.~ /usr/share/X11/xorg.conf.d/99-fbturbo.conf
|
|
||||||
STATUS=disabled
|
|
||||||
else
|
else
|
||||||
return $RET
|
if [ -e /etc/xdg/autostart/xcompmgr.desktop ] ; then
|
||||||
|
rm /etc/xdg/autostart/xcompmgr.desktop
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$INTERACTIVE" = True ]; then
|
whiptail --msgbox "$STATUS" 20 60 1
|
||||||
whiptail --msgbox "The desktop GL driver is $STATUS" 20 60 1
|
}
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
do_update() {
|
do_update() {
|
||||||
apt-get update &&
|
apt-get update &&
|
||||||
|
Loading…
Reference in New Issue
Block a user