NVIDIA Twinview in Intrepid Ibex (beta)

Dual screens with NVIDIA in Linux

The NVIDIA restricted driver supports dual screens in two ways: “Twinview” or “Separate X screen”. Both have advantageous and disadvantageous.

Personally, I prefers “Separate X screen”, because I like to have both screens totally independent. This is especially useful with Compiz cube enabled: you could rotated the cube independently on both screens. With Twinview, you could only rotate as “one big cube”, or two synchronised cubes.

One downside of “Separate X screen” is you couldn’t move windows between screens. A window opened in one screen stayed that screen; you would not be able to move the window from one screen to the other. Apart from this minor inconvenience, some applications like Firefox (which can only run one instance) will not allow you to open it simultaneously in both screens.

Dynamic Twinview

Arguably the most useful feature of Twinview is dynamic dual screens set-up. That means you could enable dual screens without restarting Xorg (or reboot). This is quite convenient for a laptop user, who would like to easily connect an external front projector for a presentation.

Hardware

I no longer have a laptop with NVIDIA graphics; however, my PC set-up could be consider similar. I have a PC with a LCD monitor as the primary screen connected to the DVI port, and a LCD TV as the secondary screen connected to the VGA port. The primary screen could be equate to a laptop internal screen, and the secondary screen could be equate to an external display (e.g. the front projector).

For completeness, here is the information on my graphics hardware.

00:05.0 VGA compatible controller:
nVidia Corporation C51PV [GeForce 6150] (rev a2)

NVIDIA broken-ness in Intrepid

nvidia-settings tool

Mucking around the various configurations of NVIDIA restricted driver in Intrepid, I came to a realization. Previously, display configuration was done in xorg.conf file. NVIDIA took this fact and create the nvidia-settings tool to auto-generate a static configuration in xorg.conf that will stick for each reboot.

Xorg is not standing still, however. Increasingly, parts of the xorg.conf were being removed in favor of auto-detections. As of Intrepid, the extend of removals have reached the point where the static configurations written by nvidia-settings into xorg.conf is now causing breakage of Xorg.

Specifically, the “Save to X Configuration File” button in nvidia-settings could cause breakage in Intrepid. Xorg would not start and you would end up in low graphics mode. I encountered this in my set-up for both Twinview and Separate X screen configurations. In both cases, the Xorg failed after I modified the xorg.conf file using nvidia-settings.

Side note:
You might be wondering about the Ubuntu Screen Resolution tool (found under: Main Panel Menu > System > Preferences). If you are using NVIDIA restricted driver, you should not be using this tool for display configuration. At best, it would not do anything. At worst, it might confuse the NVIDIA driver and cause other problems. It is highly advisable to stick to nvidia-settings tool when you use NVIDIA restricted driver.

Dynamic Twinview in Intrepid

Thanksfully, not everything is lost. You could still configure dual screens using Dynamic Twinview. With Dynamic Twinview, you avoid writing to xorg.conf. The nvidia-settings tool dynamically detects and activate Twinview for the dual screens; no adding to xorg.conf file, and no restart of Xorg required.

Unfortunately, there are two problems:

  1. The configuration do not stick when you reboot. This is not a big problem if you are using a laptop with external display attached only as needed. Otherwise, it’s a big drag to reconfigure this every reboot.
  2. The display on VGA port is treated as the primary screen, over the display on DVI port. More of a hassle if you reboot with both displays attached. And extremely annoying if the display on VGA port is positioned in an awkward location, or is not always turned on.

Manually add Twinview configuration into xorg.conf

After mucking around for two days, I finally found the best solution.

The starting point is a fresh install of Intrepid beta. Attach only one display during install. After first boot and grabbing all updates, enable the NVIDIA restricted driver. Then, following another reboot, you should now have an xorg.conf that looked like this.

Section "Monitor"
	Identifier	"Configured Monitor"
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Monitor		"Configured Monitor"
	Device		"Configured Video Device"
	DefaultDepth	24
EndSection

Section "Module"
	Load	"glx"
	Disable	"dri2"
EndSection

Section "Device"
	Identifier	"Configured Video Device"
	Driver	"nvidia"
	Option	"NoLogo"	"True"
EndSection



Before continuing any further, back-up the current working xorg.conf. This give you a fall back option in case you messed up.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.original-working-backup



1. Add these lines under Section “Device”, to set the display connected to the DVI port as primary screen.

Option "TwinViewXineramaInfoOrder" "DFP-0, CRT-0"
Option "UseDisplayDevice" "DFP-0, CRT-0"
Option "TwinViewOrientation" "DFP-0 LeftOf CRT-0"



2. And add this line under Section “Screen”, to enable Twinview.

Option  "TwinView" "1"



Therefore, this is what it should look like after the change.

Section "Monitor"
	Identifier	"Configured Monitor"
EndSection

Section "Screen"
	Identifier	"Default Screen"
	Monitor		"Configured Monitor"
	Device		"Configured Video Device"
	DefaultDepth	24

	# Enable Twinview
	Option         "TwinView" "1"
EndSection

Section "Module"
	Load	"glx"
	Disable	"dri2"
EndSection

Section "Device"
	Identifier	"Configured Video Device"
	Driver	"nvidia"
	Option	"NoLogo"	"True"

	# Twinview display order
	Option "TwinViewXineramaInfoOrder" "DFP-0, CRT-0"
	Option "UseDisplayDevice" "DFP-0, CRT-0"
	Option "TwinViewOrientation" "DFP-0 LeftOf CRT-0"
EndSection

With these manual changes, Twinview will be enabled with the displays in the correct left-right arrangement.

Misbehaving display without valid EDID

Some displays, notably LCD TV, front projectors, older monitors and displays behind KVM switches, do not provide valid EDID information to the graphics driver. Faced with this situation, the driver might misconfigure the screen resolution and/or refresh rates.

In my case, the NVIDIA could not get the EDID from my LCD TV, which is connected to the VGA port. In the past, this has resulted in 640×480 resolution. Fortunately, this time in Intrepid, it defaulted to 1024×768.

However, I am not going to stop until I got the screen to 1360×768 (the LCD TV native resolution). In order to do this, I use nvidia-settings tool as the starting point.

1. Select the display (red highlight).

nvidia-settings tool



2. Click “Resolution” dropdown, select the desired resolution (in my case, it’s 1360×768).

nvidia-settings tool



3. Click apply.

nvidia-settings tool



We are not done yet. This would enable dual screens for this session only, and the settings would be forgotten upon reboot.

Reminder:
Using “Save to X Configuration File” would likely resulted in low resolution mode upon reboot.

We need to edit xorg.conf again. But first, we need to grab the configuration line from Xorg.0.log.

cat /var/log/Xorg.0.log



The last line should be the configuration line, which looked like this for my set-up.

"DFP-0:nvidia-auto-select@1680x1050+0+0,CRT-0:1360x768@1360x768+1680+0"



From this, we add Option “metamodes” into Section “Screen”. The final Section “Screen” should look like this.

Section "Screen"
	Identifier	"Default Screen"
	Monitor		"Configured Monitor"
	Device		"Configured Video Device"
	DefaultDepth	24

	# Enable Twinview
	Option "TwinView" "1"
	Option "metamodes" "DFP-0:nvidia-auto-select@1680x1050+0+0,CRT-0:1360x768@1360x768+1680+0"
EndSection



Now, the NVIDIA Twinview configuration in Intrepid is complete.

Trackbacks & Pingbacks 2

  1. From Cloning display not working on laptop - openSUSE Forums on 31 May 2010 at 6:56 pm

    [...] with correct EDID info, causing the X-server to use the wrong display mode. More on this here: chewearn's blog – NVIDIA Twinview in Intrepid Ibex (beta) Hopefully, this will help you to get a working xorg.conf for your [...]

  2. From Ubuntu + Nvidia显卡实现双显示器 | azalea says on 04 Sep 2010 at 7:20 am

    [...] http://blog.chewearn.com/2008/10/08/nvidia-twinview-in-intrepid-ibex-beta/ This entry was posted in ubuntu and tagged ubuntu. Bookmark the permalink. ← [...]

Comments 4

  1. Bruce Edge wrote:

    Nice job. Thanks!
    I posted a link to this in the Ubuntu help forums for a thread relating to this.
    http://ubuntuforums.org/showthread.php?p=6381458#post6381458

    Posted 17 Dec 2008 at 4:19 am
  2. chewearn wrote:

    hi Bruce, thanks for the endorsement. :)

    Posted 17 Dec 2008 at 4:56 am
  3. mike wrote:

    You can easily start firefox on both screens by using distinct profiles.

    firefox -P brings up the profile manager…

    Posted 26 Mar 2009 at 7:58 pm
  4. chewearn wrote:

    hi mike
    Thanks for the tip.

    Posted 09 Apr 2009 at 9:05 am

Post a Comment

Your email is never published nor shared. Required fields are marked *