Difference between revisions of "Xorg RandR 1.2"

From ThinkWiki
Jump to: navigation, search
m (References)
m (code put in <pre> tags)
 
(97 intermediate revisions by 26 users not shown)
Line 1: Line 1:
{{Fixme|This page will cover use of Xorg 7.3 with RandR version 1.2 based on testing the forthcoming Ubuntu 'Gutsy' (7.10) release with a Thinkpad R60e (Intel 946GM graphics chip). As the release stabilises so should this page transform from a lab notebook to a fully written-up howto.}}
+
== Overview ==
 +
 
 +
'''X RandR '''is used to configure which display ports are enabled (e.g. LCD, VGA and DVI), and to configure display modes and properties such as orientation, reflection and DPI.
 +
 
 +
This is the simplest and most powerful way to get multi-monitor systems working using recent versions of Linux such as {{Ubuntu 7.10}} and Fedora 8 with graphics chipsets such as the Intel 945GM/GMS and ATI Radeon found in Thinkpads.
 +
 
 +
'''xrandr''' is the command line interface to the RandR X extension. As usual with X, good documentation is hard to find; first try the following commands:
 +
 
 +
* {{cmduser|xrandr --help}}
 +
* {{cmduser|man xrandr}}
  
== Overview ==
+
* for Intel graphics: {{cmduser|man intel}}
 +
* for ATI graphics: {{cmduser|man radeon}}
  
'''X RandR '''is used to set the size, orientation and reflection of the screen display outputs.
+
The rest of this page refers to a laptop with a built in 1024x768 pixel screen and an external 1600x1200 VGA monitor. Simply replace the relevant numbers with your own system specifications and all should work fine.
  
xrandr is the command line interface to the RandR X extension. As usual with X good documentation is hard to find, to start somewhere try
+
== Supported drivers ==
 +
{{Ubuntu 7.10}} '''Gutsy Gibbon'''
 +
* X.org [[intel]] driver, version ??? (included in Xorg ???) and later. Ubuntu version: [https://launchpad.net/ubuntu/+source/xserver-xorg-video-intel/2:2.1.1-0ubuntu2  2:2.1.1-0ubuntu2] with [https://launchpad.net/ubuntu/gutsy/i386/xrandr/1:1.2.2-0ubuntu1 xrandr 1:1.2.2-0ubuntu1]
  
    {{cmduser|xrandr --help}}
+
* X.org [[radeon]] driver, 6.7.192 and later (in ubuntu [http://packages.ubuntu.com/gutsy/x11/xserver-xorg-video-ati gutsy] and [http://packages.ubuntu.com/hardy/x11/xserver-xorg-video-ati hardy], but they still have [http://bugs.launchpad.net/bugs/148408 very serious issues] for some Thinkpads).
    {{cmduser|man xrandr}}
 
    {{cmduser|man intel}}
 
  
 
== xorg.conf ==
 
== xorg.conf ==
Start testing with a default configuration.
+
Recent versions of xorg.conf intended for use with xrandr 1.2 considerably simplify the video section of the configuration. If you upgrading from an earlier version you may find your existing xorg.conf works against the effective deployment of xrandr. So it is best to start with a new Xorg configuration.
Connect the external display to the VGA port, turn on that display, boot and run (as root)
+
 
 +
'''An updated Xorg.conf should:'''
 +
* omit dual Device/Screen/Monitor sections
 +
* omit MonitorLayout option and Screen lines from the remaining Device section
 +
* omit dual Screen lines from the ServerLayout section
 +
* omit RightOf/LeftOf indication to the remaining Screen line in ServerLayout section
 +
* add a "Virtual 2048 2048" line in SubSection "Display" to create a large virtual screen
  
     {{cmdroot|dpkg-reconfigure -phigh xserver-xorg}}
+
To create a new xorg.conf for Ubuntu and other Debian based distributions, connect the external display to the VGA port, turn on that display, and run
 +
     {{cmduser|sudo dpkg-reconfigure -phigh xserver-xorg}}
 +
 
 +
Since Ubuntu 9.04 and later Debian releases the above command doesn't actually do anything and to create a new xorg.conf file you need to stop X and then type
 +
    {{cmduser|sudo X -configure}}
 +
which will create an xorg.conf.new file in the home folder of the user you are logged in (or /root if logged in as root)
 
   
 
   
 
The resulting {{path|/etc/X11/xorg.conf}} should include something like
 
The resulting {{path|/etc/X11/xorg.conf}} should include something like
Line 23: Line 44:
 
         Driver "intel"
 
         Driver "intel"
 
         BusID "PCI:0:2:0"
 
         BusID "PCI:0:2:0"
 +
        '''# ADD THIS IF YOUR LAPTOP DOES NOT HAVE A TV CONNECTOR or DOCKING STATION '''
 +
        '''Option          "monitor-TV"  "TV" '''
 
     EndSection
 
     EndSection
 
     Section "Monitor"
 
     Section "Monitor"
Line 28: Line 51:
 
         Option "DPMS"
 
         Option "DPMS"
 
     EndSection
 
     EndSection
 +
    '''# ADD THIS IF YOUR LAPTOP DOES NOT HAVE A TV CONNECTOR or DOCKING STATION '''
 +
    '''Section "Monitor" '''
 +
        '''Identifier      "TV" '''
 +
        '''Option          "Ignore" "True" '''
 +
    EndSection '''
 
     Section "Screen"
 
     Section "Screen"
 
         Identifier "Default Screen"
 
         Identifier "Default Screen"
Line 33: Line 61:
 
         Monitor "Generic Monitor"
 
         Monitor "Generic Monitor"
 
         DefaultDepth 24
 
         DefaultDepth 24
     ...
+
      
 
         SubSection "Display"
 
         SubSection "Display"
 
             Depth 24
 
             Depth 24
 
             Modes "1600x1200" "1280x1024" "1024x768" "800x600" "640x480"
 
             Modes "1600x1200" "1280x1024" "1024x768" "800x600" "640x480"
             # BUT ADD A VIRTUAL LINE
+
             '''# ADD A VIRTUAL LINE TO PROVIDE FOR THE LARGEST SCREENS YOU WILL HOTPLUG '''
             Virtual              2048 2048
+
             '''Virtual              2048 2048 '''
 
         EndSubSection
 
         EndSubSection
 
     EndSection
 
     EndSection
Line 52: Line 80:
 
     EndSection
 
     EndSection
  
after creating a clean Xorg.conf restart X and logon
 
  
You will probably find you have a display only on the external VGA screen at its default max resolution.
+
Just a hint:
 +
If you want to use TV-out but not VGA for example, you should change these sections:
 +
<pre>
 +
Section "Device"
 +
        Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
 +
        Driver          "intel"
 +
        BusID          "PCI:0:2:0"
 +
        Option          "monitor-VGA"  "VGA"
 +
        Option          "monitor-TV"  "TV"
 +
        Option          "monitor-LVCD" "LVCD"
 +
EndSection
 +
 
 +
Section "Monitor"
 +
        Identifier      "VGA"
 +
        Option "Ignore" "true"
 +
EndSection
 +
 
 +
Section "Monitor"
 +
        Identifier      "LVCD"
 +
        Option          "DPMS"
 +
EndSection
 +
 
 +
Section "Monitor"
 +
        Identifier      "TV"
 +
        Option  "Ignore" "false"
 +
EndSection
 +
</pre>
 +
 
 +
 
 +
After creating a clean {{path|xorg.conf}}, restart X and logon.
 +
 
 +
You may find you have a display only on the external VGA screen at its default max resolution; do not worry - xrandr can fix this.
  
 
== Using  {{cmduser|xrandr}} ==
 
== Using  {{cmduser|xrandr}} ==
  
 +
=== First discover what we have ===
 
Open a terminal window to use the command line: 'Applications:Accessories:Terminal'
 
Open a terminal window to use the command line: 'Applications:Accessories:Terminal'
  
 
{{HINT|First look at the 'help' and 'man' pages. }}
 
{{HINT|First look at the 'help' and 'man' pages. }}
  {{cmduser|xrandr --help}}
 
  {{cmduser|man xrandr}}
 
  
To query what we have (nothing connected to VGA)
+
{{cmduser|xrandr --help}}
{{cmduser| xrandr -v}}
+
{{cmduser|man xrandr}}
 +
 
 +
To find what version of xrandr is running, type the following command:
 +
{{cmduser| xrandr -v}}
 
     Server reports RandR version 1.2
 
     Server reports RandR version 1.2
 +
 +
To query what screens are connected, type the following: (The output shown indicates nothing is connected to the VGA port.)
 
  {{cmduser| xrandr -q }}
 
  {{cmduser| xrandr -q }}
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
+
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
VGA disconnected (normal left inverted right)
+
VGA disconnected (normal left inverted right)
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
+
  LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
  1024x768      60.0*+  50.0   
+
    1024x768      60.0*+  50.0   
  800x600        60.3   
+
    800x600        60.3   
  640x480        60.0    59.9   
+
    640x480        60.0    59.9   
TV disconnected (normal left inverted right)
+
TV disconnected (normal left inverted right)
 +
 
 +
If you see the 'TV disconnected' line but have neither TV connector nor docking station (eg Thinkpad R60e) then add to the Monitor and Device sections of xorg.conf as noted above. This will prevent the external (VGA) flashing off for a few seconds every time xrandr is used. (Newer versions of the intel driver may fix this.)  
 
   
 
   
connect, but do not power-on the VGA monitor
+
The same command as above, but with the VGA monitor plugged in and powered off, should give something like the following output: (The VGA monitor is now shown as 'connected'.)
{{cmduser| xrandr -q }}
+
{{cmduser| xrandr -q }}
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
+
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
VGA connected (normal left inverted right)
+
VGA connected (normal left inverted right)
  1920x1440@60  60.0   
+
    1920x1440@60  60.0   
  1920x1440      60.0   
+
    1920x1440      60.0   
  1600x1200@60  60.0   
+
    1600x1200@60  60.0   
  1600x1200      60.0   
+
    1600x1200      60.0   
  1280x960      60.0   
+
    1280x960      60.0   
  640x480@60    60.0   
+
    640x480@60    60.0   
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
+
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
  1024x768      60.0*+  50.0   
+
    1024x768      60.0*+  50.0   
  800x600        60.3   
+
    800x600        60.3   
  640x480        60.0    59.9   
+
    640x480        60.0    59.9   
TV disconnected (normal left inverted right)
+
TV disconnected (normal left inverted right)
 +
 
 +
Powering on the VGA monitor and issuing the same command again will give the following output: (The size and position of the VGA output within the virtual screen is now shown.)
 +
{{cmduser| xrandr -q }}
 +
Screen 0: minimum 320 x 200, current 2624 x 1200, maximum 2624 x 2048
 +
VGA connected 1600x1200+1024+0 (normal left inverted right) 367mm x 275mm
 +
    1600x1200      60.0*+
 +
    1920x1440@60  60.0 
 +
    1600x1200@60  60.0 
 +
    640x480@60    60.0 
 +
    640x480        60.0 
 +
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
 +
    1024x768      60.0*+  50.0 
 +
    800x600        60.3 
 +
    640x480        60.0    59.9 
 +
TV disconnected (normal left inverted right)
 +
 
 +
For bug reporting and diagnosis use xrandr with the verbose option:
 +
{{cmduser| xrandr --verbose}}
  
Power-on the VGA  
+
=== Using xrandr to do useful things ===
{{cmduser| xrandr -q }}
+
In general the commands will specify the output name and either --off or --auto. In the examples here the external screen is named ''VGA'', as used by the Intel driver, with an ATI card the name will probably be ''VGA-0''. In general use {{cmduser| xrandr -q}} to discover the appropriate output names for your configuration. The --auto option will select the preferred resolution for each output, this is starred(*) in the {{cmduser| xrandr -q}} listing and is normally the best resolution available. It is also possible to set a particular mode eg --mode 1024x768.
Screen 0: minimum 320 x 200, current 2624 x 1200, maximum 2624 x 2048
 
VGA connected 1600x1200+1024+0 (normal left inverted right) 367mm x 275mm
 
  1600x1200      60.0*+
 
  1920x1440@60  60.0 
 
  1600x1200@60  60.0 
 
  640x480@60    60.0 
 
  640x480        60.0 
 
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
 
  1024x768      60.0*+  50.0 
 
  800x600        60.3 
 
  640x480        60.0    59.9 
 
TV disconnected (normal left inverted right)
 
  
{{cmduser| xrandr --verbose}}
+
First clone the two screens, (the smaller screen will display the top left portion of the virtual screen)
tells us more
+
{{cmduser| xrandr --output LVDS --auto --output VGA --auto --same-as LVDS}}
  
{{cmduser| xrandr --output LVDS --auto}}
+
To turn off the VGA monitor.
gets two screens but both at 1600x1200 cloned
+
{{cmduser| xrandr --output VGA --off }}
  
{{cmduser| xrandr --output LVDS --mode 1024x768 --output VGA --off }}
+
''Note: This apparently reboots X !!! - cf. [http://crunchbanglinux.org/forums/post/45226/#p45226]''
gets laptop only at 1024x768
 
  
{{cmduser| xrandr --output VGA --right-of LVDS --mode 1600x1200 }}
+
To turn the VGA monitor back on, with its viewport to the right of the laptop monitor:
 +
{{cmduser| xrandr --output VGA --auto --right-of LVDS}}
 +
This will probably give an error message similar to:
 
     xrandr: screen cannot be larger than 1600x1600 (desired size 2624x1200)
 
     xrandr: screen cannot be larger than 1600x1600 (desired size 2624x1200)
  
{{cmduser| xrandr --output VGA  --mode 1600x1200 --pos 0x400 }}
+
This can be fixed by editing xorg.conf and changing the ''virtual'' line (see example above) to something like:
creates two screens with the laptop screen at bottom of the 1600x1600 window
+
    Virtual 2624 1200
 +
Note that the maximum supported size of the virtual desktop for the Intel 945GM series of chipset with 3D acceleration enabled, is 2048x2048. The virtual screen can be larger but DRI will be disabled. This may matter if you like games and compiz desktop effects, or if you want Google Earth to display in better than geological time. Obviously the larger the virtual desktop, the more graphics memory is used. So for good performance with a shared graphics system such as Intel the Virtual should be no larger than necessary.
 +
 
 +
It is possible to set screen locations as ''--left-of'', ''--right-of'', ''--above'' and ''--below''. Assuming displays sizes of 1024x768 and 1200x1600:
 +
{{cmduser| xrandr --output LVDS --auto --output VGA --auto --right-of LVDS}}
 +
and
 +
{{cmduser| xrandr --output LVDS --mode 1024x768 --pos 0x0 --output VGA  --mode 1600x1200 --pos 1024x0}}
 +
are equivalent. Both will place the external monitor to the right of the laptop display within the virtual screen.
 +
 
 +
If the Virtual size is only 2048 wide the above command will fail as the combined width of the two displays exceeds the maximum virtual size. However it is possible to have overlap the display viewports. So to fit within the 2048 limit:
 +
  {{cmduser| xrandr --output VGA --mode 1024x768 --pos 0x0 --output VGA  --mode 1600x1200 --pos 448x0}}
 +
 
 +
=== Now automate it on login ===
 +
To configure xrandr automatically during the first login, save this script to your computer as /etc/X11/Xsession.d/45custom_xrandr-settings:
 +
<pre>
 +
# If an external monitor is connected, place it with xrandr
 +
# External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
 +
EXTERNAL_OUTPUT="VGA"
 +
INTERNAL_OUTPUT="LVDS"
 +
# EXTERNAL_LOCATION may be one of: left, right, above, or below
 +
EXTERNAL_LOCATION="right"
 +
 
 +
case "$EXTERNAL_LOCATION" in
 +
      left|LEFT)
 +
              EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
 +
              ;;
 +
      right|RIGHT)
 +
              EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
 +
              ;;
 +
      top|TOP|above|ABOVE)
 +
              EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
 +
              ;;
 +
      bottom|BOTTOM|below|BELOW)
 +
              EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
 +
              ;;
 +
      *)
 +
              EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
 +
              ;;
 +
esac
 +
 
 +
xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
 +
if [ $? -eq 0 ]; then
 +
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
 +
    # Alternative command in case of trouble:
 +
    # (sleep 2; xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION) &
 +
else
 +
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
 +
fi
 +
</pre>
 +
 
 +
 
 +
When X starts, it will be mirrored across both screens until someone logs in. At that point this script will execute and xrandr will position the external monitor.
 +
 
 +
Note: On some machines the script above will not work although it seems to be executed correctly (no effect on resolution). In this case, try the commented-out alternative command line.
  
{{cmduser| xrandr --output LVDS --mode 1024x768 --pos 0x400 }}
+
=== [[Sample Fn-F7 script]] ===
moves laptop screen to top of window, so both share same top line (which is where I prefer my menu bar)
+
For further examples of the use of xrandr commands, and scripts to switch the display using the Function key Fn-F7 see [[Sample Fn-F7 script]].
  
{{cmduser| xrandr  --output VGA --mode 1600x1200 --pos 0x768}}
+
=== GUIs ===
  xrandr: screen cannot be larger than 1920x1440 (desired size 1600x1968)
 
  
edit xorg.conf and ensure we have '''Virtual 2048 2048'''. Try again and it works we have a laptop screen in a virtual position at the top of a 2048x2048 frame with the VGA monitor below.
+
Several graphical frontends are available for xrandr (all using GTK):
  
Next edit xorg.conf and set '''Virtual 2624 2048 '''
+
* [http://gitweb.freedesktop.org/?p=xorg/app/grandr.git Grandr]
 +
* [http://www.albertomilone.com/urandr.html URandR]
 +
* [http://christian.amsuess.com/tools/arandr/ ARandR]
 +
* [http://sourceforge.net/projects/zarfy/ Zarfy] &mdash; A GUI to libxrandr. It presents the user with visual representaion of active displays on an interactive map of the screen memory. Features free postioning, configuration saving, scripting for R&R and an alternate gui for switching between monitors.
  
{{cmduser| xrandr  --output VGA --mode 1600x1200 --pos 1024x0}}
+
It is possible to have Fn-F7 run such a GUI, see [[Sample Fn-F7 script#Having Fn-F7 run a RandR GUI]].
  
We now have the laptop screen to the top-left of the 2624x2048 frame and the 1600x1200 VGA sitting beside it to the right. Now if only Gnome would put a menu-bar on the laptop screen and not place desktop icons in the invisible space below 768 on the laptop screen (and below 1200 on the VGA side) all manner of things would be well.
+
== Summing up ==
  
 +
'''xrandr''' enables dynamic resizing of screens, switching both external and laptop screens on and off, and the applications windows can be dragged from one screen to the other. None of this requires configuring anything special for {{path|/etc/X11/xorg.conf}}.
  
===So, the story so far ===
+
=== the Virtual screen ===  
'''2007-07-25:'''
+
A Virtual line is needed in the 'Display' SubSection of the of xorg.conf; it determines the size of the frame buffer into which the displays must fit. Without it the maximum virtual size will be limited to the size of the largest display that was connected when X was started. The maximum virtual size cannot be changed once X starts so needs to be large enough to accommodate the largest combination of displays you want to hotplug without having to restart X. If it is greater than 2048x2048 and you are using an Intel 945 (or less) chip then DRI is not possible. Making the Virtual size square makes rotation easy. A bigger Virtual requires more memory.  
'''xrandr''' enables dynamic resizing of screens, switching both external and laptop screens on and off, and the applications windows can be dragged from one screen to the other. None of this requires configuring anything special for {{path|/etc/X11/xorg.conf}}. Downside: the virtual screen is not big enough at at 1600x1600 to permit a 1024x768 laptop and a 1600x1200 external monitor screen to be used in a non-overlapped arrangement, something that is possible doing it the old way.
 
  
Reboot with VGA disconnected, 1024x768 ok but connecting Dell 1600FP does not detect modes above 1024x768, is this just a problem with this monitor? logoff, gdm now shows clone screen at 1600x1200. logon now only 1600x1200 on VGA and LVDS is off.
+
{{NOTE|With recent distributions which use KMS, the virtual size may be larger such as on the Intel 945 where the virtual size is now 4096x4096. However going beyond 2048x2048 still has implications, such as no support for 3D graphics (Compiz) and no Xvideo}}
from various mailing lists etc
+
 +
[[Image:Intel-DualHead.png|monitor windows must fit within the virtual screen]]
  
'''2007-08-19:'''
+
=== Output port names ===
Add a '''Virtual xdim ydim''' to your ''Subsection Display'', ''Depth 24'' section just below the ''Modes'' line. Choose xdim and ydim so that the lagest non-overlapping configuration you wish to use fits. In my case this is: 1024x768 (LVDS) + 1280x1024 (VGA) => '''Virtual  2304 1024'''.
 
  
Restart X and run '''xrandr --output VGA --mode 1280x1024 --left-of LVDS'''.
+
'''Intel driver - UMS'''
 +
* '''VGA'''  -  Analog VGA output
 +
* '''LVDS''' - Laptop panel
 +
* '''DP1''' - DisplayPort output
 +
* '''TV'''  - Integrated TV output
 +
* '''TMDS-1''' - First DVI SDVO output
 +
* '''TMDS-2''' - Second DVI SDVO output
 +
The '''SDVO''' and '''DVO TV''' outputs are not supported by the driver at this time.
  
'''2007-08-26'''
+
'''Intel driver - KMS'''
Ubuntu Gutsy Gibbon Tribe 5 release plus some subsequent updates.
+
* '''LVDS1''' - Laptop panel
 +
* '''VGA1''' -  Analog VGA output
 +
* '''DVI1'''  - Digital video output
  
The good news: a [http://www.ubuntu.com/testing/tribe5 Graphical Configuration Tool], bad news: it dosn't work too well. If installing from a tribe 5 CD then this will be found in the menu: 'System: Administration: Screens and Graphics'. If you have been upgrading from earlier releases you may need to install from 'Applications: Add/Remove: System Tools'  
+
'''[[radeon]] driver '''
 +
* '''VGA-0''' - Analog VGA output
 +
* '''LVDS'''  - Laptop panel
 +
* '''S-video'''    - Integrated TV output
 +
* '''DVI-0''' - DVI output
  
[[Image:Ubuntu710ScreenConfig.png|Ubuntu 7.10t5 Screen Config]]
+
=== Note for Gnome users ===
 +
Gnome places the menu bar on screen 0 and thus with the Intel chip and driver Screen 0 (the external VGA monitor) will always be the default display if it is connected. This applies even if the external monitor is switched off but the cable connected: if you have a blank laptop monitor check if you have anything plugged in to the VGA port. Also beware that desktop icons and windows can disappear into the invisible parts of the virtual display. (see diagram below).  If you want the panel(s) to appear by default on a different head, drag it to the head you want it on and GNOME will keep it there.
  
This provides a dialogue to set the default screen, and a secondary screen as either a mirror of screen 1 or an extended screen. At the moment this is far from stable and changing settings causes modifications to the xorg.conf that will cause X to fail. This issue is not confined to the Thinkpad R60e, testing with a Toshiba U300 produces similar results. It also appears to mess with xorg.conf by adding extra screen configs so if things stop working with command line xrandr check the integrity of xorg.conf . Also it appears that the xorg.conf generated by debian with {{cmduser|  sudo dpkg-reconfigure -phigh xserver-xorg}} includes modelines for a Generic Monitor. My post tribe 5 xorg.conf has: (only the [Section "Screen": SubSection "Display": Virtual 2624 2048] has been added by me)
+
The gnome panel can be moved by holding ALT and dragging them to another screen.
  
  Section "Device"
+
=== Note for Ubuntu Gutsy users ===
        Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express
+
There is a Graphical Configuration Tool, ([https://launchpad.net/ubuntu/+source/displayconfig-gtk/0.2+20070731ubuntu1 displayconfig-gtk]) included with {{Ubuntu 7.10}}. At present [https://bugs.launchpad.net/ubuntu/+source/displayconfig-gtk it dosn't work too well]It is found in the menu: 'System: Administration: Screens and Graphics'. As using it will wreck your xorg.conf, I recommend removing it.
Integrated Graphics Controller"
 
        Boardname      "intel"
 
        Busid          "PCI:0:2:0"
 
        Driver          "intel"
 
        Screen  0
 
        Option          "MonitorLayout" "CRT,LFP"
 
        Option          "Clone" "on"
 
        Option          "CloneRefresh"  "60"
 
EndSection
 
Section "Monitor"
 
        Identifier      "Generic Monitor"
 
        Vendorname      "Generic LCD Display"
 
        Modelname      "LCD Panel 1600x1200"
 
        Horizsync      31.5-90
 
        Vertrefresh    60
 
  modeline  "640x480@60" 25.2 640 656 752 800 480 490 492 525 -vsync -hsync
 
  modeline  "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
 
  modeline  "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -vsync -hsync
 
  modeline  "1280x960@60" 102.1 1280 1360 1496 1712 960 961 964 994 -hsync +vsync
 
  modeline  "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
 
  modeline  "1400x1050@60" 122.61 1400 1488 1640 1880 1050 1051 1054 1087 -hsync +vsync
 
  modeline  "1600x1200@60" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
 
  modeline  "1792x1344@60" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
 
  modeline  "1856x1392@60" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync
 
  modeline "1920x1440@60" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync
 
        Gamma  1.0
 
EndSection
 
Section "Screen"
 
        Identifier      "Default Screen"
 
        Device          "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
 
        Monitor        "Generic Monitor"
 
        Defaultdepth    24
 
        SubSection "Display"
 
                Depth  24
 
                Virtual 2624    2048
 
                Modes          "1024x768@60"  "1280x960@60"  "800x600@60"    "1280x1024@60"  "640x480@60"    "1400x1050@60"  "1600x1200@60"  "1792x1344@60"  "1856x1392@60"  "1920x1440@60"
 
        EndSubSection
 
EndSection
 
  
===Notes from xserver-xorg-video-intel.readme ===  
+
== Gleanings ==
 +
=== Notes from xserver-xorg-video-intel.readme ===  
 
'''Known Limitations'''
 
'''Known Limitations'''
 
- No support for "zaphod mode" dualhead.  This is the mode in which two
 
- No support for "zaphod mode" dualhead.  This is the mode in which two
Line 216: Line 319:
 
- Some GM965 systems, such as the Thinkpad T61, probe the TV as being connected
 
- Some GM965 systems, such as the Thinkpad T61, probe the TV as being connected
 
even when no output connector is available.  
 
even when no output connector is available.  
 
  
 
'''Common issues not caused by the driver'''
 
'''Common issues not caused by the driver'''
Line 234: Line 336:
 
API when available for better results.
 
API when available for better results.
  
=== Notes from various sources ===
+
=== Xorg mailing list ===
Virtual size of 2048x2048 is the maximum for the Intel 945. So to configure two non-ovelapping monitors of 1600x1200 and 1024x768 the only option is to stack them verticaly in the virtual pane.
 
 
 
updated Xorg.conf should:
 
 
 
drop dual Device/Screen/Monitor sections from
 
 
 
drop MonitorLayout option and Screen lines from the remaining Device section
 
 
 
drop dual Screen lines from the ServerLayout section
 
 
 
drop RightOf/LeftOf indication to the remaining Screen line in ServerLayout section
 
 
 
add a "Virtual 2048 2048" line in SubSection "Display" to create a large virtual screen where physical monitor will be placed (note that boards < i945 will disable DRI if you use more than 2048 in one direction)
 
 
 
use xrandr --output VGA --right-of LVDS to place you VGA screen on the right of your internal LCD (see xrandr manpage for details)
 
 
 
 
[http://lists.freedesktop.org/archives/xorg/2007-June/025469.html FreeDesktop.org 2007-June 025469]
 
[http://lists.freedesktop.org/archives/xorg/2007-June/025469.html FreeDesktop.org 2007-June 025469]
 
[http://lists.freedesktop.org/archives/xorg/2007-June/025484.html FreeDesktop.org 2007-June 025484]
 
[http://lists.freedesktop.org/archives/xorg/2007-June/025484.html FreeDesktop.org 2007-June 025484]
Line 274: Line 360:
  
 
The Gnome menu bar lands on Xinerama Screen 0 at this
 
The Gnome menu bar lands on Xinerama Screen 0 at this
point, which isn't currently something that you can set through RandR. On Intel the allocation to Screen 0 is determined by CRTC order and LVDS only runs on screen 1.
+
point, which isn't currently something that you can set through RandR. On Intel the allocation to Screen 0 is determined by CRTC order and LVDS only runs on screen 1.
  
 
[http://lists.freedesktop.org/archives/xorg/2007-June/026053.html FreeDesktop.org 2007-June 026053]
 
[http://lists.freedesktop.org/archives/xorg/2007-June/026053.html FreeDesktop.org 2007-June 026053]
  
 +
[http://lists.freedesktop.org/archives/xorg/2007-August/027616.html Blanking of external screen when using xrandr]
  
 +
It's checking to see if you have anything connected to the TV output.
 +
To do that, it needs to temporarily unplug the VGA.
 +
  You can avoid this by ignoring the TV output
 +
    Section "Monitor"
 +
        Identifier      "TV"
 +
        Option          "Ignore" "True"
 +
    EndSection
 +
    Section "Device"
 +
      Option      "monitor-TV" "TV"
 +
    EndSection
 +
If your machine cannot ever have a TV adapter (even with a docking station),
 +
we can add a quirk to the driver to never look at the TV output.  That requires
 +
the pci subsystem values (from lspci -n -v) to plug into the quirk table.
  
  VGA    Analog VGA output
+
[http://lists.freedesktop.org/archives/xorg/2007-August/027632.html default for 'Virtual']
  LVDS  Laptop panel
+
> Version 2.1.1-0ubuntu2 seems to set the default Virtual size (maximum
  TV    Integrated TV output
+
  > screen size) to 1920 x 1920, if there is no entry in xorg.conf. I take
  TMDS-1 First DVI SDVO output
+
  > it the maximum screen size for the i915 chipset family is 2048 x 2048,
  TMDS-2 Second DVI SDVO output
+
  > so why not have it at that? This would make dualscreen setups a bit easier.
  SDVO and DVO TV outputs are not supported by the driver at this time.
+
   The default settings is found by taking the largest resolution in either
 
+
  x or y dimension and making a square from that. This allows for easy
== Questions ==
+
  rotation should you want to do so.
 
+
   I believe you should be able to do dual screen up to 8192x8192, though
'''1'''. What if xrandr -q doesn't report multiple screens and both the LVDS and TMDS-1 are stuck in cloned mode?
+
  only through two monitors (Only two pipes are available for output), but
 
+
  that 3D acceleration is only supported up to 2048x2048. Thus as soon as
{{cmduser| xrandr -q }}
+
you set your virtual size above 2048x2048, you lose 3D acceleration.
 
+
  The current driver cannot reallocate the frame buffer, so whatever size
  SZ:    Pixels          Physical      Refresh
+
you start with is the maximum the screen can ever become, and that this
  0  1400 x 1050  ( 520mm x 520mm )  *60  
+
amount of physical memory is tied down for the whole X server run.
1  1024 x 768   ( 520mm x 520mm )  60 
 
  2    800 x 600    ( 520mm x 520mm )  60  
 
3    640 x 480   ( 520mm x 520mm )  60 
 
  4  2048 x 2048  ( 520mm x 520mm )   60  
 
Current rotation - normal
 
Current reflection - none
 
Rotations possible - normal left inverted right
 
Reflections possible - none
 
  
 +
[http://lists.freedesktop.org/archives/xorg/2007-August/027507.html Primary output for Laptop + external screen]
 +
>the desired behavior of the video
 +
> drivers in typical laptop situations with an internal display and an
 +
> external screen attached (extending the desktop).
 +
>
 +
> Currently for example the intel driver uses the external screen as the
 +
> primary output. It is listed first with xrandr. I'm not sure if this is
 +
> intentional or just coincidence.
 +
    It's coincidence -- the laptop hardware has two crtcs, and the LVDS can
 +
only be driven by the second.
 +
    Note that RandR doesn't really want the order to be significant; it
 +
would be better if the desktop environment knew about outputs and could
 +
refer to a specific output as 'primary' or 'holds toolbar' or whatever.
  
'''2''' Is the 2048x2048 a unfixable limitation for 945GM chipsets or can a BIOs patch help?
+
[mailto:gekkoman@illimitable.com &nbsp;] Uncovered a workaround for black and white TV-out "known limitation" listed above on a intel 945GM chipset running i810-2.1.1 driver and xrandr-1.2.2. Get TV running in black and white. Then run command.
  
Yes this is practically unfixable for 945GM. As subsequent Intel chipsets do not have this problem it is unlikely that the work-arounds required in the intel driver will be implemented. See discussions on xorg mailing list noted above.
+
xrandr --output TV --set TV_FORMAT PAL; xrandr --output TV --mode 1024x768
  
'''3''' What is meant by "to configure two non-ovelapping monitors of 1600x1200 and 1024x768 the only option is to stack them verticaly in the virtual pane.
+
substitute TV_FORMAT and mode as required.  Note that the command "xrandr --output TV --set TV_FORMAT PAL" gives an error but appears to work as the subsequent mode change converts screen to colour.
By my math 1600+1024>2048 so does't this violate the 2048x2048 limitation?  What happens when the limitation is violated? (Error message, ignores setting, something else?)
 
  
1600 wide plus 1200 wide is 2800. Therefore if you want your external monitor to the right or left of the laptop screen and do not want windows on one screen to also appear in part on the other screen the total width of the virtual screen needs to be 2800. If the laptop screen is to the top or bottom of the extenal screen (move mouse off top/bottom of one screen to move to the other) then we need 1200 plus 768, so a virtual screen of 1968 x 1600 will do. The problem with this arrangement is to get the Gnome menu bar in a useable position.
+
=== Notes for X31, X32, T30 / Radeon 7000, Radeon 7500 users ===
 +
{{X31}} and {{X32}} have an [[ATI Mobility Radeon 7000]] with only 16MB RAM. This is not enough for big screens and DRI. Neither with [[radeon]]-default virtual size of 2048x1200, nor with a customized virtual of 2304x1024 (for one 1024x768 and one 1280x1024 screen). But this only applies for 24-bit color depth. Using only 16-bit and DRI works fine with the big virtual screen.
  
 +
If you really want 24-bit depth, and do not need a bigger screen as your LCD, try setting Virtual to "1024 768", this will enable DRI in 24-bit too, but you won't be able to extend your screen anymore (well, clone will still work though).
  
'''4''' Shouldn't there be a way to get the version number of xrandr itself?  My ~# xrandr --version command reports "Server reports RandR version 1.2" but for me commands such as "xrandr --output LVDS --auto" return the usage and the -q option looks different.
+
==== Further Note ====
 +
My {{T30}} (Radeon 7500) with the Xorg radeonhd driver version 1.2.1-1 (from Debian unstable) reports the following:<code><pre>
 +
(II) RADEON(0): Detected total video RAM=16384K, accessible=65536K (PCI BAR=131072K)
 +
(--) RADEON(0): Mapped VideoRAM: 16384 kByte (64 bit DDR SDRAM)
 +
(II) RADEON(0): Color tiling enabled by default
 +
(WW) RADEON(0): Requested desktop size exceeds surface limts for tiling, ColorTiling disabled
 +
(II) RADEON(0): Max desktop size set to 2304x1024
 +
</pre></code>
 +
I don't understand exactly what this means, but it '''does''' support the entire large desktop at 24 bit depth, even though the card reports only 16M "total video RAM".
  
 
== References ==
 
== References ==
  
Version 7.10 (Gutsy) of Ubuntu includes support for Xorg 7.3 with RandR 1.2 [https://wiki.ubuntu.com/Xorg7.3Integration Xorg 7.3]
+
* XRandR 1.2
 
+
** [http://gitweb.freedesktop.org/?p=xorg/proto/randrproto.git;f=randrproto.txt;a=blob RandR 1.2 protocol specifications] - this defines the model and terminology
For versions of Ubuntu prior to 7.10 see [[Installing Ubuntu on a ThinkPad R60e]]  for an Xorg.conf suitable for use with more than one screen
+
** [http://wiki.x.org/wiki/XDC2007Notes#head-11895d48723a8d0308571bec8829b7cc3ef87d7b In Xorg Developer Conference 2007]
 
+
** [http://burtonini.com/blog/computers/randr-2007-02-06-17-50 tutorial blog post]
RandR extension is currently under development  see: [http://wiki.x.org/wiki/XDC2007Notes#head-11895d48723a8d0308571bec8829b7cc3ef87d7b Xorg Developer Conference 2007] and [http://burtonini.com/blog/computers/randr-2007-02-06-17-50 X RandR v1.2].
 
 
 
[http://lists.freedesktop.org/mailman/listinfo/xorg FreeDesktop.org mailing list]
 
 
 
[http://lists.freedesktop.org/archives/xorg/ FreeDesktop.org Xorg archive]
 
 
 
Useful page to supplement the minimal documentation  [http://wiki.x.org/wiki/Development/Documentation/HowVideoCardsWork How video cards work]
 
 
 
[http://wiki.debian.org/XStrikeForce/ReleaseNotes xserver-xorg-core  and xserver-xorg-video-intel might cause some trouble but also brings nice features.]
 
 
 
[http://andrew.mcmillan.net.nz/taxonomy/term/18 Seamless Monitor Hotplugging with X Windows]
 
 
 
[https://launchpad.net/ubuntu/+source/xserver-xorg-video-intel/ Ubuntu source]
 
 
 
[http://www.intellinuxgraphics.org/  Linux Graphics Drivers from Intel]
 
  
[http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-ati.git;a=shortlog;h=randr-1.2 ATI Radeon randr-1.2 git tree]
+
* Ubuntu
 +
** Version 7.10 (Gutsy) of Ubuntu includes support for Xorg 7.3 with RandR 1.2 [https://wiki.ubuntu.com/Xorg7.3Integration Xorg 7.3]
 +
** [[Installing Ubuntu on a ThinkPad R60e]] for a revised and more specific version of this page
 +
** [https://launchpad.net/ubuntu/+source/xserver-xorg-video-intel/ Ubuntu source for Intel]
 +
** [https://bugs.launchpad.net/xserver-xorg-driver-ati/+bug/148408 gutsy version of xserver-xorg-ati has some major problems on ATI Radeon] for ([[:Category:X Series]]) and possibly others.  The solution is to downgrade to the [https://launchpad.net/ubuntu/feisty/i386/xserver-xorg-video-ati/1:6.6.3-2ubuntu6 feisty version]
  
[http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-intel.git;a=summary Intel xorg git tree]
+
* X.org
 +
** [http://lists.freedesktop.org/mailman/listinfo/xorg FreeDesktop.org mailing list]
 +
** [http://lists.freedesktop.org/archives/xorg/ FreeDesktop.org Xorg archive]
  
[http://zdzichubg.jogger.pl/2007/05/07/xrandr-1-2-sweetness/ blog post] with xrandr-1.2 commands and photos. Narrative is in polish.
+
* Useful page to supplement the minimal documentation  [http://wiki.x.org/wiki/Development/Documentation/HowVideoCardsWork How video cards work]
 +
* [http://wiki.debian.org/XStrikeForce/ReleaseNotes xserver-xorg-core  and xserver-xorg-video-intel might cause some trouble but also brings nice features.]
 +
* [http://andrew.mcmillan.net.nz/taxonomy/term/18 Seamless Monitor Hotplugging with X Windows]
 +
* [http://www.intellinuxgraphics.org/  Linux Graphics Drivers from Intel]
 +
* [http://zdzichubg.jogger.pl/2007/05/07/xrandr-1-2-sweetness/ blog post] with xrandr-1.2 commands and photos. Narrative is in polish.

Latest revision as of 22:25, 29 June 2013

Overview

X RandR is used to configure which display ports are enabled (e.g. LCD, VGA and DVI), and to configure display modes and properties such as orientation, reflection and DPI.

This is the simplest and most powerful way to get multi-monitor systems working using recent versions of Linux such as Ubuntu 7.10 and Fedora 8 with graphics chipsets such as the Intel 945GM/GMS and ATI Radeon found in Thinkpads.

xrandr is the command line interface to the RandR X extension. As usual with X, good documentation is hard to find; first try the following commands:

  • $ xrandr --help
  • $ man xrandr
  • for Intel graphics: $ man intel
  • for ATI graphics: $ man radeon

The rest of this page refers to a laptop with a built in 1024x768 pixel screen and an external 1600x1200 VGA monitor. Simply replace the relevant numbers with your own system specifications and all should work fine.

Supported drivers

Ubuntu 7.10 Gutsy Gibbon

xorg.conf

Recent versions of xorg.conf intended for use with xrandr 1.2 considerably simplify the video section of the configuration. If you upgrading from an earlier version you may find your existing xorg.conf works against the effective deployment of xrandr. So it is best to start with a new Xorg configuration.

An updated Xorg.conf should:

  • omit dual Device/Screen/Monitor sections
  • omit MonitorLayout option and Screen lines from the remaining Device section
  • omit dual Screen lines from the ServerLayout section
  • omit RightOf/LeftOf indication to the remaining Screen line in ServerLayout section
  • add a "Virtual 2048 2048" line in SubSection "Display" to create a large virtual screen

To create a new xorg.conf for Ubuntu and other Debian based distributions, connect the external display to the VGA port, turn on that display, and run

   $ sudo dpkg-reconfigure -phigh xserver-xorg

Since Ubuntu 9.04 and later Debian releases the above command doesn't actually do anything and to create a new xorg.conf file you need to stop X and then type

   $ sudo X -configure

which will create an xorg.conf.new file in the home folder of the user you are logged in (or /root if logged in as root)

The resulting /etc/X11/xorg.conf should include something like

   Section "Device"
       Identifier	"Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
       Driver		"intel"
       BusID		"PCI:0:2:0"
       # ADD THIS IF YOUR LAPTOP DOES NOT HAVE A TV CONNECTOR or DOCKING STATION 
       Option          "monitor-TV"   "TV" 
   EndSection
   Section "Monitor"
       Identifier	"Generic Monitor"
       Option		"DPMS"
   EndSection
   # ADD THIS IF YOUR LAPTOP DOES NOT HAVE A TV CONNECTOR or DOCKING STATION 
   Section "Monitor" 
       Identifier      "TV" 
       Option          "Ignore" "True" 
   EndSection 
   Section "Screen"
       Identifier	"Default Screen"
       Device		"Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
       Monitor		"Generic Monitor"
       DefaultDepth	24
   
       SubSection "Display"
           Depth		24
           Modes		"1600x1200" "1280x1024" "1024x768" "800x600" "640x480"
           # ADD A VIRTUAL LINE TO PROVIDE FOR THE LARGEST SCREENS YOU WILL HOTPLUG 
           Virtual              2048 2048 
       EndSubSection
   EndSection
   Section "ServerLayout"
       Identifier	"Default Layout"
       Screen		"Default Screen"
       InputDevice	"Generic Keyboard"
       InputDevice	"Configured Mouse"
       InputDevice     "stylus"	"SendCoreEvents"
       InputDevice     "cursor"	"SendCoreEvents"
       InputDevice     "eraser"	"SendCoreEvents"
       InputDevice	"Synaptics Touchpad"
   EndSection


Just a hint: If you want to use TV-out but not VGA for example, you should change these sections:

Section "Device"
        Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller"
        Driver          "intel"
        BusID           "PCI:0:2:0"
        Option          "monitor-VGA"  "VGA"
        Option          "monitor-TV"   "TV"
        Option          "monitor-LVCD" "LVCD"
EndSection

Section "Monitor"
        Identifier      "VGA"
        Option "Ignore" "true"
EndSection

Section "Monitor"
        Identifier      "LVCD"
        Option          "DPMS"
EndSection

Section "Monitor"
        Identifier      "TV"
        Option  "Ignore" "false"
EndSection


After creating a clean xorg.conf, restart X and logon.

You may find you have a display only on the external VGA screen at its default max resolution; do not worry - xrandr can fix this.

Using $ xrandr

First discover what we have

Open a terminal window to use the command line: 'Applications:Accessories:Terminal'

Hint:
First look at the 'help' and 'man' pages.
$ xrandr --help
$ man xrandr

To find what version of xrandr is running, type the following command:

$  xrandr -v
   Server reports RandR version 1.2

To query what screens are connected, type the following: (The output shown indicates nothing is connected to the VGA port.)

$  xrandr -q 
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
VGA disconnected (normal left inverted right)
 LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
   1024x768       60.0*+   50.0  
   800x600        60.3  
   640x480        60.0     59.9  
TV disconnected (normal left inverted right)

If you see the 'TV disconnected' line but have neither TV connector nor docking station (eg Thinkpad R60e) then add to the Monitor and Device sections of xorg.conf as noted above. This will prevent the external (VGA) flashing off for a few seconds every time xrandr is used. (Newer versions of the intel driver may fix this.)

The same command as above, but with the VGA monitor plugged in and powered off, should give something like the following output: (The VGA monitor is now shown as 'connected'.)

$  xrandr -q 
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 1920 x 1440
VGA connected (normal left inverted right)
   1920x1440@60   60.0  
   1920x1440      60.0  
   1600x1200@60   60.0  
   1600x1200      60.0  
   1280x960       60.0  
   640x480@60     60.0  
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
   1024x768       60.0*+   50.0  
   800x600        60.3  
   640x480        60.0     59.9  
TV disconnected (normal left inverted right)

Powering on the VGA monitor and issuing the same command again will give the following output: (The size and position of the VGA output within the virtual screen is now shown.)

$  xrandr -q 
Screen 0: minimum 320 x 200, current 2624 x 1200, maximum 2624 x 2048
VGA connected 1600x1200+1024+0 (normal left inverted right) 367mm x 275mm
   1600x1200      60.0*+
   1920x1440@60   60.0  
   1600x1200@60   60.0  
   640x480@60     60.0  
   640x480        60.0  
LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm
   1024x768       60.0*+   50.0  
   800x600        60.3  
   640x480        60.0     59.9  
TV disconnected (normal left inverted right)

For bug reporting and diagnosis use xrandr with the verbose option:

$  xrandr --verbose

Using xrandr to do useful things

In general the commands will specify the output name and either --off or --auto. In the examples here the external screen is named VGA, as used by the Intel driver, with an ATI card the name will probably be VGA-0. In general use $ xrandr -q to discover the appropriate output names for your configuration. The --auto option will select the preferred resolution for each output, this is starred(*) in the $ xrandr -q listing and is normally the best resolution available. It is also possible to set a particular mode eg --mode 1024x768.

First clone the two screens, (the smaller screen will display the top left portion of the virtual screen)

$  xrandr --output LVDS --auto --output VGA --auto --same-as LVDS

To turn off the VGA monitor.

$  xrandr  --output VGA --off 

Note: This apparently reboots X !!! - cf. [1]

To turn the VGA monitor back on, with its viewport to the right of the laptop monitor:

$  xrandr --output VGA --auto --right-of LVDS

This will probably give an error message similar to:

   xrandr: screen cannot be larger than 1600x1600 (desired size 2624x1200)

This can be fixed by editing xorg.conf and changing the virtual line (see example above) to something like:

   Virtual 2624 1200

Note that the maximum supported size of the virtual desktop for the Intel 945GM series of chipset with 3D acceleration enabled, is 2048x2048. The virtual screen can be larger but DRI will be disabled. This may matter if you like games and compiz desktop effects, or if you want Google Earth to display in better than geological time. Obviously the larger the virtual desktop, the more graphics memory is used. So for good performance with a shared graphics system such as Intel the Virtual should be no larger than necessary.

It is possible to set screen locations as --left-of, --right-of, --above and --below. Assuming displays sizes of 1024x768 and 1200x1600:

$  xrandr --output LVDS --auto --output VGA --auto --right-of LVDS
and
$  xrandr --output LVDS --mode 1024x768 --pos 0x0 --output VGA  --mode 1600x1200 --pos 1024x0

are equivalent. Both will place the external monitor to the right of the laptop display within the virtual screen.

If the Virtual size is only 2048 wide the above command will fail as the combined width of the two displays exceeds the maximum virtual size. However it is possible to have overlap the display viewports. So to fit within the 2048 limit:

$  xrandr --output VGA --mode 1024x768 --pos 0x0 --output VGA  --mode 1600x1200 --pos 448x0

Now automate it on login

To configure xrandr automatically during the first login, save this script to your computer as /etc/X11/Xsession.d/45custom_xrandr-settings:

# If an external monitor is connected, place it with xrandr
# External output may be "VGA" or "VGA-0" or "DVI-0" or "TMDS-1"
EXTERNAL_OUTPUT="VGA"
INTERNAL_OUTPUT="LVDS"
# EXTERNAL_LOCATION may be one of: left, right, above, or below
EXTERNAL_LOCATION="right"

case "$EXTERNAL_LOCATION" in
       left|LEFT)
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               ;;
       right|RIGHT)
               EXTERNAL_LOCATION="--right-of $INTERNAL_OUTPUT"
               ;;
       top|TOP|above|ABOVE)
               EXTERNAL_LOCATION="--above $INTERNAL_OUTPUT"
               ;;
       bottom|BOTTOM|below|BELOW)
               EXTERNAL_LOCATION="--below $INTERNAL_OUTPUT"
               ;;
       *)
               EXTERNAL_LOCATION="--left-of $INTERNAL_OUTPUT"
               ;;
esac

xrandr |grep $EXTERNAL_OUTPUT | grep " connected "
if [ $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION
    # Alternative command in case of trouble:
    # (sleep 2; xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION) &
else
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
fi


When X starts, it will be mirrored across both screens until someone logs in. At that point this script will execute and xrandr will position the external monitor.

Note: On some machines the script above will not work although it seems to be executed correctly (no effect on resolution). In this case, try the commented-out alternative command line.

Sample Fn-F7 script

For further examples of the use of xrandr commands, and scripts to switch the display using the Function key Fn-F7 see Sample Fn-F7 script.

GUIs

Several graphical frontends are available for xrandr (all using GTK):

  • Grandr
  • URandR
  • ARandR
  • Zarfy — A GUI to libxrandr. It presents the user with visual representaion of active displays on an interactive map of the screen memory. Features free postioning, configuration saving, scripting for R&R and an alternate gui for switching between monitors.

It is possible to have Fn-F7 run such a GUI, see Sample Fn-F7 script#Having Fn-F7 run a RandR GUI.

Summing up

xrandr enables dynamic resizing of screens, switching both external and laptop screens on and off, and the applications windows can be dragged from one screen to the other. None of this requires configuring anything special for /etc/X11/xorg.conf.

the Virtual screen

A Virtual line is needed in the 'Display' SubSection of the of xorg.conf; it determines the size of the frame buffer into which the displays must fit. Without it the maximum virtual size will be limited to the size of the largest display that was connected when X was started. The maximum virtual size cannot be changed once X starts so needs to be large enough to accommodate the largest combination of displays you want to hotplug without having to restart X. If it is greater than 2048x2048 and you are using an Intel 945 (or less) chip then DRI is not possible. Making the Virtual size square makes rotation easy. A bigger Virtual requires more memory.

NOTE!
With recent distributions which use KMS, the virtual size may be larger such as on the Intel 945 where the virtual size is now 4096x4096. However going beyond 2048x2048 still has implications, such as no support for 3D graphics (Compiz) and no Xvideo

monitor windows must fit within the virtual screen

Output port names

Intel driver - UMS

  • VGA - Analog VGA output
  • LVDS - Laptop panel
  • DP1 - DisplayPort output
  • TV - Integrated TV output
  • TMDS-1 - First DVI SDVO output
  • TMDS-2 - Second DVI SDVO output

The SDVO and DVO TV outputs are not supported by the driver at this time.

Intel driver - KMS

  • LVDS1 - Laptop panel
  • VGA1 - Analog VGA output
  • DVI1 - Digital video output

radeon driver

  • VGA-0 - Analog VGA output
  • LVDS - Laptop panel
  • S-video - Integrated TV output
  • DVI-0 - DVI output

Note for Gnome users

Gnome places the menu bar on screen 0 and thus with the Intel chip and driver Screen 0 (the external VGA monitor) will always be the default display if it is connected. This applies even if the external monitor is switched off but the cable connected: if you have a blank laptop monitor check if you have anything plugged in to the VGA port. Also beware that desktop icons and windows can disappear into the invisible parts of the virtual display. (see diagram below). If you want the panel(s) to appear by default on a different head, drag it to the head you want it on and GNOME will keep it there.

The gnome panel can be moved by holding ALT and dragging them to another screen.

Note for Ubuntu Gutsy users

There is a Graphical Configuration Tool, (displayconfig-gtk) included with Ubuntu 7.10. At present it dosn't work too well. It is found in the menu: 'System: Administration: Screens and Graphics'. As using it will wreck your xorg.conf, I recommend removing it.

Gleanings

Notes from xserver-xorg-video-intel.readme

Known Limitations - No support for "zaphod mode" dualhead. This is the mode in which two Device sections are placed in the config file, and doesn't support DRI or many other features. Instead, only "MergedFB-style" dualhead is supported. - No support for X Screens larger than 2048 pixels in either direction before the 965. This reflects hardware limitations in the x direction on those older chips, and limits dualhead functionality. It may be possible to extend the limit vertically on these older chips. - i855 XV may cause hangs. This was present in the previous release, and no workaround is known. - SDVO TV-out cards not supported. This should be fixed in the next release. - Gray output with integrated TV-out and PAL TVs. - EXA support unstable on i845. - Some GM965 systems, such as the Thinkpad T61, probe the TV as being connected even when no output connector is available.

Common issues not caused by the driver - Font sizes (DPI) are wrong. Some displays incorrectly report their physical size, which is harmless on most OSes that always assume 96dpi displays. This can be fixed through quirks for specific monitors in the X Server, and the output of xrandr --prop along with a physical measurement of the screen size in a bug report against the server can help get that fixed. - gnome-panel is located in the middle of the screen. gnome-panel places itself within head #0's boundaries, which doesn't work well with a second head covering the same area as head #0 but larger. - Older resolution-changing applications have poor results in multihead systems. Previous extensions such as RandR 1.1 exposed only a single output to client programs, and those requests map poorly to multi-head systems. Currently, those requests map to just one of the outputs in the RandR 1.2 environment, and those applications need to be updated to RandR 1.2 API when available for better results.

Xorg mailing list

FreeDesktop.org 2007-June 025469 FreeDesktop.org 2007-June 025484 FreeDesktop.org 2007-July 026340

the 3D engine has an 11 bit coordinate space at one point making it impossible to draw to areas beyond 2048x2048. At another point, it has a stride limit of 8192 bytes, so you can't even draw to a subset of a larger frame buffer.

One more bit in both of these registers would have solved the problem for pretty much any supportable monitor configuration (the chip can only support two single-channel DVI outputs at the most; 1920 is the widest size supported at single-channel speeds).

For multiple monitors, the driver could allocate multiple frame buffers and step through them one at a time with appropriate clipping. It would be icky, but could be made to work.

Of course, the latest hardware (965G/965GM) has plenty of coordinate space, which does tend to reduce the odds that someone will get excited enough to go fix the driver for older chips.

The Gnome menu bar lands on Xinerama Screen 0 at this point, which isn't currently something that you can set through RandR. On Intel the allocation to Screen 0 is determined by CRTC order and LVDS only runs on screen 1.

FreeDesktop.org 2007-June 026053

Blanking of external screen when using xrandr

It's checking to see if you have anything connected to the TV output.
To do that, it needs to temporarily unplug the VGA.
 You can avoid this by ignoring the TV output
   Section "Monitor"
       Identifier      "TV"
       Option          "Ignore" "True"
   EndSection
   Section "Device"
      Option      "monitor-TV" "TV"
   EndSection
If your machine cannot ever have a TV adapter (even with a docking station),
we can add a quirk to the driver to never look at the TV output.  That requires 
the pci subsystem values (from lspci -n -v) to plug into the quirk table.

default for 'Virtual'

> Version 2.1.1-0ubuntu2 seems to set the default Virtual size (maximum 
> screen size) to 1920 x 1920, if there is no entry in xorg.conf. I take 
> it the maximum screen size for the i915 chipset family is 2048 x 2048, 
> so why not have it at that? This would make dualscreen setups a bit easier.
  The default settings is found by taking the largest resolution in either 
x or y dimension and making a square from that. This allows for easy 
rotation should you want to do so.
  I believe you should be able to do dual screen up to 8192x8192, though 
only through two monitors (Only two pipes are available for output), but 
that 3D acceleration is only supported up to 2048x2048. Thus as soon as 
you set your virtual size above 2048x2048, you lose 3D acceleration.
  The current driver cannot reallocate the frame buffer, so whatever size
you start with is the maximum the screen can ever become, and that this
amount of physical memory is tied down for the whole X server run.

Primary output for Laptop + external screen

>the desired behavior of the video 
> drivers in typical laptop situations with an internal display and an 
> external screen attached (extending the desktop).
> 
> Currently for example the intel driver uses the external screen as the 
> primary output. It is listed first with xrandr. I'm not sure if this is 
> intentional or just coincidence.
    It's coincidence -- the laptop hardware has two crtcs, and the LVDS can
only be driven by the second.
    Note that RandR doesn't really want the order to be significant; it
would be better if the desktop environment knew about outputs and could
refer to a specific output as 'primary' or 'holds toolbar' or whatever.

  Uncovered a workaround for black and white TV-out "known limitation" listed above on a intel 945GM chipset running i810-2.1.1 driver and xrandr-1.2.2. Get TV running in black and white. Then run command.

xrandr --output TV --set TV_FORMAT PAL; xrandr --output TV --mode 1024x768

substitute TV_FORMAT and mode as required. Note that the command "xrandr --output TV --set TV_FORMAT PAL" gives an error but appears to work as the subsequent mode change converts screen to colour.

Notes for X31, X32, T30 / Radeon 7000, Radeon 7500 users

X31 and X32 have an ATI Mobility Radeon 7000 with only 16MB RAM. This is not enough for big screens and DRI. Neither with radeon-default virtual size of 2048x1200, nor with a customized virtual of 2304x1024 (for one 1024x768 and one 1280x1024 screen). But this only applies for 24-bit color depth. Using only 16-bit and DRI works fine with the big virtual screen.

If you really want 24-bit depth, and do not need a bigger screen as your LCD, try setting Virtual to "1024 768", this will enable DRI in 24-bit too, but you won't be able to extend your screen anymore (well, clone will still work though).

Further Note

My T30 (Radeon 7500) with the Xorg radeonhd driver version 1.2.1-1 (from Debian unstable) reports the following:

(II) RADEON(0): Detected total video RAM=16384K, accessible=65536K (PCI BAR=131072K)
(--) RADEON(0): Mapped VideoRAM: 16384 kByte (64 bit DDR SDRAM)
(II) RADEON(0): Color tiling enabled by default
(WW) RADEON(0): Requested desktop size exceeds surface limts for tiling, ColorTiling disabled
(II) RADEON(0): Max desktop size set to 2304x1024

I don't understand exactly what this means, but it does support the entire large desktop at 24 bit depth, even though the card reports only 16M "total video RAM".

References