HOWTO: Intel and Nvidia accelerated on a 2 seat machine

Share your own howto's etc. Not for support questions!

HOWTO: Intel and Nvidia accelerated on a 2 seat machine

Postby johnviglis » 2014-09-10 19:20

Still some issues:
1. After installing the proprietary Nvidia driver, there are problems in setting LD_LIBRARY_PATH on only the Nvidia seat.
2. Still searching for the best configuration for sound on second seat (I only have one sound card)

Any help would be appreciated!!

I recently managed to have a 2 seat configuration working on a single desktop with a pciE Nvidia GTS250 and an onboard Intel G31/G33 express. You will need 2 keyboards, 2 mice and of course 2 screens to get this working. Both Nvidia and Intel are fully functional with 3d acceleration with the proprietary Nvidia driver and the intel/mesa driver provided by official repositories. At the end of this post you can find most of the internet resources I used.
A minor issue I still have, is the lack of two completely independent sound configurations with equalizer etc. I would like to have one seat using the "left" and the other the "right" speakers or one seat using the s/pdif and the other the analog output etc. I don't know yet if this is possible with only one onboard audio card, but I 'll give it a try soon enough.
I have to notice here that my Intel card, though fully functional, is unable to handle any demanding 3d game, but at least it can support for example compiz or xbmc which need opengl acceleration.
To get starting, connect your two monitors into the Nvidia and your Intel cards. Don't connect both monitors on the dualhead Nvidia. Then enable both cards through BIOS setup. For the onboard VGA you must select "Always enable" not "Enable if no PEG present". Choose Nvidia as your primary monitor, save settings and reboot. Also connect your two keyboard/mouse sets. You can use any USB or PS2 port of the motherboard and afterwards you can displace them without any issues.
You will need another computer/tablet/phone to keep up with the instructions since most of the time you won't have any window manager enabled. Good luck!

Since I prefer gnome-classic (you can use the desktop environment of your choice, it makes no difference), I started with a fresh installation of Debian Wheezy 7.6.0 (Stable) without any desktop environment. I installed lightdm and gnome to have a complete window manager with no proprietary drivers at this point.

All commands must be run as root. So hit Alt+CTRL+F2 (or F1 through F6, to use your tty1 through tty6), provide your username and password and type:
Code: Select all
sudo su
or if you dont have sudo enabled:
Code: Select all
su
Then create a root password to enable root login, it will save you some time...
Code: Select all
passwd
Now kill your running Xsession
Code: Select all
pkill gdm3


PART I ----- Two Seat Configuration with Free Drivers

First of all you have to configure the desktop manager for 2 seperate Xsessions. Of all the available desktop managers, I found the most configurable to be lightdm. Install lightdm to handle your X sessions.
Code: Select all
apt get install lightdm
When prompted choose lightdm to be your default desktop manager.
Configure lightdm to handle 2 Xsessions:
Code: Select all
pico /etc/lightdm/lightdm.conf
My lightdm.conf looks like this:
Code: Select all
#
# General configuration
#
# start-default-seat = True to always start one seat if none are defined in the configuration
# greeter-user = User to run greeter as
# minimum-display-number = Minimum display number to use for X servers
# minimum-vt = First VT to run displays on
# user-authority-in-system-dir = True if session authority should be in the system location
# guest-account-script = Script to be run to setup guest account
# log-directory = Directory to log information to
# run-directory = Directory to put running state in
# cache-directory = Directory to cache to
# xsessions-directory = Directory to find X sessions
# xgreeters-directory = Directory to find X greeters
#

[LightDM]
#start-default-seat=true
#greeter-user=lightdm
#minimum-display-number=0
#minimum-vt=7
#user-authority-in-system-dir=false
#guest-account-script=guest-account
#log-directory=/var/log/lightdm
#run-directory=/var/run/lightdm
#cache-directory=/var/cache/lightdm
#xsessions-directory=/usr/share/xsessions
#xgreeters-directory=/usr/share/xgreeters

#
# Seat defaults
#
# xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
# xserver-layout = Layout to pass to X server
# xserver-config = Config file to pass to X server
# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
# xdmcp-port = XDMCP UDP/IP port to communicate on
# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
# greeter-session = Session to load for greeter
# greeter-hide-users = True to hide the user list
# greeter-allow-guest = True if the greeter should show a guest login option
# greeter-show-manual-login = True if the greeter should offer a manual login option
# user-session = Session to load for users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
# display-setup-script = Script to run when starting a greeter session (runs as root)
# greeter-setup-script = Script to run when starting a greeter (runs as root)
# session-setup-script = Script to run when starting a user session (runs as root)
# session-cleanup-script = Script to run when quitting a user session (runs as root)
# autologin-guest = True to log in as guest by default
# autologin-user = User to log in with by default (overrides autologin-guest)
# autologin-user-timeout = Number of seconds to wait before loading default user
# autologin-session = Session to load for automatic login (overrides user-session)
# exit-on-failure = True if the daemon should exit if this seat fails
#

[SeatDefaults]
#xserver-command=X
#xserver-layout=
#xserver-config=
xserver-allow-tcp=false
#xdmcp-manager=
#xdmcp-port=177
#xdmcp-key=
greeter-session=lightdm-greeter
greeter-hide-users=true
#greeter-allow-guest=true
#greeter-show-manual-login=false
#user-session=default
#allow-guest=true
#guest-session=UNIMPLEMENTED
session-wrapper=/etc/X11/Xsession
#display-setup-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
#autologin-user=
#autologin-user-timeout=0
#autologin-session=UNIMPLEMENTED
#exit-on-failure=false

#
# Seat configuration
#
# Each seat must start with "Seat:".
# Uses settings from [SeatDefaults], any of these can be overriden by setting them in this section.
#
#[Seat:0]

#
# XDMCP Server configuration
#
# enabled = True if XDMCP connections should be allowed
# port = UDP/IP port to listen for connections on
# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf)
#
# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn.  Alternatively
# it can be a word and the first 7 characters are used as the key.
#

#autologin-user=

[XDMCPServer]
#enabled=false
#port=177
#key=

#
# VNC Server configuration
#
# enabled = True if VNC connections should be allowed
# port = TCP/IP port to listen for connections on
#

[VNCServer]
#enabled=false
#port=5900
#width=1024
#height=768
#depth=8

#####################################    NVIDIA SEAT

[Seat:0]
xserver-command=/usr/bin/X :0
xserver-config=xorg_seat0.conf
autologin-user=user0

#####################################    INTEL SEAT

[Seat:1]
xserver-command=/usr/bin/X :1 -sharevts
xserver-config=xorg_seat1.conf
autologin-user=user1
(Ignore any line starting with #, it is a comment)
The users in the above example are named "user0" and "user1", replace those with two valid usernames on your debian. You can also leave this blank so autologin will not be enabled by default. Hit CTRL+x to save the file and exit. If you don't have a second user, create one: (replace user1 with whatever)
Code: Select all
adduser user1

Now configure your 2 seats. You will need two separate files in directory /etc/X11/
Code: Select all
pico /etc/X11/xorg_seat0.conf
and it must be something like this:
Code: Select all
Section "ServerFlags"
#    Option "AutoAddDevices" "false"
#    Option "AutoEnableDevices" "false"
    Option "AllowMouseOpenFail" "on"
    Option "AllowEmptyInput" "on"
    Option "ZapWarning" "on"
    Option "HandleSpecialKeys" "off"
    Option "DRI2" "on"
    Option "Xinerama" "off"
EndSection

Section "InputClass"
    Identifier    "Disable cable keyboard"
    MatchProduct  "AT Translated Set 2 keyboard"
    Option        "Ignore" "on"
EndSection

Section "InputClass"
    Identifier    "Disable cable mouse"
    MatchProduct  "Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)"
    Option        "Ignore" "on"
EndSection

Section "ServerLayout"
    Identifier     "Seat0"
    Screen         "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

#Section "Files"
#ModulePath "/nvidia/glx,/nvidia/lib,/usr/lib/xorg/modules"
#EndSection

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-mouse"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
    Option         "GrabDevice" "on"
EndSection

Section "InputDevice"
    Identifier     "Keyboard0"
    Driver         "kbd"
    Option         "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd"
    Option         "GrabDevice" "on"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "LG"
    ModelName      "LG Electronics LG TV"
    HorizSync       30.0 - 83.0
    VertRefresh     58.0 - 62.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver          "nouveau"
#    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option         "GLXVBlank" "true"
    BoardName      "GeForce GTS 250"
    Option         "NoLogo" "1"
    BusId          "PCI:1:0:0"
    Option         "ProbeAllGpus" "false"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
#    Option         "Stereo" "0"
#    Option         "nvidiaXineramaInfoOrder" "DFP-1"
#    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection
Also
Code: Select all
pico /etc/X11/xorg_seat1.conf
should look like this:
Code: Select all
Section "ServerFlags"
#    Option "AutoAddDevices" "false"
#    Option "AutoEnableDevices" "false"
    Option "AllowMouseOpenFail" "on"
    Option "AllowEmptyInput" "on"
    Option "ZapWarning" "on"
    Option "HandleSpecialKeys" "off"
    Option "DRI" "on"
EndSection

Section "InputClass"
    Identifier   "Disable Logitech wireless keyboard and mouse"
    MatchProduct "Logitech USB Receiver"
    Option       "Ignore" "on"
EndSection

Section "ServerLayout"
    Identifier     "Seat1"
    Screen      0  "Screen1" 0 0
    InputDevice    "Keyboard1" "CoreKeyboard"
    InputDevice    "Mouse1" "CorePointer"
EndSection

Section "InputDevice"
    Identifier     "Mouse1"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/input/by-id/usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-event-mouse"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
    Option         "GrabDevice" "on"
EndSection

Section "InputDevice"
    Identifier     "Keyboard1"
    Driver         "kbd"
    Option         "Device" "/dev/input/by-path/platform-i8042-serio-0-event-kbd"
    Option         "GrabDevice" "on"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    VendorName     "LG"
    ModelName      "LG Electronics W2042"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Module"
    Load "record"
    Load "dri"
    Load "dri2"
    Load "dbe"
    Load "extmod"
    Load "glx"
EndSection

Section "Device"
    Identifier     "Device1"
    Driver         "intel"
    Option         "XvMC" "on"
    Option         "XvMCSurfaces" "7"
    VendorName     "Intel Corporation"
    BoardName      "Intel 82G31"
    BusID          "PCI:0:2:0"
    Option         "AccelMethod" "sna"
EndSection

Section "Screen"
    Identifier     "Screen1"
    Device         "Device1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Option         "Stereo" "0"
    SubSection     "Display"
        Depth       24
   Modes       "1680x1050"
    EndSubSection
EndSection

Now some explanations for the above files:

1. Section "InputClass":
In these sections you define the keyboard and mouse that you DON'T want to use on the specific seat. The "Identifier" is just a name so change it in whatever you want but the "MatchProduct" must be the exact string for the keyboard or mouse you don't want to enable to the seat. You get this by entering:
Code: Select all
xinput list
and you will get something like this
Code: Select all
xinput list
⎡ Virtual core pointer                       id=2   [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                 id=4   [slave  pointer  (2)]
⎜   ↳ Logitech USB Receiver                      id=9   [slave  pointer  (2)]
⎜   ↳ Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)             id=1   [slave  pointer  (2)]
⎣ Virtual core keyboard                      id=3   [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                id=5   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard     id=0   [slave  keyboard(3)]
    ↳ Power Button                               id=6   [slave  keyboard (3)]
    ↳ Power Button                               id=7   [slave  keyboard (3)]
    ↳ Logitech USB Receiver                      id=8   [slave  keyboard (3)]
    ↳ UVC Camera (046d:0992)                     id=10   [slave  keyboard (3)]
so locate your undesired mouse and keyboard and create a Section "InputDevice" for each. Note that in my example the "Logitech USB Receiver" is referred twice, it is my wireless keyboard and mouse set, so I had to create only one "InputDevice" section for my xorg_seat1.conf.

2. Section "InputDevice"
In these sections you define the mouse and keyboard you DO want to use on each screen. You will need two "InputDevice" sections on each seat. One for the mouse and one for the keyboard. I suggest that you leave all "Identifier" and "Driver" values as they are on my example so that it won't get messed up. The only value you should change is the Option "Device" "..." with your specific mouse or keyboard. You will find these values with
Code: Select all
ls /dev/input/by-id
which will give you something like that
Code: Select all
usb-046d_0992_D607D6EA-event-if00
usb-Logitech_USB_Receiver-event-kbd
usb-Logitech_USB_Receiver-event-mouse
usb-Logitech_USB_Receiver-if01-event-mouse
usb-Logitech_USB_Receiver-if01-mouse
usb-Logitech_USB_Receiver-mouse
usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-event-mouse
usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-mouse
Select your mouse and keyboard from this list and edit the "Device" "..." string.

3. Section "Monitor"
These sections, one for each seat define your screens. Don't change the identifier values (as before) because they are referred-to in other sections. HorizSync and VertRefresh depend on your monitor. If you don't know the correct values for these, just google "yourscreenmodel xorg.conf monitor settings" to find them.

4. Section "Screen"
Just set the color depth (usually 24) and the native resolution of your screen (for example 1920x1080). Leave everything else as is.

5. Section "Device"
These sections define your graphics cards. One for each seat, of course. You must pay attention to the BusID values. In my case I have a "PCI:0:2:0" for my Intel GPU and PCI:1:0:0 for my Nvidia GPU. You can find your correct PCI values by entering
Code: Select all
lspci |grep VGA
which will give your Nvidia card
Code: Select all
01:00.0 VGA compatible controller: NVIDIA Corporation G92 [GeForce GTS 250] (rev a2)
and
Code: Select all
lspci |grep Graphics
which will give you your Intel card
Code: Select all
00:02.0 Display controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)
Please note that these numbers/letters are in hexadecimal format so if you have a value "01:05:0" you will set PCI:1:5:0 but if you had a value like "00:1b:0" or "00:10:0"you should convert it to decimal format (understood by Xorg) so it would be PCI:0:27:0 and PCI:0:16:0 respectively. If you are in this case and can't convert by hand, google "convert hexadecimal to decimal".
In this section are also defined the drivers used by each GPU and other options, I suggest that besides the BusID you keep all other values exactly as they are.

6.Section "ServerLayout"
In this section (one for each seat) a mouse, a screen and a keyboard is assigned to the seat. The identifier can be anything but all other values are referring to other sections of each seat configuration file so leave them as in my example.

Note that user1 (on your Intel seat) has still no sound ***************under construction

Install some more packages to take full advantage of your Intel video card:
Code: Select all
apt-get install glx-alternative-mesa libgl1-mesa-dri-experimental libegl1-mesa

At this point reboot your machine and if all went fine you will have two independent users on the same machine. Both seats are 3d accelerated and Nvidia is still using the nouveau driver. This driver does not take full advantage of your Nvidia card but it is free, open-source, stable and the overall performance is quite good, especially if you don't need to play any demanding 3d games. In that case you can skip Part II, sit back and enjoy!

PART II ----- Nvidia Proprietary Drivers and Configuration

1. Download the appropriate proprietary Nvidia driver from http://www.nvidia.com/Download/index.aspx?lang=en-us for your Nvidia card model and your Linux distribution. In my case it is the NVIDIA-Linux-x86-340.32.run file.
Nvidia driver is by default messing up with open source drivers so you will have to install it with some options. Note that you must use the same gcc version to install it with the one used for your current kernel. Save the file you downloaded somewhere on your hard drive. In my case it is the /home/user0/Downloads directory. Run:
Code: Select all
sh /home/user0/Downloads/NVIDIA-Linux-x86-340.32.run --accept-license  --no-backup --no-x-check  --ui=none --no-x-check --no-distro-scripts --utility-prefix=/nvidia --installer-prefix=/nvidia --opengl-prefix=/nvidia --opengl-libdir=glx
If you get an error message about gcc version download from official repositories the gcc version required and run something like:
Code: Select all
CC="gcc-4.6" sh /home/user0/Downloads/NVIDIA-Linux-x86-340.32.run --accept-license  --no-backup --no-x-check  --ui=none --no-x-check --no-distro-scripts --utility-prefix=/nvidia --installer-prefix=/nvidia --opengl-prefix=/nvidia --opengl-libdir=glx

If you still get error messages about existing drivers uninstall all existing nouveau and nvidia drivers. Install preferably with dkms (it will ask you) but if it cannot be done install without it.

2. Create a symlink in the /nvidia/glx/ directory:
Code: Select all
cd /nvidia/glx
Code: Select all
ln -s /usr/lib/xorg/modules/extensions/libglx.so.340.32 libglx.so

3. Create the file /etc/ld.so.conf.d/nvidia.conf
Code: Select all
pico /etc/ld.so.conf.d/nvidia.conf
with the content
Code: Select all
/nvidia/lib
/nvidia/glx
and run
Code: Select all
ldconfig

4. Create the file /etc/bash_completion.d/nvidia.sh
Code: Select all
pico /etc/bash_completion.d/nvidia.sh
with the content (be careful with the syntax)
Code: Select all
if [ `echo $DISPLAY |grep -c ":0"` -eq 1 ]; then
export LD_LIBRARY_PATH=/nvidia/glx
fi
Note that the :0 refers to your Nvidia seat. If you changed this configuration before, change it here also. Everything else as is.

5. Create the file /etc/profile.d/nvidia.sh
Code: Select all
pico /etc/profile.d/nvidia.sh
with the same content
Code: Select all
if [ `echo $DISPLAY |grep -c ":0"` -eq 1 ]; then
export LD_LIBRARY_PATH=/nvidia/glx
fi

6. Reinstall intel and mesa drivers.
Code: Select all
apt-get install --reinstall glx-alternative-mesa xserver-xorg-core libgl1-mesa-glx libgl1-mesa-dri


PART III ----- Configure Environment variables for Gnome (under construction...)

At this point after rebooting you will have a fully 3d capable seat on your Intel seat (seat1) and a not fully 3d capable seat on your Nvidia seat (seat0). If you start a terminal on your Nvidia seat you can run glxgears or glxinfo and you will see that the correct glx is running on the respective seats. On the contrary, when you start a 3d application from the desktop environment you will get an error message about glx, or dri missing. This occurs because we had set the LD_LIBRARY_PATH for screen 0 in terminals but not on the window manager.(Part II steps 4 and 5). A bug with openssh https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711623 could be the problem since Part II step 5 should be enough. I'm still resolving this...


It took me a few days to get to this point, I used information mainly from these urls but also from many others, many thanks to the linux community!
p.s. forgive my english, it's not my native language :)
https://help.ubuntu.com/community/MultiseatX
http://disjunkt.com/jd/2010/en/multiseat-linux/multiseat-linux-system-wide-pulseaudio-for-routing-sounds-109/
http://forums.debian.net/viewtopic.php?f=10&t=89120
http://www.x.org/wiki/
https://wiki.ubuntu.com/X/Config/Input
https://help.ubuntu.com/community/EnvironmentVariables
http://blog.startupanywhere.org/hardware-accelerated-nvidia-and-intel-graphics-together-in-debian/
https://wiki.debian.org/LightDM
http://www.linuxtoys.org/multiseat/multiseat.html
johnviglis
 
Posts: 1
Joined: 2014-09-10 14:46

Re: HOWTO: Intel and Nvidia accelerated on a 2 seat machine

Postby bolvan » 2015-03-15 08:16

At this point after rebooting you will have a fully 3d capable seat on your Intel seat (seat1) and a not fully 3d capable seat on your Nvidia seat (seat0). If you start a terminal on your Nvidia seat you can run glxgears or glxinfo and you will see that the correct glx is running on the respective seats. On the contrary, when you start a 3d application from the desktop environment you will get an error message about glx, or dri missing. This occurs because we had set the LD_LIBRARY_PATH for screen 0 in terminals but not on the window manager.(Part II steps 4 and 5). A bug with openssh https://bugs.debian.org/cgi-bin/bugrepo ... bug=711623 could be the problem since Part II step 5 should be enough. I'm still resolving this...


I tried somehow to inject LD_LIBRARY_PATH into Xsession scripts but it failed.
X sessions are started thru ssh-agent and dbus-launch. I dont know what they do but after them /usr/bin/gnome-session
has blank LD_LIBRARY_PATH.
So I did brute hack.

cd /usr/bin
mv gnome-session gnome-session2
create gnome-session :

Code: Select all
#!/bin/bash

PREV_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
if [ "$DISPLAY" == ":1" ]
then
 export LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/mesa;$PREV_LD_LIBRARY_PATH
else
 export LD_LIBRARY_PATH=/usr/lib/nvidia-331-updates;$PREV_LD_LIBRARY_PATH
fi
exec gnome-session2 $@


chmod +x /usr/bin/gnome-session


Its rude solution, but its simple and it works
bolvan
 
Posts: 1
Joined: 2015-03-15 08:12


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 11 guests

fashionable