Taylorbyte.com

Documentation Wiki

Multiseat / Dual Seat Arch Linux NVIDIA

Hardware requirements

  • 2 NVIDIA cards / 1 NVIDIA card with 2 GPUs
  • 2 Monitors
  • 2 USB keyboards
  • 2 USB mice
  • 2 Sound cards / devices (nice if video card has a HDMI sound card)

Configure kdmrc

Backup kdmrc

sudo cp /usr/share/config/kdm/kdmrc /usr/share/config/kdm/kdmrc.default

Edit /usr/share/config/kdm/kdmrc

Change StaticServers=:0 to StaticServers=:0,:1

Change ReserveServers=:1,:2,:3 to ReserveServers=:2,:3

At the end of [X-:*-Greeter] settings add/edit the following lines

AllowClose=true
NumLock=On

At the end of [X-:0-Core] settings add the following lines

ClientLogFile=.xsession-errors
ServerArgsLocal=-nolisten tcp -layout layout0
ServerVT=7


[X-:1-Core]
ClientLogFile=.xsession-errors
ServerArgsLocal=-nolisten tcp -layout layout1 -sharevts -novtswitch
ServerVT=8

Configure xorg.conf

Backup xorg.conf if it exists

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.default

Find keyboards and mice

watch -n 1 ls /dev/input/by-path/

Plug in usb keyboards and mice and watch the list, to see which ones are which

Create a new xorg.conf

cat > /etc/X11/xorg.conf << EOF
Section "ServerFlags"
    Option         "AutoAddDevices" "false"
    Option         "AutoEnableDevices" "false"
    Option         "AllowMouseOpenFail" "on"
    Option         "AllowEmptyInput" "on"
    Option         "ZapWarning" "on"
    Option         "DontZap" "false"
    Option         "HandleSepcialKeys" "off" # Zapping on
    Option         "DRI2" "on"
    Option         "Xinerama" "off"
EndSection

Section "ServerLayout"
    Identifier     "layout0"
    Screen         "screen0" 0 0
    InputDevice    "G15-0" "CoreKeyboard"
    InputDevice    "G15-0-Buttons" "SendCoreEvents"
    InputDevice    "WirelessMouse1" "CorePointer"
    Option         "Clone" "off"
    Option         "AutoAddDevices" "off"
    Option         "DisableModInDev" "true"
EndSection

Section "ServerLayout"
    Identifier     "layout1"
    Screen         "screen1" 0 0
    InputDevice    "GeniusKeyboard" "SendCoreEvents"
#    InputDevice    "WirelessKeyboard1" "SendCoreEvents"
    InputDevice    "WirelessMouse0" "SendCoreEvents"
    Option         "Clone" "off"
    Option         "AutoAddDevices" "off"
    Option         "DisableModInDev" "true"
EndSection

Section "InputDevice"
    Identifier     "WirelessMouse0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-1d57_2.4G_Wireless_Optical_Mouse-event-mouse"
    Option         "GrabDevice" "on"
EndSection

Section "InputDevice"
    Identifier     "WirelessMouse1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
    Option         "GrabDevice" "on"
EndSection

Section "InputDevice"
    Identifier     "G15-0"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-046d_G15_Gaming_Keyboard-event-if01"
    Option         "xkb_rules" "evdev"
    Option         "xkb_model" "evdev"
    Option         "xkb_layout" "us"
    Option         "GrabDevice" "on" # prevent send event to other X-servers
    Option         "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Section "InputDevice"
    Identifier     "G15-0-Buttons"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-046d_G15_Gaming_Keyboard-event-kbd"
    Option         "GrabDevice" "on"
EndSection

Section "InputDevice"
    Identifier     "WirelessKeyboard1"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd"
    Option         "xkb_rules" "evdev"
    Option         "xkb_model" "evdev"
    Option         "xkb_layout" "us"
    Option         "GrabDevice" "on" # prevent send event to other X-servers
    Option         "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Section "InputDevice"
    Identifier     "GeniusKeyboard"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-_USB_Keyboard-event-kbd"
    Option         "xkb_rules" "evdev"
    Option         "xkb_model" "evdev"
    Option         "xkb_layout" "us"
    Option         "GrabDevice" "on" # prevent send event to other X-servers
    Option         "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
    Option         "DPI" "96 x 96"
EndSection

Section "Monitor"
    Identifier     "Monitor1"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
    Option         "DPI" "96 x 96"
EndSection

Section "Device"
    Identifier     "videocard0"
    Driver         "nvidia"
    Option         "RenderAccel" "true"
    Option         "TripleBuffer" "true"
    Option         "NoLogo" "1"
    BusID          "PCI:3:0:0"
EndSection

Section "Device"
    Identifier     "videocard1"
    Driver         "nvidia"
    Option         "RenderAccel" "true"
    Option         "TripleBuffer" "true"
    Option         "NoLogo" "1"
    BusID          "PCI:4:0:0"
EndSection

Section "Screen"
    Identifier     "screen0"
    Device         "videocard0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Subsection     "Display"
        Depth       24
    EndSubsection
EndSection

Section "Screen"
    Identifier     "screen1"
    Device         "videocard1"
    Monitor        "Monitor1"
    DefaultDepth    24
    Subsection     "Display"
        Depth       24
    EndSubsection
EndSection

Section "Extensions"
    Option         "Composite" "Enable"
EndSection
EOF

Easy part is finnished restart X

/etc/rc.d/kdm restart

Configure multiple sound cards

Find sound devices

sudo lsmod | grep snd
snd_usb_audio          93397  4
snd_hda_intel          23311  14

Add these 2 lines to the bottom of /etc/modprobe.d/alsa.conf

sudo cat >> /etc/modprobe.d/alsa.conf << EOF
options snd-hda-intel index=0,1,2
options snd-usb-audio index=3
EOF

Configure asound.conf

sudo cat > /etc/asound.conf << EOF
pcm.!default {
  type plug
  slave.pcm intel
}

pcm.intel {
  type asym
  playback.pcm "intelplay"
  capture.pcm "intelroute"
  hint {
    show on
    description "snd-hda-intel"
  }
}

pcm.intelplay {
  type dmix
  ipc_key 1001
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.intelroute {
  type route
  slave {
    pcm "intelrecord"
    format S16_LE
  }
  ttable {
    0 {0 0.5}
    1 {0 0.5}
  }
}

pcm.intelrecord {
  type dsnoop
  ipc_key 1002
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:0,0"
    #period_time 0
    #period_size 1024
    #buffer_size 8192
    period_size 256
    periods 16
    buffer_size 16384
  }
  bindings {
    0 0
  }
}

pcm.usb {
  type asym
  playback.pcm "usbplay"
  capture.pcm "usbrecord"
  hint {
    show on
    description "snd-usb-audio"
  }
}

pcm.usbplay {
  type dmix
  ipc_key 3001
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:3,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.usbrecord {
  type dsnoop
  ipc_key 3002
  ipc_key_add_uid false
  ipc_perm 0666
  slave {
    pcm "hw:3,0"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

ctl.usb {
type hw
card 1
}

ctl.intel {
type hw
card 0
}

pcm.nvidia {
  type dmix
  ipc_key 4001
  ipc_key_add_uid false
  ipc_perm 0666
  hint {
    show on
    description "snd-nvidia"
  }
  slave {
    pcm "hw:1,9"
    period_time 0
    period_size 1024
    buffer_size 8192
  }
}

pcm.nvidia1 {
  type dmix
  ipc_key 5001
  ipc_key_add_uid false
  ipc_perm 0666
  hint {
    show on
    description "snd-nvidia1"
  }
  slave {
  pcm "hw:2,9"
  period_time 0
  period_size 1024
  buffer_size 8192
  }
}
EOF

Configure audio and video groups for users

sudo usermod -G audio -G video -G plugdev -a user
sudo usermod -G audio -G video -G plugdev -a guest

asoundrc start up configuration script

Each users .asoundrc file is dynamically created at login

cat > /sh/multiseatsound << EOF
#!/bin/sh
asoundrcpath="/tmp/asoundrc-\`whoami\`"
if [ "\`echo \$DISPLAY\`" = ":0" ]; then
echo "pcm.!default {" > \$asoundrcpath
echo "        type plug" >> \$asoundrcpath
echo "        slave.pcm intel" >> \$asoundrcpath
echo "}" >> \$asoundrcpath
fi
if [ "\`echo \$DISPLAY\`" = ":1" ]; then
echo "pcm.!default {" > \$asoundrcpath
echo "        type plug" >> \$asoundrcpath
echo "        slave.pcm nvidia" >> \$asoundrcpath
echo "}" >> \$asoundrcpath
fi
EOF

cat > /etc/X11/xinit/xinitrc.d/50-multiseatsound << EOF
/sh/multiseatsound
EOF
chmod 755 /etc/X11/xinit/xinitrc.d/50-multiseatsound

Create symlink in each users home directory

rm ~/.asoundrc
ln -s ~/.asoundrc /tmp/asoundrc-`whoami`

Install GLX Gears

sudo pacman -S mesa-demos

Run glxgears

glxgears

More Information

Downgrade nvidia packages

Creative Commons License

This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 Australia License.

Last edited by Brenton Taylor on Sunday, July 15th, 2012 (r2085).