30xorg: remove alternative mechanisms for NVIDIA following libglvnd; remove fglrx old driver support

This commit is contained in:
Silvan Calarco 2021-04-25 12:38:33 +02:00
parent d6cbd5326d
commit 9f2d8e237b
2 changed files with 12 additions and 101 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# xorg - xorg plugin for postplug # xorg - xorg plugin for postplug
# Copyright (c) 2004-2017 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (c) 2004-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com> # Copyright (c) 2004-2007 by Davide Madrisan <davide.madrisan@gmail.com>
if [ $UID != 0 ]; then if [ $UID != 0 ]; then
@ -46,30 +46,17 @@ function xorg_section_screen_config() {
mv $XORGCONF.new $XORGCONF mv $XORGCONF.new $XORGCONF
} }
# xorg_set_alternatives() ## xorg_set_alternatives()
# set alternatives and xorg configuration for specific video drivers ## set alternatives and xorg configuration for specific video drivers
function xorg_set_alternatives() { #function xorg_set_alternatives() {
#if [ "$VIDEODRIVER" = "nvidia" ]; then
if [ "$VIDEODRIVER" = "nvidia" ]; then # grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF ||
grep -q '^[^#]*\"AllowGLXWithComposite\"' $XORGCONF || # sed -i -e '/Driver\W*"nvidia"/a\
sed -i -e '/Driver\W*"nvidia"/a\ # Option \"RenderAccel\" \"true\"\
Option \"RenderAccel\" \"true\"\ # Option \"AllowGLXWithComposite\" \"on\"\
Option \"AllowGLXWithComposite\" \"on\"\ # Option \"NoLogo\" \"true\"' $XORGCONF
Option \"NoLogo\" \"true\"' $XORGCONF #fi
# update alternatives for nvidia driver #}
logmsg "$me" "Setting alternatives for nvidia video driver"
/usr/sbin/update-alternatives-set-nvidia
elif [ "$VIDEODRIVER" = "fglrx" -o "$VIDEODRIVER" = "avivo" ]; then
# update alternatives for fglrx driver
logmsg "$me" "Setting alternatives for fglrx video driver"
/usr/sbin/update-alternatives --auto libglx.so || true
[ -x /usr/sbin/update-alternatives-set-fglrx ] && /usr/sbin/update-alternatives-set-fglrx
else
# set default alternatives
logmsg "$me" "Setting alternatives for dri video drivers"
[ -x /sbin/update-alternatives-set-dri ] && /sbin/update-alternatives-set-dri
fi
}
function xorg_d_configure_input() { function xorg_d_configure_input() {
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d) # Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
@ -177,20 +164,6 @@ if [ -e $XORGCONF ]; then
rmmod nouveau rmmod nouveau
rm -f /etc/modprobe.d/postplug-nouveau.conf rm -f /etc/modprobe.d/postplug-nouveau.conf
VIDEODRIVER="nvidia" VIDEODRIVER="nvidia"
elif [ "$VIDEODRIVER" = "fglrx" -a "$RADEON_MODESET" = "1" ]; then
# replace fglrx with radeon
mv $XORGCONF $XORGCONF.postplug.fglrx.save
rmmod fglrx
echo "blacklist fglrx" > /etc/modprobe.d/postplug-radeon.conf
VIDEODRIVER=""
elif [ "$RADEON_MODESET" = "0" ]; then
# replace radeon with fglrx
#mv $XORGCONF $XORGCONF.postplug.radeon.save
rmmod radeon
rm -f /etc/modprobe.d/postplug-radeon.conf
VIDEODRIVER="fglrx"
ATI_DRV=1
CONFCREATED=1
fi fi
fi fi
@ -202,16 +175,6 @@ if [ ! -e $XORGCONF ]; then
# use default xorg.conf for Tegra # use default xorg.conf for Tegra
cp $XORGCONF.tegra $XORGCONF cp $XORGCONF.tegra $XORGCONF
else else
# fix set dri alternatives
xorg_set_alternatives
# ATI fglrx driver test workaround (Xorg -configure crashes with it)
# Note: assuming that fglrx loads if the video card is supported
let "ATI_DRV = 0"
[ "`/sbin/lsmod 2>/dev/null | grep ^fglrx `" ] && let "ATI_DRV = 1"
[ "$ATI_DRV" = "1" ] && VIDEODRIVER=fglrx
# remove any nvidia driver loaded as they don't load according to PCIID # remove any nvidia driver loaded as they don't load according to PCIID
[ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia [ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia
@ -248,52 +211,9 @@ if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then if [ "$nomodeset" = "1" -a "$VIDEODRIVER" = "nouveau" ]; then
sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF sed -i "s|Driver\W*\"nouveau\"|Driver \"nvidia\"|" $XORGCONF
VIDEODRIVER=nvidia VIDEODRIVER=nvidia
xorg_set_alternatives
rmmod nouveau nvidia rmmod nouveau nvidia
fi fi
if [ "$ATI_DRV" = 1 -a ! "$freevideo" ]; then
sed -i -e '/Load\W*\"extmod\"/a\
SubSection "extmod"\
Option "omit xfree86-dga"\
EndSubSection' $XORGCONF
sed -i '/Load\W*\"extmod\"/d' $XORGCONF
sed -i "s|Driver\W*\"vesa\"|Driver \"fglrx\"|" $XORGCONF
sed -i "s|Driver\W*\"ati\"|Driver \"fglrx\"|" $XORGCONF
sed -i "s|Driver\W*\"avivo\"|Driver \"fglrx\"|" $XORGCONF
sed -i "s|Driver\W*\"radeon\"|Driver \"fglrx\"|" $XORGCONF
sed -i "s|Driver\W*\"radeonhd\"|Driver \"fglrx\"|" $XORGCONF
VIDEODRIVER=fglrx
xorg_set_alternatives
fi
# Setting video modes...
# get DCC values detected by xorg and verify that they have reasonable ranges
#HORIZSYNCMIN=(`grep "^# HorizSync.*" $XORGCONF | awk '{ print $3 }'`)
#HORIZSYNCMAX=(`grep "^# HorizSync.*" $XORGCONF | awk '{ print $5 }'`)
#unset reasonable
#for currsync in `seq 0 ${#HORIZSYNCMIN[@]}`; do
# if [ `expr "${HORIZSYNCMIN[$currsync]}" \> 15` = 1 -a \
# `expr "${HORIZSYNCMIN[$currsync]}" \< 100` = 0 -a \
# `expr "${HORIZSYNCMAX[$currsync]}" \> 30` = 1 -a \
# `expr "${HORIZSYNCMAX[$currsync]}" \< 201` = 0 -a \
# `expr "${HORIZSYNCMAX[$currsync]}" \>= "${HORIZSYNCMIN[$currsync]}"` = 1 ]; then
# reasonable=$currsync
# break
# fi
#done
#if [ "$reasonable" ]; then
# sed -i -e "/Section\W*\"Monitor\"/a\
# HorizSync ${HORIZSYNCMIN[$reasonable]}-${HORIZSYNCMAX[$reasonable]}" \
# $XORGCONF
#else
case "$VIDEODRIVER" in case "$VIDEODRIVER" in
vesa|vga) sed -i -e '/Section "Screen"/a\ vesa|vga) sed -i -e '/Section "Screen"/a\
#DefaultColorDepth 24' $XORGCONF ;; #DefaultColorDepth 24' $XORGCONF ;;
@ -381,8 +301,6 @@ if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
# echo "$XORGCONF" > $postplugnew_file # echo "$XORGCONF" > $postplugnew_file
xorg_set_alternatives
# Final probe # Final probe
[ -f /var/log/Xorg.5.log ] && rm -f /var/log/Xorg.5.log [ -f /var/log/Xorg.5.log ] && rm -f /var/log/Xorg.5.log
@ -527,9 +445,6 @@ fi
# add missing brackets to Xorg.conf device entries # add missing brackets to Xorg.conf device entries
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
# set alternative configuration for different video drivers
xorg_set_alternatives
# Configure Mice... # Configure Mice...
# remove wrong configuration for USBMouse (duplicating PS2MOUSE) # remove wrong configuration for USBMouse (duplicating PS2MOUSE)

View File

@ -1,4 +0,0 @@
#!/bin/bash
# Set DRI alternatives for Mesa/Xorg
update-alternatives --set libglx.so @LIBDIR@/xorg/glx-dri/libglx.so
update-alternatives --set libGL.so.1 @LIBDIR@/mesa/libGL.so.1.2