xorg: remove obsoleted code and rework caching for autoprobed devices to speed up boot
This commit is contained in:
parent
95b7da8f5b
commit
7a526dab3a
@ -18,8 +18,6 @@ me="xorg"
|
|||||||
|
|
||||||
XORGCONF=/etc/X11/xorg.conf
|
XORGCONF=/etc/X11/xorg.conf
|
||||||
|
|
||||||
kernel_min=$(uname -r | sed -e 's,[^\.]*\.,,' -e 's,\..*,,')
|
|
||||||
|
|
||||||
# xorg_section_screen_config()
|
# xorg_section_screen_config()
|
||||||
# write a new xorg configuration
|
# write a new xorg configuration
|
||||||
# args:
|
# args:
|
||||||
@ -71,26 +69,6 @@ else
|
|||||||
fi
|
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() {
|
function xorg_d_configure_input() {
|
||||||
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
|
# Keyboard configuration (Xorg >= 1.8 uses /etc/X11/xorg.conf.d)
|
||||||
[ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \
|
[ ! -e /etc/X11/xorg.conf.d/10-keyboard.conf -o \
|
||||||
@ -169,6 +147,7 @@ if [ -e /dev/nvhost-ctrl ]; then
|
|||||||
VIDEO_DEV="NVIDIA TEGRA"
|
VIDEO_DEV="NVIDIA TEGRA"
|
||||||
else
|
else
|
||||||
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
|
VIDEO_DEV="`lspci -n 2>/dev/null | grep " 03[0-9][0-9]: "`"
|
||||||
|
[ "$VIDEO_DEV" ] || VIDEO_DEV="embedded-unknown"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
|
if [ -e $XORGCONF -a -e $postpluglibdir/xorg.cache ]; then
|
||||||
@ -242,11 +221,7 @@ if [ ! -e $XORGCONF ]; then
|
|||||||
RET=$?
|
RET=$?
|
||||||
if [ $RET -ne 0 -o ! -e /tmp/xorg.conf.new ]; then
|
if [ $RET -ne 0 -o ! -e /tmp/xorg.conf.new ]; then
|
||||||
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
|
logmsg "$me" "warning: xorg autoprobed configuration failed; using xorg autoconfig"
|
||||||
VIDEO_DEV="autoprobe"
|
|
||||||
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
|
echo "# Dummy empty xorg.conf file created by postplug" > $XORGCONF
|
||||||
xorg_configure_loginmanager
|
|
||||||
xorg_d_configure_input
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
mv /tmp/xorg.conf.new $XORGCONF
|
mv /tmp/xorg.conf.new $XORGCONF
|
||||||
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
|
sed -i "s|#DisplaySize|DisplaySize|" $XORGCONF
|
||||||
@ -255,16 +230,12 @@ if [ ! -e $XORGCONF ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
let "CONFCREATED = 1"
|
let "CONFCREATED = 1"
|
||||||
|
|
||||||
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`)
|
VIDEODRIVERS=(`sed -n "/Section[ \t]\"Device\"/,/EndSection/{s/^[ \t]*Driver[ \t]*\"\(.*\)\"/\1/p}" $XORGCONF`)
|
||||||
|
|
||||||
# assume first driver as default videodriver
|
# assume first driver as default videodriver
|
||||||
VIDEODRIVER=${VIDEODRIVERS[0]}
|
VIDEODRIVER=${VIDEODRIVERS[0]}
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$CONFCREATED" = "1" ]; then
|
if [ "$CONFCREATED" = "1" -a "$VIDEODRIVER" ]; then
|
||||||
|
|
||||||
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
|
[ "`grep nomodeset /proc/cmdline`" ] && nomodeset=1
|
||||||
|
|
||||||
@ -316,10 +287,6 @@ if [ "$CONFCREATED" = "1" ]; then
|
|||||||
# HorizSync ${HORIZSYNCMIN[$reasonable]}-${HORIZSYNCMAX[$reasonable]}" \
|
# HorizSync ${HORIZSYNCMIN[$reasonable]}-${HORIZSYNCMAX[$reasonable]}" \
|
||||||
# $XORGCONF
|
# $XORGCONF
|
||||||
#else
|
#else
|
||||||
#if [ ! "$DISPLAYSIZE" ]; then
|
|
||||||
# sed -i -e '/Section\W*"Monitor"/a\
|
|
||||||
# DisplaySize 320 240' $XORGCONF
|
|
||||||
#fi
|
|
||||||
|
|
||||||
case "$VIDEODRIVER" in
|
case "$VIDEODRIVER" in
|
||||||
vesa|vga) sed -i -e '/Section "Screen"/a\
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ "$VIDEO_DEV" -a "$VIDEO_DEV" != "$VIDEO_DEV_CACHED" ] &&
|
||||||
|
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
#
|
#
|
||||||
# Xorg dynamic configuration section
|
# 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
|
echo mid > /sys/class/drm/card0/device/power_profile
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -e $XORGCONF ] || {
|
[ -e $XORGCONF -a "$VIDEODRIVER" ] || exit 0
|
||||||
logmsg "$me" "error: "$"missing Xorg configuration file; aborting"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# configure inittab for login manager
|
|
||||||
xorg_configure_loginmanager
|
|
||||||
|
|
||||||
# add missing brackets to Xorg.conf device entries
|
# add missing brackets to Xorg.conf device entries
|
||||||
sed -i "s|^[ \t]*Driver[ \t]*\([A-Za-z0-9]*\)[ \t]*$| Driver \"\1\"|g" $XORGCONF
|
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
|
# FIXME: delete empty lines
|
||||||
sed -i '/./,$!d' $XORGCONF
|
sed -i '/./,$!d' $XORGCONF
|
||||||
|
|
||||||
[ "$CONFCREATED" = "1" -o ! -e $postpluglibdir/xorg.cache ] && \
|
|
||||||
echo "$VIDEO_DEV" > $postpluglibdir/xorg.cache
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
Loading…
Reference in New Issue
Block a user