Files
sablink-distro/sys-apps/gpu-detector/files/gpu-configuration
T
lxnay a84f39245e revert change
git-svn-id: http://svn.sabayonlinux.org/overlay@276 d7aec97c-591d-0410-af39-a8856400b30a
2006-11-10 09:45:29 +00:00

264 lines
8.1 KiB
Bash
Executable File

#!/bin/sh
XORGFILE="/etc/X11/xorg.conf"
remove_proprietary_opengl() {
# Fix for DRI accel
mount -t tmpfs none /usr/lib/opengl/ati &> /dev/null
mount -t tmpfs none /usr/lib/opengl/nvidia &> /dev/null
# FIX For fscking ATI env.d file
rm -f /etc/env.d/*ati &> /dev/null
sed -i '/LIBGL_DRIVERS_PATH s/.*//' /etc/profile.env
nice -20 source /etc/profile &> /dev/null
nice -20 eselect opengl set --dst-prefix=/etc/opengl xorg-x11
}
NEOMAGIC=$(lspci | grep ' VGA ' | grep -i 'neomagic')
MACH64=$(lspci | grep ' VGA ' | grep -i 'mach64' )
SAVAGE=$(lspci | grep ' VGA ' | grep -i 'savage' )
VIRGE=$(lspci | grep ' VGA ' | grep -i 'Virge' )
CYRIX=$(lspci | grep ' VGA ' | grep -i 'cyrix' )
I128=$(lspci | grep ' VGA ' | grep -i 'i128' )
I740=$(lspci | grep ' VGA ' | grep -iE ' intel.*74' )
RENDITION=$(lspci | grep ' VGA ' | grep -i 'rendition' )
SILICONMOTION=$(lspci | grep ' VGA ' | grep -iE ' silicon.*motion' )
TSENG=$(lspci | grep ' VGA ' | grep -i 'tseng')
IGRANTSDALE=$(lspci | grep ' VGA ' | grep -i "Intel Corp.*915.*")
INTEL=$(lspci | grep ' VGA ' | grep -i "Intel Corp.*")
I845=$(lspci | grep ' VGA ' | grep -i "Intel Corp.*845.*")
I855=$(lspci | grep ' VGA ' | grep -i "Intel Corp.*855.*")
V3DFX=$(lspci | grep ' VGA ' | grep -i "3Dfx Interactive" )
I915=$(lspci | grep ' VGA ' | grep -i "Intel Corp.*915.*")
I945=$(lspci | grep ' VGA ' |grep -i "Intel Corp.*945.*" || lspci | grep ' VGA ' | grep -i "Intel Corp.*940.*" )
TRIDENT=$(lspci | grep ' VGA ' | grep Trident)
NVIDIA=$(lspci | grep ' VGA ' | grep -i "nVidia")
NVIDIATNT=$(lspci | grep ' VGA ' | grep -i "RIVA TNT")
ATI=$(lspci | grep ' VGA ' | grep ATI)
R7000=$(lspci | grep ' VGA ' | grep R100 || lspci | grep ' VGA ' | grep RV100 )
R7200=$(lspci | grep ' VGA ' | grep -i "Radeon R100")
R7500=$(lspci | grep ' VGA ' | grep -i "Radeon RV200")
R2XX=$(lspci | grep ' VGA ' | grep -i "ATi Tech" |grep -i "RV2.*" || lspci | grep ' VGA ' | grep -i "ATi Tech" |grep -i "R2.*")
RX700=$(lspci | grep ' VGA ' | grep -i "Radeon Mobility X700")
R9600=$(lspci | grep ' VGA ' | grep -i 'ATI Technologies .* RV350' )
# Fix For R9200 BusType "PCI"
R9200=$(lspci | grep ' VGA ' | grep "Radeon 9200")
RAGE128=$(lspci | grep ' VGA ' | grep -i "Rage 128")
SIS=$(lspci | grep ' VGA ' | grep -i "SiS")
VMWARE=$(lspci | grep ' VGA ' | grep VMWare || lspci | grep ' VGA ' | grep VMware )
VIRGE=$(lspci | grep ' VGA ' | grep -i "S3.*virge")
VIA=$(lspci | grep ' VGA ' | grep -i "VIA Tech.*")
MATROX=$(lspci | grep ' VGA ' | grep -i Matrox)
CIRRUS=$(lspci | grep ' VGA ' | grep -i Cirrus)
NOPROP=$(cat /proc/cmdline | grep "noproprietary")
LEGACY=$(cat /proc/cmdline | grep "legacy")
if [ -z "$ATI" ]; then
# FIX For fscking ATI env.d file
rm -f /etc/env.d/*ati &> /dev/null
env-update && source /etc/profile &> /dev/null
fi
# Video cards specific fixes
if [ -n "$R9200" ]; then
sed -i '/BusType/ s/#//' /etc/X11/xorg.conf
fi
AIGLX=$(cat /proc/cmdline | grep aiglx)
if [ -n "$AIGLX" ]; then
if [ -n "$INTEL" ]; then
sed -i '/"XAANoOffscreenPixmaps"/ s/#//' $XORGFILE
sed -i '/"AddARGBGLXVisuals"/ s/.*//' $XORGFILE
fi
fi
# Check for xdriver=
is_there_xdriver=$(cat /proc/cmdline | grep "xdriver=")
if [ -n "$is_there_xdriver" ]; then
for word in `cat /proc/cmdline`; do
case $word in
xdriver=*)
xdriver=$(echo $word | cut -d= -f 2)
sed -i '/do not remove vesa/ s/".*"/"'$xdriver'"/' $XORGFILE
if [ -z "$NVIDIA" ]; then
if [ -n "$R7000" ] || [ -n "$R7200" ] || [ -z "$R7500" ] || [ -n "$R2XX" ] || [ -n "$INTEL" ] || [ -n "$VIA" ] || [ -n "$SIS" ] || [ -n "$MATROX" ]; then
remove_proprietary_opengl
fi
sed -i '/"dri"/ s/#//' $XORGFILE
fi
;;
esac
done
exit 0
fi
if [ -n "$NVIDIA" ]; then
if [ -n "$NOPROP" ] || [ -n "$LEGACY" ] || [ -n "$NVIDIATNT" ]; then
sed -i '/do not remove vesa/ s/".*"/"nv"/' $XORGFILE
echo -e "\t Display Driver: NVIDIA (OpenSource)"
else
modprobe nvidia &> /dev/null
lsmod_nvidia=$(lsmod | grep nvidia)
if [ -n "$lsmod_nvidia" ];then
sed -i '/do not remove vesa/ s/".*"/"nvidia"/' $XORGFILE
echo -e "\t Display Driver: NVIDIA (Proprietary)"
else
sed -i '/do not remove vesa/ s/".*"/"nv"/' $XORGFILE
echo -e "\t Display Driver: NVIDIA (OpenSource) - Proprietary drivers can't be loaded"
fi
fi
elif [ -n "$RAGE128" ]; then
sed -i '/do not remove vesa/ s/".*"/"r128"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
echo -e "\t Display Driver: ATI Rage 128"
elif [ -n "$V3DFX" ]; then
sed -i '/do not remove vesa/ s/".*"/"tdfx"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
sed -i '/DefaultDepth/ s/24/16/' $XORGFILE
remove_proprietary_opengl
echo -e "\t Display Driver: 3Dfx Video Card"
elif [ -n "$I855" ] || [ -n "$I915" ] || [ -n "$I945" ] || [ -n "$I845" ] || [ -n "$IGRANTSDALE" ]; then
sed -i '/do not remove vesa/ s/".*"/"i810"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
# Fix for DRI accel
remove_proprietary_opengl
echo -e "\t Display Driver: Intel Video Card"
elif [ -n "$ATI" ] || [ -n "$RX700" ] || [ -n "$R9600" ]; then
if [ -n "$NOPROP" ] || [ -n "$LEGACY" ]; then
sed -i '/do not remove vesa/ s/".*"/"radeon"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
sed -i '/ColorTiling/ s/#//' /etc/X11/xorg.conf
sed -i '/EnablePageFlip/ s/#//' /etc/X11/xorg.conf
remove_proprietary_opengl
echo -e "\t Display Driver: ATI (OpenSource)"
else
if [ -z "$R7000" ] && [ -z "$R7200" ] && [ -z "$R7500" ] && [ -z "$R2XX" ]; then
modprobe fglrx &> /dev/null
lsmod_ati=$(lsmod | grep fglrx)
if [ -n "$lsmod_ati" ];then
sed -i '/do not remove vesa/ s/".*"/"fglrx"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
echo -e "\t Display Driver: ATI (Proprietary)"
else
remove_proprietary_opengl
sed -i '/do not remove vesa/ s/".*"/"radeon"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
sed -i '/ColorTiling/ s/#//' /etc/X11/xorg.conf
sed -i '/EnablePageFlip/ s/#//' /etc/X11/xorg.conf
echo -e "\t Display Driver: ATI (OpenSource) - Proprietary drivers can't be loaded"
fi
else
remove_proprietary_opengl
sed -i '/do not remove vesa/ s/".*"/"radeon"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
echo -e "\t Display Driver: ATI (OpenSource)"
fi
fi
elif [ -n "$SIS" ]; then
sed -i '/do not remove vesa/ s/".*"/"sis"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
echo -e "\t Display Driver: SiS"
elif [ -n "$VMWARE" ]; then
sed -i '/do not remove vesa/ s/".*"/"vmware"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
# Uncomment "Modes"
sed -i '/Modes/ s/#//g' /etc/X11/xorg.conf
sed -i '/HorizSync/ s/#//g' /etc/X11/xorg.conf
sed -i '/VertRefresh/ s/#//g' /etc/X11/xorg.conf
echo -e "\t Display Driver: VMWARE"
elif [ -n "$SAVAGE" ]; then
echo -e "\t Display Driver: Savage"
sed -i '/do not remove vesa/ s/".*"/"savage"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
elif [ -n "$VIRGE" ]; then
echo -e "\t Display Driver: S3 Virge"
sed -i '/do not remove vesa/ s/".*"/"s3virge"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
elif [ -n "$MATROX" ]; then
sed -i '/do not remove vesa/ s/".*"/"mga"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
echo -e "\t Display Driver: MATROX"
elif [ -n "$VIA" ]; then
sed -i '/do not remove vesa/ s/".*"/"via"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
remove_proprietary_opengl
echo -e "\t Display Driver: VIA Technologies"
elif [ -n "$CIRRUS" ]; then
sed -i '/do not remove vesa/ s/".*"/"cirrus"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
echo -e "\t Display Driver: Cirrus Logic"
elif [ -n "$TRIDENT" ]; then
sed -i '/do not remove vesa/ s/".*"/"trident"/' $XORGFILE
sed -i '/"dri"/ s/#//' $XORGFILE
echo -e "\t Display Driver: Cirrus Logic"
else
# PUT YOUR HERE
# sed -e '/do not remove vesa/ s/".*"/"mga"/' $XORGFILE > $XORGNEWFILE
# cp $XORGFILE "$XORGFILE".old
# mv $XORGNEWFILE $XORGFILE -f
echo -e "\t Display Driver: VESA (no supported card detected)"
fi