Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 02-25-11, 04:20 AM   #1
steffen_b
Registered User
 
Join Date: Dec 2010
Posts: 10
Default nvidia driver initialisation and udev

Is there or will be there any udev event signaling that driver initialisation has finished ? It looks like sometimes i'm getting problems, cause X is starting to early. Need to check with latest beta, but i think i've not seen ayn udev event on this. Can you carify what are the plans ?
steffen_b is offline   Reply With Quote
Old 02-25-11, 04:54 AM   #2
artem
Registered User
 
Join Date: Jun 2006
Posts: 705
Default Re: nvidia driver initialisation and udev

Read this first

Secondly, X.org server takes care of loading nvidia kernel module if it's not [yet] loaded.
artem is offline   Reply With Quote
Old 02-25-11, 12:36 PM   #3
steffen_b
Registered User
 
Join Date: Dec 2010
Posts: 10
Default Re: nvidia driver initialisation and udev

I dont have a specific problem which i could report.

We start X currently on filesystem, however sometimes it happens it does not switch vt or vdpau can not be accessed. A just _assumed_ it might be because the hardware is not yet initialised at that point in time.

Ubuntu is starting gdm at drm-device-added which i believe is not available with nvidia.

I more posted this to get an understanding on how things work, if i missed something etc ...

If you can confirm that not yet initialised video card can not happen at all - then i will try to get the people having the problems to here.
steffen_b is offline   Reply With Quote
Old 02-25-11, 04:19 PM   #4
Licaon
Registered User
 
Licaon's Avatar
 
Join Date: Nov 2004
Location: Between the keyboard and the chair.
Posts: 490
Default Re: nvidia driver initialisation and udev

can you detail you exact method? some script samples or something ?
Licaon is offline   Reply With Quote
Old 02-27-11, 07:15 AM   #5
steffen_b
Registered User
 
Join Date: Dec 2010
Posts: 10
Default Re: nvidia driver initialisation and udev

http://www.yavdr.org/blog/blog-post/...dr-03-upstart/

Basically we have an upstart job which is doing modprobe nvidia , to test availibility of nvidia video card. if that job is finished, that will start openbox with xinit which in turn start the rest (tv frontend application or xbmc , nvidia-settings etc pp)

If there would be some udev event to react on we could skip that first thing and be sure hardware is ready, nothing really important, but that would be the right thing to do i feel
steffen_b is offline   Reply With Quote
Old 02-27-11, 08:50 AM   #6
openelec.tv
Registered User
 
Join Date: Dec 2009
Posts: 8
Arrow Re: nvidia driver initialisation and udev

Hi,

Quote:
Originally Posted by steffen_b View Post
Is there or will be there any udev event signaling that driver initialisation has finished ? It looks like sometimes i'm getting problems, cause X is starting to early.
on OpenELEC (a embedded distro to run XBMC) i had similiar problems after upgrading to kernel 2.6.38-rc6. we was starting Xorg with a shellscript. before we have tested with lspci if the nvidia driver is started, and created some needed symlinks to be also compatible with other graphic drivers. Because of the problems with kernel-2.6.38-rc6 i had the same idea to start Xorg over udev. I have managed this with the follow udev rule and xorg start script (note the special rule for the nvidia driver):

Code:
################################################################################
#      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
################################################################################

ACTION!="add|change", GOTO="end_video"

# xorg_start only does something for subsystem "pci" and "video" class.
SUBSYSTEM=="pci", ATTR{class}=="0x030000", GOTO="subsystem_pci"
SUBSYSTEM=="drivers", GOTO="subsystem_drivers"
GOTO="end_video"

# check for drivers dont use the pci substem
LABEL="subsystem_drivers"
KERNEL=="nvidia",  ENV{xorg_driver}="nvidia",  GOTO="start_xorg"
GOTO="end_video"

# check for drivers using the pci substem
LABEL="subsystem_pci"
DRIVER=="i915",    ENV{xorg_driver}="i915",    GOTO="start_xorg"
DRIVER=="nouveau", ENV{xorg_driver}="nouveau", GOTO="start_xorg"
#DRIVER=="nvidia",  ENV{xorg_driver}="nvidia",  GOTO="start_xorg"
DRIVER=="radeon",  ENV{xorg_driver}="radeon",  GOTO="start_xorg"
DRIVER=="vmware",  ENV{xorg_driver}="vmware",  GOTO="start_xorg"
GOTO="end_video"

# start Xorg
LABEL="start_xorg"
ENV{xorg_driver}=="?*", RUN+="/lib/udev/xorg_start"

LABEL="end_video"
Code:
#!/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 ${xorg_driver} ###"

  ##############################################################################
  # setup xorg.conf paths
  ##############################################################################

  logger -t Xorg "### setup xorg.conf paths ###"

  XORG_CONF_DEFAULT="/etc/X11/xorg.conf"
  XORG_CONF_DRIVER="/etc/X11/xorg-${xorg_driver}.conf"
  XORG_CONF_USER="/storage/.config/xorg.conf"

  ##############################################################################
  # creating start options
  ##############################################################################

  logger -t Xorg "### creating start options ###"

  XORG_ARGS="-s 0 -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 [ "${xorg_driver}" = "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
see also:
https://github.com/OpenELEC/OpenELEC.../97-xorg.rules
https://github.com/OpenELEC/OpenELEC...pts/xorg_start

i am not very happy the nvidia driver dont work in the way the other driver does, but all is working with this. We dont use xinit to start Xorg and i am sure you can change the Xorg start script to start Xorg via upstart too. The udev rule is setting a variable $xorg_driver which is used by our xorg start script to setup paths and symlinks.

let me know if you have questions :-)

greetings

Stephan
__________________
greetings, Stephan

✩✩✩✩✩ OpenELEC.tv ✩✩✩✩✩
✩✩✩✩✩ try now the fast booting and smallest (50-70MB) embedded XBMC distribution with PVR function ✩✩✩✩✩
openelec.tv is offline   Reply With Quote
Old 03-01-11, 03:42 AM   #7
steffen_b
Registered User
 
Join Date: Dec 2010
Posts: 10
Default Re: nvidia driver initialisation and udev

Perfect ! Thanks Stephan ! That was exactly what i was hoping/searching for Sorry took me few days to find a timeslot to try it.

For the record, for us that will be then:
Use 78-start-xorg.rules (as we only call helper) . That will do initctl emit -n signalname xorg_driver=$xorg_driver in an udev-helper script. The upstart job will then start on signalname and the xorg.conf is choosen based on xorg_driver variable content.
steffen_b is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:09 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.