Xorg RandR 1.2

From ThinkWiki
Revision as of 22:47, 27 August 2007 by Ordonnateur (Talk | contribs)
Jump to: navigation, search
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 set the size, orientation and reflection of the screen display outputs.

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

   $ xrandr --help
   $ man xrandr
   $ man intel

xorg.conf

Start testing with a default configuration. Connect the external display to the VGA port, turn on that display, boot and run (as root)

   # dpkg-reconfigure -phigh xserver-xorg

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"
   EndSection
   Section "Monitor"
       Identifier	"Generic Monitor"
       Option		"DPMS"
   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"
           # BUT ADD A VIRTUAL LINE
           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

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.

Using $ xrandr

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 query what we have (nothing connected to VGA) $ xrandr -v

   Server reports RandR version 1.2
$  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)

connect, but do not power-on the VGA monitor $ 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)

Power-on the VGA $ 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)

$ xrandr --verbose tells us more

$ xrandr --output LVDS --auto gets two screens but both at 1600x1200 cloned

$ xrandr --output LVDS --mode 1024x768 --output VGA --off gets laptop only at 1024x768

$ xrandr --output VGA --right-of LVDS --mode 1600x1200

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

$ xrandr --output VGA --mode 1600x1200 --pos 0x400 creates two screens with the laptop screen at bottom of the 1600x1600 window

$ xrandr --output LVDS --mode 1024x768 --pos 0x400 moves laptop screen to top of window, so both share same top line (which is where I prefer my menu bar)

$ xrandr --output VGA --mode 1600x1200 --pos 0x768

  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.

Next edit xorg.conf and set Virtual 2624 2048

$ xrandr --output VGA --mode 1600x1200 --pos 1024x0

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.


So, the story so far

2007-07-25: 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. 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. from various mailing lists etc

2007-08-19: 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.

2007-08-26 Ubuntu Gutsy Gibbon Tribe 5 release plus some subsequent updates.

The good news: a 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'

Ubuntu 7.10t5 Screen Config

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 $ 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)

Section "Device"
       Identifier      "Intel Corporation Mobile 945GM/GMS, 943/940GML Express 
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

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.

Notes from various sources

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)

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


 VGA    Analog VGA output
 LVDS   Laptop panel
 TV     Integrated TV output
 TMDS-1 First DVI SDVO output
 TMDS-2 Second DVI SDVO output
 SDVO and DVO TV outputs are not supported by the driver at this time.

Questions

1. What if xrandr -q doesn't report multiple screens and both the LVDS and TMDS-1 are stuck in cloned mode?

$ xrandr -q

SZ:    Pixels          Physical       Refresh
0   1400 x 1050   ( 520mm x 520mm )  *60  
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


2 Is the 2048x2048 a unfixable limitation for 945GM chipsets or can a BIOs patch help?

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.

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." 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.


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.

References

Version 7.10 (Gutsy) of Ubuntu includes support for Xorg 7.3 with RandR 1.2 Xorg 7.3

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

RandR extension is currently under development see: Xorg Developer Conference 2007 and X RandR v1.2.

FreeDesktop.org mailing list

FreeDesktop.org Xorg archive

Useful page to supplement the minimal documentation How video cards work

xserver-xorg-core and xserver-xorg-video-intel might cause some trouble but also brings nice features.

Seamless Monitor Hotplugging with X Windows

Ubuntu source

Linux Graphics Drivers from Intel

ATI Radeon randr-1.2 git tree

blog post with xrandr-1.2 commands and photos. Narrative is in polish.