xorg: modify to detect Nvidia Tegra and create Xorg.conf by Xorg.conf.tegra template provided with driver

This commit is contained in:
Silvan Calarco 2012-02-28 19:25:33 +01:00
parent f0dbdca8a8
commit f365eb6f03

View File

@ -165,7 +165,11 @@ rm -fr /tmp/.ICE-unix
install -m 1777 -o root -g root -d /tmp/.ICE-unix install -m 1777 -o root -g root -d /tmp/.ICE-unix
# video hardware change detection # video hardware change detection
VIDEO_DEV="`lspci -n | grep " 03[0-9][0-9]: "`" if [ -e /dev/nvhost-ctrl ]; then
VIDEO_DEV="NVIDIA TEGRA"
else
VIDEO_DEV="`lspci -n | grep " 03[0-9][0-9]: "`"
fi
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
VIDEO_DEV_CACHED="`cat $postpluglibdir/xorg.cache`" VIDEO_DEV_CACHED="`cat $postpluglibdir/xorg.cache`"
@ -195,36 +199,40 @@ if [ ! -e $XORGCONF ]; then
# #
# Create a new Xorg configuration file # Create a new Xorg configuration file
# #
if [ -e /dev/nvhost-ctrl -a -e $XORGCONF.tegra ]; then
# use default xorg.conf for Tegra
cp $XORGCONF.tegra $XORGCONF
else
# fix set dri alternatives
xorg_set_alternatives
# fix set dri alternatives # ATI fglrx driver test workaround (Xorg -configure crashes with it)
xorg_set_alternatives # 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 fglrx driver test workaround (Xorg -configure crashes with it) [ "$ATI_DRV" = "1" ] && VIDEODRIVER=ati
# 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=ati # 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
# remove any nvidia driver loaded as they don't load according to PCIID # sync to avoid filesystem corruption in case of system hang on probe
[ "`/sbin/lsmod 2>/dev/null | grep ^nvidia `" ] && rmmod nvidia sync
# detect and configure nvidia driver
[ "$freevideo" ] || nvidia-autoselect-driver
# sync to avoid filesystem corruption in case of system hang on probe HOME=/tmp Xorg :5 -configure 2>>$logfile || {
sync logmsg "$me" "warning: xorg autoprobed configuration failed; enabling experimental xorg autoconfig"
xorg_configure_loginmanager
xorg_d_configure_input
exit 1
}
HOME=/tmp Xorg :5 -configure 2>>$logfile || { mv /tmp/xorg.conf.new $XORGCONF
logmsg "$me" "warning: xorg autoprobed configuration failed; enabling experimental xorg autoconfig" sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
xorg_configure_loginmanager fi
xorg_d_configure_input
exit 1
}
mv /tmp/xorg.conf.new $XORGCONF
let "CONFCREATED = 1" let "CONFCREATED = 1"
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
fi fi
DISPLAYSIZE="`sed -n "/Section[ \t]\"Monitor\"/,/EndSection/{s/[ \t]*DisplaySize[ \t]*\(.*\)/\1/p}" $XORGCONF`" DISPLAYSIZE="`sed -n "/Section[ \t]\"Monitor\"/,/EndSection/{s/[ \t]*DisplaySize[ \t]*\(.*\)/\1/p}" $XORGCONF`"