xorg: remove obsoleted code and rework caching for autoprobed devices to speed up boot

This commit is contained in:
Silvan Calarco 2013-09-18 02:01:19 +02:00
parent 95b7da8f5b
commit 7a526dab3a

View File

@ -18,8 +18,6 @@ me="xorg"
XORGCONF=/etc/X11/xorg.conf
kernel_min=$(uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,')
# xorg_section_screen_config()
# write a new xorg configuration
# args:
@ -71,26 +69,6 @@ else
fi
}
# xorg_configure_loginmanager()
# configure inittab for runlelve 5 init and kdm as loginmanager
function xorg_configure_loginmanager() {
# login_manager configuration
[ ! "`grep "^x:5:" /etc/inittab`" ] && {
cat >> /etc/inittab << _EOF
# run graphical login manager
x:5:respawn:login_manager
_EOF
# configure kdm as the default login_manager if none is set
/usr/sbin/alternatives --display login_manager >/dev/null ||
/usr/sbin/alternatives --install /usr/sbin/login_manager login_manager /opt/kde/bin/kdm 20
telinit q
}
}
function xorg_d_configure_input() {
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
[ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \
@ -169,6 +147,7 @@ if [ -e /dev/nvhost-ctrl ]; then
VIDEO_DEV="NVIDIA TEGRA"
else
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
[ "$VIDEO_DEV" ] || VIDEO_DEV="embedded-unknown"
fi
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
@ -242,11 +221,7 @@ if [ ! -e $XORGCONF ]; then
RET=$?
if [ $RET -ne 0 -o ! -e /tmp/xorg.conf.new ]; then
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
VIDEO_DEV="autoprobe"
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
xorg_configure_loginmanager
xorg_d_configure_input
exit 1
else
mv /tmp/xorg.conf.new $XORGCONF
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
@ -255,16 +230,12 @@ if [ ! -e $XORGCONF ]; then
fi
fi
let "CONFCREATED = 1"
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
# assume first driver as default videodriver
VIDEODRIVER=${VIDEODRIVERS[0]}
fi
DISPLAYSIZE="`sed -n "/Section[ \t]\"Monitor\"/,/EndSection/{s/[ \t]*DisplaySize[ \t]*\(.*\)/\1/p}" $XORGCONF`"
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
# assume first driver as default videodriver
VIDEODRIVER=${VIDEODRIVERS[0]}
if [ "$CONFCREATED" = "1" ]; then
if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
@ -316,10 +287,6 @@ if [ "$CONFCREATED" = "1" ]; then
# HorizSync ${HORIZSYNCMIN[$reasonable]}-${HORIZSYNCMAX[$reasonable]}" \
# $XORGCONF
#else
#if [ ! "$DISPLAYSIZE" ]; then
# sed -i -e '/Section\W*"Monitor"/a\
# DisplaySize 320 240' $XORGCONF
#fi
case "$VIDEODRIVER" in
vesa|vga) sed -i -e '/Section "Screen"/a\
@ -481,6 +448,9 @@ warning: DDC hsync range cannot be detected, setting default of 30-49 kHz"
fi
fi
[ "$VIDEO_DEV" -a "$VIDEO_DEV" != "$VIDEO_DEV_CACHED" ] &&
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
####################################
#
# Xorg dynamic configuration section
@ -492,13 +462,7 @@ if [ -e /sys/class/drm/card0/device/power_profile ]; then
echo mid > /sys/class/drm/card0/device/power_profile
fi
[ -e $XORGCONF ] || {
logmsg "$me" "error: "$"missing Xorg configuration file; aborting"
exit 1
}
# configure inittab for login manager
xorg_configure_loginmanager
[ -e $XORGCONF -a "$VIDEODRIVER" ] || exit 0
# add missing brackets to Xorg.conf device entries
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
@ -549,7 +513,4 @@ sed -i "s|^\([[:space:]]*InputDevice\W*\"Keyboard0\".*\)|#\1|" $XORGCONF
# FIXME: delete empty lines
sed -i '/./,$!d' $XORGCONF
[ "$CONFCREATED" = "1" -o ! -e $postpluglibdir/xorg.cache ] && \
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
exit 0