Using An External Monitor On A System76 Laptop With an nVidia Graphics Card

From Knowledge76

Jump to: navigation, search

Contents

Introduction

A frequent question is how to run a System76 laptop computer with an external monitor. As laptops are often used for drive projectors during presentations, it is desirable to support hot-plugging monitors and allowing their resizing on the fly.

The graphics cards featured in the Gazelle, Serval, and Bonobo computers are nVidia GeForce 500M series. The Lemur and Pangolin laptops use Intel graphics cards, and the contents of this article do not apply to them.

Drivers

There are two drivers available for the nVidia GeForce 500M series cards: a proprietary one writen by nVidia and an open-source one, known as nouveau. It is the latter driver that is used on the liveCD during install.

X Windows Configuration and xrandr

Unix systems generally use a system known as X to manage graphics hardware, such as displays, screens and mice. The X system needs to find its configuration - for example what screens there are and what resolutions they should be driven at. There are two ways to configure X.

The older one is a file-based system. There is a file known as xorg.conf, which, in 11.10 ubuntu, lives in the directory /etc/X11. This file details the devices and their parameters.

The xorg.conf file is only read when X starts up, and so it cannot support hot-plugging or reconfiguring devices other than into modes pre-defined in the xorg.conf. To make a change to xorg.conf, one generally must log out of the user's session, restart X from the logon screen, and then log in again.

The more modern system for managing the configuration of X is a system called xrandr (short for "x rotate and resize"). This allows reconfigurations on the fly, including hot-plugging.

Configuration under proprietary driver

Unfortunately, the proprietary nVidia driver supports xrandr only partially, and in particular does not support hot-plugging. This can be demonstrated by typing the command xrandr at the command line, and only the single display is shown. No entries for the HDMI or DVI outputs appear.

Accordingly, nVidia supplies an application called "NVIDIA X Server Settings" that can be used to adjust the contents of the xorg.conf file. It is possible to use this to detect new monitors that are plugged in, and position and size them. However, since the application is just editing the xorg.conf file, it will be necessary to log out, restart X, and log back in for the settings to take effect.

If the proprietary driver is in use, it will be possible to detect the existence of a new monitor by opening the "NVIDIA X Server Settings" and selecting "X Server Display Configuration". It is often desirable to spread the desktop across more than one monitor, to allow dragging open windows from one monitor to another. There are two ways this can be done.

One is by enabling the Xinerama mode. This can be done either from the "NVIDIA X Server Settings" application or by adding the row

   Option         "Xinerama" "1"

to the ServerLayout secton of the xorg.conf file.

However, when Xinerama is in use, 3d accelerations will be disabled for both the attached displays.

It is also possible to spread the desktop across the external monitor by using nVidia's proprietary extension to X, known as TwinView. This will have the advantage of allowing the card to continue to support full 3d acceleration.

Here is an example xorg.conf file, prepared by the "nVidia Settings Manager":

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 290.10  (buildd@charichuelo)  Wed Nov 23 07:50:49 UTC 2011

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

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LGD"
    HorizSync       30.0 - 75.0
    VertRefresh     60.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 560M"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "1"
    Option         "TwinViewXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "DFP: nvidia-auto-select +0+0, CRT: nvidia-auto-select +1920+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

As you can see from this file, in TwinView there is only one X screen, and it must be driven at the color depth of the lower of the two attached screens. This is probably not much of a problem as virtually all modern monitors can be driven at 24 bit color depth.

Configuration under nouveau

An alternative possibility is to use the open source driver, nouveau. Uninstalling the nVidia drivers will cause the system to revert to the open source driver. To do this, a system reboot is required. It is also useful to install the debug packages:

 sudo apt-get remove nvidia-current nvidia-current-updates
 sudo apt-get install nouveau-firmware xserver-xorg-video-nouveau-dbg

and then reboot. NOTE: you must remove or rename the xorg.conf file shown above or X will not start, as TwinView is not supported by nouveau.

In the past, the open source driver a reputation for bad stability, but it has improved in recent releases. It fully supports xrandr and hot-plugging, as can be seen by running the command xrandr from the command line and noting the existence of all the graphics outputs. Unfortunately, with the nouveau driver, some, but not all, 3d accelerations are supported, and so not all desktop effects can be enabled.

However, one current remaining bug is that, if an external monitor is connected (even if it is subsequently disconnected), the computer will fail to sleep.

Summary of Features and Bugs

Driver FOSS license xorg.conf setup Hot Plugging Controllable using KDE System Settings Change modes without X restart Supports different color depths on displays 3d acceleration suspend fully functional
Nouveau Yes not needed Yes Yes Yes Yes Partial No
nVidia No Xinerama No No No Yes No Yes
nVidia No TwinView No No No No Yes Yes

Screen resolution

It appears that the proprietary driver incorrectly determines the physical screen resolution, under KDE at least. This issue does not afflict the nouveau driver. The effect is that system fonts are displayed too big. This can be corrected by going into System Settings > Application Appearance > Fonts and selecting 120 in the Force Fonts DPI dropdown.


External Links

Personal tools