Monday 9 June 2008

U810 Xorg Munging Part 2

XRandR is a valuable feature for laptop and especially tablet users. It handles on-the-fly reconfiguration of Xorg including multiple screens, resolution and orientation changes. This, then is how we get internal/external monitor switching and screen rotation in response to system events (screen swivel etc.) and button presses (Fn A on the U810). Quite how we acquire these non-standard events and presses I will leave till later (if ever!) as these can always be invoked by more conventional methods.

The first thing to do is ensure that the Xorg driver allocates enough screen real-estate to handle multiple monitors. Apparently, the Intel embedded graphics can only handle 2048x2048 pixels with 3D accleration enabled so that's what I'll use - I like my compiz toys!

Open up /etc/X11/xorg.conf in your favourite editor and add the following to each SubSection "Display" within the Section "Screen".

Virtual 2048 2048

Actually, only the 24-bit depth really matters since I'm not likely to use the lower bit depths.

Now, dropping to a shell we can run xrandr and see what it thinks we have...

Screen 0: minimum 320 x 200, current 1024 x 600, maximum 2048 x 2048
VGA disconnected 1024x600+0+0 (normal left inverted right) 0mm x 0mm
1024x600 57.7*
LVDS connected 1024x600+0+0 (normal left inverted right) 0mm x 0mm
1024x600 57.7*+ 60.0 60.0 60.0 60.0
800x600 60.3 60.0 56.2
768x576 60.0
640x480 59.9 60.0
VGA-1 disconnected (normal left inverted right)
TV disconnected (normal left inverted right)
Looks like the VGA output is tied to the screen (which is the LVDS one) and we don't have TV out so let's disable these in xorg.conf. Add the following sections...

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

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

Once we've plugged in an external monitor using the dock or the dongle we can run xrandr and see that the spurious VGA and TV settings have gone. Now we can do things like...

xrandr --output VGA-1 --mode 800x600 --right-of LVDS
xrandr --output VGA-1 --mode 1024x768 --same-as LVDS
xrandr --output VGA-1 --mode 1024x768 --below LVDS

Which gives us, respectively, a long desktop 1824x600 across the two monitors, mirrored outputs (though the U810 screen only shows the top 600 pixels), and a tall desktop 1024x1368. And we can also turn the LVDS off (--output LVDS --off, strangely enough!) and use just the external monitor which gives us the basic mechanism for laptop display switching.

It turns out the LVDS output on Intel graphics is actually the secondary screen so when you plug in an external monitor it becomes the primary screen so KDE puts the toolbar there and OpenOffice Impress needs to be used carefully in dual monitor mode.

Now logically, we should look at the --left, --right and --invert options which allow screen rotation on a tablet PC but unfortunately there is a bug in the current xorg Intel driver that causes screen updates to stop after changing orientation. There is a patch available so hopefully it will make it to the OpenSuSE repositories soon.

No comments: