Saturday, August 2, 2008

Dual display under Ubuntu

Well, I have finally obtained a goal I've waited impatiently for over five years to surmount - I'm writing this blog entry on a Linux system with two wonderful displays running as an extended desktop. Windows has done this for me for years, yet Linux has resisted. Ubuntu 8.04 was 'better', yet still created some weird scrolling modes until this morning.

My setup:
1) self-built PC with Intel Core 2 Quad Q6600, 2GB DDR2-800, Asus P5K
2) EVGA 8800GT Superclocked with 512MB GDDR3
3) Ubuntu 8.04 which dual-boots with Windows-XP SP3
4) Primary Display via DVI - Samsung 730B (1280x1024)
5) Secondary Display via DVI - ViewSonic Q20wb (1680x1050)

Of course this triumph isn't really mine - I just found the correct pieces to make it work. The process is almost painless, and I think the Xorg folks (or team porting to Ubuntu) have finally got it right. Read any xorg.conf file from last year and it had a hundred lines of bizarre text which didn't belong there ... I mean, why should I include a line saying in an old 2-bit, 4-color video mode circa 1985 I want to support 1280x1024 and so on? The xorg.conf file is now nice and clean, letting the software assume such things.

Step 1) Backup the Working XORG.CONF file
Ubuntu 8.04 installed with basic support for the primary "generic display", which was the 1280x1024 Samsung. Gone are even the struggle to avoid the 800x600 "low-res" mode when displays don't have hardware sync info in the xorg.conf file. So start by saving the known-good file - this is something you should always do as it allows recovery should your x-server crash upon reboot:
  • sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig
Step 2) Use Synaptic Package Manager to install EnvyNG
I installed both the envng-core and envyng-gtk - not sure if both required, but I have the disk space. This adds the menu Applications | System Tools | EnvyNG. Running this asks for admin password and installs enough packages to rebuild various NVIDA resources.

Step 3) Run nvidia_settings
Well, here is where the magic starts to fall down. After installing those files you will find the option NVIDIA X Server Settings under your System | Administration menu. Run it and you see this magically enticing popup:

Ahh, almost like Windows-XP now, yes? Catch is this method of launching the tool won't have permission to modify your xorg.conf files or even save to /etc/X11. Thus anything you change now will fail to be saved. I can imagine many a frustrated person seeing the error message and just assuming the drivers won't work.

So you need to run this command in a terminal window instead:
  • sudo nvidia-settings
Which launches the same tool with the correct permissions to update your configuration. I chose not to save the changes to xorg.conf, but to xorg.conf.dual. Regardless, the settings won't take effect right away anyway.

Step 4) Organize /etc/X11
Perhaps this isn't required, but it is my habit learned over the years; I used a terminal window to insure I had four versions of xorg.conf:
  • /etc/X11/xorg.conf.orig is a copy of the 'natural' file created during install which I never change
  • /etc/X11/xorg.conf.single is a copy of the xorg.conf active before I ran nvidia_settings with only my single primary display (it might equal xorg.conf.orig - I don't really care)
  • /etc/X11/xorg.conf.dual is the output of nvidia_settings, which at this point might work ... or might not.
  • /etc/X11/xorg.conf, which I manually overwrite at this time by copying xorg.conf.dual over it.
These simple to comprehend names often in the past saved my bacon when fiddling with my xorg.conf created an unusable configuration. A simple file copy from a recovery root login can over-write the bad xorg.conf with a know good one, allowing me to restart the GUI.

Step 5) restart X-server
Log yourself out, then back in to see if your wonderful new dual-display desktop works.

Results:
  • With my 8800GT, results were superb with a nice extended desktop 3000 by 1000 pixels across my two displays (1620+1280 by 1050 & 1024 to be exact)
  • However, I tried a second time with an old gForce 5500 and ended up with a config which never worked quite right. I would set up the two old CRT for a dual x-server side-by-side, try to force both to a modest 1024 x768 and somehow the result is always two x-servers in twin-view mode piled on top of each other at two different resolutions. The side-by-side extended desktop works fine under Windows XP.

Labels: , ,