Dual Head on Debian Squeeze with nouveau and xrandr
I recently got myself a 24-inch monitor. I wanted to keep using my trusty 17 inch as well - to use as a secondary monitor for system monitoring, playing music and other background tasks. There is a closed-source nvidia driver. But I'll be using the open source nouveau driver (after trying with no success the nv open source driver). This is a writeup of what worked for me.
Two monitors is better than one!
The setup
Its worth knowing all of your setup before you start, hwinfo --gfxcard will tell you your graphics card. Here's mine:
- Debian Squeeze
- NVIDIA GeForce 6200 LE graphics card
- 24 inch 1900x1200 monitor attached to DVI port
- 17 inch 1280x1024 monitor attached to VGA port
Install the nouveau driver
Make sure you uninstall the nvidia proprietary driver if you've had it installed before. I had to ice its libglx and reinstall xserver-xorg and xserver-xorg-core to get a working glx library. Gnarly.
Add the experimental repository to /etc/apt/sources list
deb http://ftp.de.debian.org/debian experimental main
Next make sure module assistant is installed.
# aptitude update && aptitude install module-assistant
Update module assistant.
# m-a update
Compile and install drm.
# DRM_MODULES=nouveau m-a a-i drm
Now install the driver itself
# aptitude install xserver-xorg-video-nouveau
Edit xorg.conf
Back up your xorg.conf first. You really don't want to forget this!
# cp /etc/X11/xorg.cong /etc/X11/xorg.conf.working
Generate a blank xorg.conf, using dexconf
# dexconf
Tell X to use nouveau driver, in your new xorg.conf
Section "Device"
Identifier "Configured Video Device"
Driver "nouveau"
EndSection
Add your monitors in xorg.conf (getting rid of original monitor section).
Section "Monitor"
Identifier "Screen0"
EndSection
Section "Monitor"
Identifier "Screen1"
EndSection
Here's the clever bit, in the screen section you need to define a virtual screen. Add the horizontal resolutions of the two monitors together, I added an extra 20 pixels for luck.
Section "Screen"
Identifier "Screen"
Monitor "Screen0"
Device "Configured Video Device"
SubSection "Display"
Depth 24
Virtual 3200 1200
EndSubSection
EndSection
I needed to disable AIGLX. Not sure if this is a nouveau problem or what.
Section "ServerFlags"
Option "AIGLX" "false"
EndSection
OK. Now we have a nice xorg.conf. Restart X (ctrl-backspace should work). If you get a blank screen you can always drop back to using the vesa driver. And check /var/log/Xorg.0.log. That's how I found out about the AIGLX thing.
Here's my complete xorg.conf:
# xorg.conf (X.Org X Window System server configuration file)
# 2009-03-07 Dual head setup
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "gb"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
EndSection
Section "Device"
Identifier "Configured Video Device"
Driver "nouveau"
EndSection
Section "Monitor"
Identifier "Screen0"
EndSection
Section "Monitor"
Identifier "Screen1"
EndSection
Section "Screen"
Identifier "Screen"
Monitor "Screen0"
Device "Configured Video Device"
SubSection "Display"
Depth 24
Virtual 3200 1200
EndSubSection
EndSection
Section "ServerFlags"
Option "AIGLX" "false"
EndSection
Getting xrandr working
Xrandr should be installed already. If not:
aptitude install x11-xserver-utils
Lets try stuff out dynamically. Both screens first.
xrandr --output VGA-0 --mode 1280x1024 --pos 1920x0 --rotate normal --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
If you get a warning about the virtual screen size being too small, you set it wrong in xorg.conf. Google can do maths for you; add the sizes of your screens together. Now lets try a single monitor.
xrandr --output VGA-0 --off --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
Now we want to automate our monitor setup. I wanted to use my big screen most of the time, but to have a key binding to switch the little one on. I made a subdirectory called screens and put two sheel scripts in it
both.sh
#!/bin/sh
xrandr --output VGA-0 --mode 1280x1024 --pos 1920x0 --rotate normal --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
big.sh
#!/bin/sh
xrandr --output VGA-0 --off --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
Make sure that they're both executable.
# cd screen
# chmod 755 big.sh
# chmod 755 both.sh
Hotkey setup
We'll set up some Metacity keybindings. Fire up gconf-editor and go to apps/metacity/global_keybindings. Set "run_command_2" to "<Shift><Control>F7" and "run_command_3" to "<Shift><Control>F8". Now go to apps/metacity/keybinding_commands and set "command_2" to "/path/to/big.sh" and "command_3" to "/path/to/both.sh". Quit gconf editor and test.
We've got two annoyances to sort out now. We want the default monitor set up when gdm starts and Gnome places the panel on my second monitor, beacuse my second monitor is actually the first in the opinion of my graphics card. Thanks nvidia!
GDM setup
This one is easy, copy the xrandr line from big.sh into /etc/gdm/Init/Default.
xrandr --output VGA-0 --off --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
Done.
Panel Setup
This is really irritating. Gnome doesn't seem to remember where I put my panel. I eventually grabbed fbpanel from apt - its a bit faffy to setup, but works remarkably well.
# aptitude install fbpanel
To set up, edit the ~/.fbpanel/default file; remember to set your panel the same width as your monitor. This is mine:
# fbpanel <profile> config file
# see http://fbpanel.sf.net/docs.html for complete configuration guide
Global {
edge = top
allign = left
margin = 0
widthtype = pixel
width = 1920
height = 26
transparent = true
tintcolor = #ffffff
alpha = 43
setdocktype = true
setpartialstrut = true
autohide = false
heightWhenHidden = 2
}
Plugin {
type = space
config {
size = 2
}
}
Plugin {
type = menu
config {
image = /usr/share/fbpanel/images/star.png
systemmenu {
}
separator {
}
item {
icon = gnome-settings
name = configure
image = /usr/share/fbpanel/images/gnome-setting.svg
command = configure
}
item {
icon = gnome-terminal
name = terminal
image = /usr/share/fbpanel/images/gnome_terminal.svg
action = /usr/bin/x-terminal-emulator
}
}
}
Plugin {
type = space
config {
size = 5
}
}
Plugin {
type = launchbar
config {
button {
icon = gnome-terminal
tooltip = Terminal
action = /usr/bin/x-terminal-emulator
}
button {
icon = mozilla-firefox
tooltip = Firefox web browser
action = firefox
}
button {
icon = vim
tooltip = Vim
action = gvim
}
button {
icon = f-spot
tooltip = f-spot
action = f-spot
}
button {
icon = gimp
tooltip = GIMP
action = gimp
}
button {
icon = synaptic
tooltip = synaptic
action = synaptic
}
button {
icon = evolution
tooltip = evolution
action = evolution
}
button {
icon = rhythmbox
tooltip = rhythmbox
action = rhythmbox
}
}
}
Plugin {
type = space
config {
size = 8
}
}
Plugin {
type = taskbar
expand = true
config {
ShowIconified = true
ShowMapped = true
ShowAllDesks = false
tooltips = true
IconsOnly = false
MaxTaskWidth = 150
}
}
Plugin {
type = space
config {
size = 7
}
}
Plugin {
type = pager
config {
showwallpaper = true
}
}
Plugin {
type = icons
config {
DefaultIcon = /usr/share/fbpanel/images/default.xpm
application {
icon = gnome-terminal
Image = /usr/share/fbpanel/images/gnome_terminal.svg
ClassName = XTerm
}
application {
icon = gnome-terminal
Image = /usr/share/fbpanel/images/gnome_terminal.svg
ClassName = mlterm
}
application {
icon = gnome-terminal
Image = /usr/share/fbpanel/images/gnome_terminal.svg
ClassName = URxvt
}
application {
icon = mozilla-firefox
ClassName = Firefox-bin
}
application {
icon = mozilla-firefox
ClassName = Firefox
}
}
}
Plugin {
type = space
config {
size = 5
}
}
Plugin {
type = genmon
config {
Command = echo MemFree: $(grep "MemFree" /proc/meminfo|cut -b 13-30)
PollingTime = 2
TextSize = medium
TextColor = #000000
}
}
Plugin {
type = tray
}
Plugin {
type = dclock
config {
ClockFmt = %R
TooltipFmt = %A %x
Action = xmessage Please define some command &
color = #000000
}
}
Now we'll modify the big.sh and both.sh scripts to start and kill fbpanel as appropriate.
both.sh
#!/bin/sh
xrandr --output VGA-0 --mode 1280x1024 --pos 1920x0 --rotate normal --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
fbpanel&
big.sh
#!/bin/sh
killall fbpanel
xrandr --output VGA-0 --off --output DVI-D-0 --mode 1920x1200 --pos 0x0 --rotate normal
Whew! Now you have a dual monitor setup, its probably time to grab a cider.
Comments
RSS All comments on Dual Head on Debian Squeeze with nouveau and xrandr
Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don't log these details. Those services will. I do log everything you type into the form. Full privacy statement.