xorg: fixes for setting alternatives when switching from/to proprietary video drivers

This commit is contained in:
Silvan Calarco 2014-09-30 01:55:06 +02:00
parent 2c2900db7d
commit a75aae653e

View File

@ -56,15 +56,17 @@ if [ "$VIDEODRIVER" = "nvidia" ]; then
Option \"RenderAccel\" \"true\"\ Option \"RenderAccel\" \"true\"\
Option \"AllowGLXWithComposite\" \"on\"\ Option \"AllowGLXWithComposite\" \"on\"\
Option \"NoLogo\" \"true\"' $XORGCONF Option \"NoLogo\" \"true\"' $XORGCONF
# update alternatives for nvidia driver
# detect and update alternatives for nvidia driver logmsg "$me" "Setting alternatives for nvidia video driver"
nvidia-autoselect-driver /usr/sbin/update-alternatives-set-nvidia
elif [ "$VIDEODRIVER" = "fglrx" -o "$VIDEODRIVER" = "avivo" ]; then elif [ "$VIDEODRIVER" = "fglrx" -o "$VIDEODRIVER" = "avivo" ]; then
# update alternatives for fglrx driver # update alternatives for fglrx driver
logmsg "$me" "Setting alternatives for fglrx video driver"
/usr/sbin/update-alternatives --auto libglx.so || true /usr/sbin/update-alternatives --auto libglx.so || true
[ -x /usr/sbin/update-alternatives-set-fglrx ] && /usr/sbin/update-alternatives-set-fglrx [ -x /usr/sbin/update-alternatives-set-fglrx ] && /usr/sbin/update-alternatives-set-fglrx
else else
# set default alternatives # set default alternatives
logmsg "$me" "Setting alternatives for dri video drivers"
[ -x /usr/sbin/update-alternatives-set-dri ] && /usr/sbin/update-alternatives-set-dri [ -x /usr/sbin/update-alternatives-set-dri ] && /usr/sbin/update-alternatives-set-dri
fi fi
} }
@ -161,27 +163,32 @@ if [ -e $XORGCONF ]; then
[ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset` [ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset`
[ "$NOUVEAU_MODESET" = "-1" ] && NOUVEAU_MODESET=1 [ "$NOUVEAU_MODESET" = "-1" ] && NOUVEAU_MODESET=1
[ -e /sys/module/radeon/parameters/modeset ] && RADEON_MODESET=`cat /sys/module/radeon/parameters/modeset` [ -e /sys/module/radeon/parameters/modeset ] && RADEON_MODESET=`cat /sys/module/radeon/parameters/modeset`
[ "$RADEON_MODESET" = "-1" ] && NOUVEAU_MODESET=1
if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then if [ "$VIDEODRIVER" = "nvidia" -a "$NOUVEAU_MODESET" = "1" ]; then
# replace nvidia with nouveau # replace nvidia with nouveau
mv $XORGCONF $XORGCONF.postplug.nvidia.save mv $XORGCONF $XORGCONF.postplug.nvidia.save
rmmod nvidia rmmod nvidia
echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf
VIDEODRIVER=""
elif [ "$VIDEODRIVER" = "nouveau" -a "$NOUVEAU_MODESET" != "1" ]; then elif [ "$VIDEODRIVER" = "nouveau" -a "$NOUVEAU_MODESET" != "1" ]; then
# replace nouveau with nvidia # replace nouveau with nvidia
mv $XORGCONF $XORGCONF.postplug.nouveau.save mv $XORGCONF $XORGCONF.postplug.nouveau.save
rmmod nouveau rmmod nouveau
rm -f /etc/modprobe.d/postplug-nouveau.conf rm -f /etc/modprobe.d/postplug-nouveau.conf
VIDEODRIVER="nvidia"
elif [ "$VIDEODRIVER" = "fglrx" -a "$RADEON_MODESET" = "1" ]; then elif [ "$VIDEODRIVER" = "fglrx" -a "$RADEON_MODESET" = "1" ]; then
# replace fglrx with radeon # replace fglrx with radeon
mv $XORGCONF $XORGCONF.postplug.fglrx.save mv $XORGCONF $XORGCONF.postplug.fglrx.save
rmmod fglrx rmmod fglrx
echo "blacklist fglrx" > /etc/modprobe.d/postplug-radeon.conf echo "blacklist fglrx" > /etc/modprobe.d/postplug-radeon.conf
VIDEODRIVER=""
elif [ "$VIDEODRIVER" = "radeon" -a "$RADEON_MODESET" != "1" ]; then elif [ "$VIDEODRIVER" = "radeon" -a "$RADEON_MODESET" != "1" ]; then
# replace radeon with fglrx # replace radeon with fglrx
mv $XORGCONF $XORGCONF.postplug.radeon.save mv $XORGCONF $XORGCONF.postplug.radeon.save
rmmod radeon rmmod radeon
rm -f /etc/modprobe.d/postplug-radeon.conf rm -f /etc/modprobe.d/postplug-radeon.conf
VIDEODRIVER="fglrx"
fi fi
fi fi
@ -201,12 +208,12 @@ if [ ! -e $XORGCONF ]; then
let "ATI_DRV = 0" let "ATI_DRV = 0"
[ "`/sbin/lsmod 2>/dev/null | grep ^fglrx `" ] && let "ATI_DRV = 1" [ "`/sbin/lsmod 2>/dev/null | grep ^fglrx `" ] && let "ATI_DRV = 1"
[ "$ATI_DRV" = "1" ] && VIDEODRIVER=ati [ "$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
# detect and configure nvidia driver ## detect and configure nvidia driver
[ "$freevideo" ] || nvidia-autoselect-driver #[ "$freevideo" ] || nvidia-autoselect-driver
# sync to avoid filesystem corruption in case of system hang on probe # sync to avoid filesystem corruption in case of system hang on probe
sync sync