From a75aae653e00acc5d997cfcdd760177e03d71400 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 30 Sep 2014 01:55:06 +0200 Subject: [PATCH] xorg: fixes for setting alternatives when switching from/to proprietary video drivers --- postplug.d/30xorg | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/postplug.d/30xorg b/postplug.d/30xorg index 9e6c476..2043690 100644 --- a/postplug.d/30xorg +++ b/postplug.d/30xorg @@ -56,15 +56,17 @@ if [ "$VIDEODRIVER" = "nvidia" ]; then Option \"RenderAccel\" \"true\"\ Option \"AllowGLXWithComposite\" \"on\"\ Option \"NoLogo\" \"true\"' $XORGCONF - - # detect and update alternatives for nvidia driver - nvidia-autoselect-driver + # 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 /usr/sbin/update-alternatives-set-dri ] && /usr/sbin/update-alternatives-set-dri fi } @@ -161,27 +163,32 @@ if [ -e $XORGCONF ]; then [ -e /sys/module/nouveau/parameters/modeset ] && NOUVEAU_MODESET=`cat /sys/module/nouveau/parameters/modeset` [ "$NOUVEAU_MODESET" = "-1" ] && NOUVEAU_MODESET=1 [ -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 # replace nvidia with nouveau mv $XORGCONF $XORGCONF.postplug.nvidia.save rmmod nvidia echo "blacklist nvidia" > /etc/modprobe.d/postplug-nouveau.conf + VIDEODRIVER="" elif [ "$VIDEODRIVER" = "nouveau" -a "$NOUVEAU_MODESET" != "1" ]; then # replace nouveau with nvidia mv $XORGCONF $XORGCONF.postplug.nouveau.save rmmod nouveau rm -f /etc/modprobe.d/postplug-nouveau.conf + 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 [ "$VIDEODRIVER" = "radeon" -a "$RADEON_MODESET" != "1" ]; then # replace radeon with fglrx mv $XORGCONF $XORGCONF.postplug.radeon.save rmmod radeon rm -f /etc/modprobe.d/postplug-radeon.conf + VIDEODRIVER="fglrx" fi fi @@ -201,12 +208,12 @@ if [ ! -e $XORGCONF ]; then let "ATI_DRV = 0" [ "`/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 [ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia - # detect and configure nvidia driver - [ "$freevideo" ] || nvidia-autoselect-driver + ## detect and configure nvidia driver + #[ "$freevideo" ] || nvidia-autoselect-driver # sync to avoid filesystem corruption in case of system hang on probe sync