From 0fc1ca126d21fbecf212fe52e380ad426f8389d4 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Thu, 24 Feb 2011 23:07:38 +0100 Subject: [PATCH] xorg-server: simplyfing Xorg start by start via udev Signed-off-by: Stephan Raue --- .../x11/xserver/xorg-server/init.d/71_xorg | 50 ----------- packages/x11/xserver/xorg-server/install | 3 + .../xorg-server/profile.d/display.conf | 57 ------------ .../xserver/xorg-server/scripts/xorg_start | 90 +++++++++++++++++++ .../xserver/xorg-server/udev.d/97-xorg.rules | 30 +++++++ 5 files changed, 123 insertions(+), 107 deletions(-) delete mode 100644 packages/x11/xserver/xorg-server/init.d/71_xorg create mode 100755 packages/x11/xserver/xorg-server/scripts/xorg_start create mode 100644 packages/x11/xserver/xorg-server/udev.d/97-xorg.rules diff --git a/packages/x11/xserver/xorg-server/init.d/71_xorg b/packages/x11/xserver/xorg-server/init.d/71_xorg deleted file mode 100644 index c07e6824f4..0000000000 --- a/packages/x11/xserver/xorg-server/init.d/71_xorg +++ /dev/null @@ -1,50 +0,0 @@ -################################################################################ -# Copyright (C) 2009-2010 OpenELEC.tv -# http://www.openelec.tv -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -# starting xorg -# -# runlevels: openelec - -XORG_ARGS="-s 0 -nr -noreset -allowMouseOpenFail -nocursor -nolisten tcp" -[ "$DEBUG" = yes ] && XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6" - -( - progress "creating directories needed for Xorg" - - mkdir -p /var/cache/xkb - mkdir -p /var/lib - mkdir -m 1777 -p /tmp/.ICE-unix - chown root:root /tmp/.ICE-unix - - if [ "$GPUTYPE" = "NVIDIA" ]; then - ln -sf /usr/lib/libGL_nvidia.so.1 /var/lib/libGL.so - ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so - XORG_ARGS="$XORG_ARGS -ignoreABI" - else - ln -sf /usr/lib/libGL_mesa.so.1 /var/lib/libGL.so - ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so - fi - - progress "starting xorg" - - XORG_ARGS="$XORG_ARGS -config $XORG_CONF" - Xorg $DISPLAY vt01 $XORG_ARGS > /dev/null 2>&1 - -)& \ No newline at end of file diff --git a/packages/x11/xserver/xorg-server/install b/packages/x11/xserver/xorg-server/install index 09ca8ef10c..830eb9a0e2 100755 --- a/packages/x11/xserver/xorg-server/install +++ b/packages/x11/xserver/xorg-server/install @@ -30,6 +30,9 @@ XORG_DST="$INSTALL/$XORG_PATH_MODULES" mkdir -p $INSTALL/usr/bin cp $XORG_SRC/Xorg $INSTALL/usr/bin +mkdir -p $INSTALL/lib/udev + cp $PKG_DIR/scripts/xorg_start $INSTALL/lib/udev + mkdir -p $XORG_DST cp -P $XORG_SRC/exa/.libs/libexa.so $XORG_DST cp -P $XORG_SRC/dixmods/.libs/libfb.so $XORG_DST diff --git a/packages/x11/xserver/xorg-server/profile.d/display.conf b/packages/x11/xserver/xorg-server/profile.d/display.conf index 3207e005d5..506c3cc5d5 100644 --- a/packages/x11/xserver/xorg-server/profile.d/display.conf +++ b/packages/x11/xserver/xorg-server/profile.d/display.conf @@ -30,63 +30,6 @@ DISPLAY=":0.0" export DISPLAY -################################################################################ -# setup xorg.conf paths -################################################################################ - - XORG_CONF_DEFAULT="/etc/X11/xorg.conf" - XORG_CONF_INTEL="/etc/X11/xorg-intel.conf" - XORG_CONF_NVIDIA="/etc/X11/xorg-nvidia.conf" - XORG_CONF_NVIDIA_CHD="/etc/X11/xorg-nvidia-chd.conf" - XORG_CONF_NOUVEAU="/etc/X11/xorg-nouveau.conf" - XORG_CONF_RADEON="/etc/X11/xorg-radeon.conf" - XORG_CONF_USER="/storage/.config/xorg.conf" - -################################################################################ -# setup driver paths -################################################################################ - - XORG_DRIVER_INTEL="/usr/lib/xorg/modules/drivers/intel_drv.so" - XORG_DRIVER_NVIDIA="/usr/lib/xorg/modules/drivers/nvidia_drv.so" - XORG_DRIVER_NOUVEAU="/usr/lib/xorg/modules/drivers/nouveau_drv.so" - XORG_DRIVER_RADEON="/usr/lib/xorg/modules/drivers/radeon_drv.so" - -################################################################################ -# Identify GPU, other by default -################################################################################ - - GPUDEVICE=$(lspci -n | grep 0300) - GPUTYPE="OTHER" - [ "$(echo $GPUDEVICE | grep 8086)" -a -f "$XORG_DRIVER_INTEL" ] && GPUTYPE="INTEL" # 8086 == INTEL - [ "$(echo $GPUDEVICE | grep 10de)" -a -f "$XORG_DRIVER_NVIDIA" ] && GPUTYPE="NVIDIA" # 10de == NVIDIA - [ "$(echo $GPUDEVICE | grep 10de)" -a -f "$XORG_DRIVER_NOUVEAU" ] && GPUTYPE="NOUVEAU" # 10de == NVIDIA - [ "$(echo $GPUDEVICE | grep 1002)" -a -f "$XORG_DRIVER_RADEON" ] && GPUTYPE="AMD" # 1002 == AMD - -################################################################################ -# Identify any Mediadevice, like Broadcom's CrystalHD cards -################################################################################ - - MEDIADEVICE=$(lspci -n | grep 0480) - MEDIATYPE="NO" - [ "$(echo $MEDIADEVICE | grep 14e4)" ] && MEDIATYPE="CRYSTALHD" # 14e4 == BROADCOM - -################################################################################ -# setup xorg.conf -################################################################################ - - [ "$GPUTYPE" = "INTEL" ] && XORG_CONF="$XORG_CONF_INTEL" - [ "$GPUTYPE" = "NVIDIA" ] && XORG_CONF="$XORG_CONF_NVIDIA" - [ "$GPUTYPE" = "NOUVEAU" ] && XORG_CONF="$XORG_CONF_NOUVEAU" - [ "$GPUTYPE" = "RADEON" ] && XORG_CONF="$XORG_CONF_RADEON" - [ "$GPUTYPE" = "OTHER" ] && XORG_CONF="$XORG_CONF_DEFAULT" - - # check if we have an Broadcom CrystalHD card installed, so we can disable - # the use of shared memory - [ "$GPUTYPE" = "NVIDIA" -a "$MEDIATYPE" = "CRYSTALHD" ] && XORG_CONF="$XORG_CONF_NVIDIA_CHD" - - # load user defined xorg.conf, if exist - [ -f "$XORG_CONF_USER" ] && XORG_CONF="$XORG_CONF_USER" - ################################################################################ # setup functions ################################################################################ diff --git a/packages/x11/xserver/xorg-server/scripts/xorg_start b/packages/x11/xserver/xorg-server/scripts/xorg_start new file mode 100755 index 0000000000..68ea14d275 --- /dev/null +++ b/packages/x11/xserver/xorg-server/scripts/xorg_start @@ -0,0 +1,90 @@ +#!/bin/sh + +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +. /etc/profile + +if [ "$RUNLEVEL" = openelec ]; then + + logger -t Xorg "### starting Xorg with driver $1 ###" + + ############################################################################## + # setup xorg.conf paths + ############################################################################## + + logger -t Xorg "### setup xorg.conf paths ###" + + XORG_CONF_DEFAULT="/etc/X11/xorg.conf" + XORG_CONF_DRIVER="/etc/X11/xorg-$1.conf" + XORG_CONF_USER="/storage/.config/xorg.conf" + + ############################################################################## + # creating start options + ############################################################################## + + logger -t Xorg "### creating start options ###" + + XORG_ARGS="-s 0 -nr -noreset -allowMouseOpenFail -nocursor -nolisten tcp" + + if [ "$DEBUG" = yes ]; then + XORG_ARGS="$XORG_ARGS -logverbose 6 -verbose 6" + fi + + # load user defined xorg.conf, if exist + if [ -f "$XORG_CONF_USER" ]; then + XORG_ARGS="$XORG_ARGS -config $XORG_CONF_USER" + elif [ -f "$XORG_CONF_DRIVER" ]; then + XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DRIVER" + elif [ -f "$XORG_CONF_DEFAULT" ]; then + XORG_ARGS="$XORG_ARGS -config $XORG_CONF_DEFAULT" + fi + + ############################################################################## + # creating needed directories and symlinks + ############################################################################## + + logger -t Xorg "### creating needed directories and symlinks ###" + + mkdir -p /var/cache/xkb + mkdir -p /var/lib + mkdir -m 1777 -p /tmp/.ICE-unix + chown root:root /tmp/.ICE-unix + + if [ "$1" = "nvidia" ]; then + ln -sf /usr/lib/libGL_nvidia.so.1 /var/lib/libGL.so + ln -sf /usr/lib/xorg/modules/extensions/libglx_nvidia.so /var/lib/libglx.so + XORG_ARGS="$XORG_ARGS -ignoreABI" + else + ln -sf /usr/lib/libGL_mesa.so.1 /var/lib/libGL.so + ln -sf /usr/lib/xorg/modules/extensions/libglx_mesa.so /var/lib/libglx.so + fi + + ############################################################################## + # starting Xorg + ############################################################################## + + logger -t Xorg "### starting Xorg with '$DISPLAY vt01 $XORG_ARGS' ###" + + Xorg $DISPLAY vt01 $XORG_ARGS > /dev/null 2>&1 & + +fi + +exit 0 diff --git a/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules new file mode 100644 index 0000000000..7746f1fd71 --- /dev/null +++ b/packages/x11/xserver/xorg-server/udev.d/97-xorg.rules @@ -0,0 +1,30 @@ +################################################################################ +# This file is part of OpenELEC - http://www.openelec.tv +# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv) +# +# This Program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This Program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenELEC; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +# http://www.gnu.org/copyleft/gpl.html +################################################################################ + +# only does something with "drivers" subsystem devices and supported hardware. +SUBSYSTEM!="drivers", GOTO="end" + +KERNEL!="i915", KERNEL!="nouveau", KERNEL!="nvidia", KERNEL!="radeon", \ +KERNEL!="vmware", GOTO="end" + +# Start Xorg based on the loaded drm driver +ACTION=="add|change", RUN+="/lib/udev/xorg_start %k" + +LABEL="end"