[Print This] By mjhammel ~ February 9th, 2009. Filed under: Acer Aspire 1690i, Fedora, General, Hardware, Intel Driver, Linux, X11.
I’ve noticed a lot of searches on xrandr in my blog stats and have been wondering what the problem is. Xrandr is a command line tool for enabling or disabling multiple display ports on your system as well as setting display resolution and even rotation. You would use it, for example, to enable TV-Out or an external monitor while also setting its relative position from the current display and the resolution to use. The tool is the user end point for the RandR extension to the X.org server.
On my systems I set up a few simple shell scripts to enable specific modes and then disable them when I’m done with that mode. My Acer Aspire laptop, which uses an Intel i915GM chipset, has external VGA and TV-Out ports. The VGA output is used for two purposes. At home I have an external LCD that I use side by side with the laptop monitor to give me extra screen space to work with. At work or when I give presentations at local user group meetings or conferences I use the external VGA port to connect to a projector.
Finding available ports
If you aren’t sure what ports are available you can run xrandr to query the system:
This will show you the display ports that the X server knows about. You must run this and all other xrandr commands from the desktop. You can’t, for example, login through ssh from another machine to view the available ports. This violates X authentication (you can do it if you run ssh -X, possibly, but I’m not going to get into X authentication issues at this point). The output from this command will look something like this:
$ xrandr -q
Screen 0: minimum 320 x 200, current 2560 x 800, maximum 2560 x 2048
VGA connected 1280×768+1280+0 (normal left inverted right x axis y axis) 370mm x 222mm
1280×720 75.0 60.0
1024×768 75.0 72.0 70.1 60.0
800×600 72.2 75.0 60.3 56.2
640×480 75.0 72.8 75.0 66.7 59.9
LVDS connected 1280×800+0+0 (normal left inverted right x axis y axis) 331mm x 207mm
TV disconnected (normal left inverted right x axis y axis)
This tells me that the X server knows about the external VGA port, the laptop’s LCD (LVDS) and a TV-out port. It even knows the TV port has nothing connected to it at the moment. In this output the settings for the VGA port and laptop LCD screen are known because I’m using them right now, meaning I’ve already gone through the process I’m about to describe.
The external LCD configuration is static. The display is made by Westinghouse and has a maximum resolution of 1280×768. The laptop has a maximum display of 1280×800. To enable both displays at their maximum resolution and configured them side by side (so the mouse moves from the laptop on the left to the external LCD on the right:
xrandr –output LVDS –mode 1280×800 –output VGA –mode 1280×768 –right-of LVDS
LVDS is the laptop screen. It gets set first so that the –right-of option will apply to the last –output defined (re: the VGA output). That’s all there is to it. To get back to normal, I disable the external monitor:
xrandr –output VGA –off
xrandr –output LVDS –mode 1280×800 –rotate normal
The rotate option in the second line is there because somtimes I rotate the laptop monitor manually and forget to put it back when I reset the configuration, which leaves me with a single monitor rotated 90 degrees. It’s kinda hard to work that way.
The laptop hardware is interesting in that if the external VGA is plugged in when the laptop boots then only the external monitor displays anything – at least during the boot. Once X gets started then I have a cloned display on both LCDs showing the same thing. This is what I get up to the gdm login screen. Once I login the laptop display becomes the master and the external VGA is not on. To get it back on I run my little script with the above command.
The fact that the external monitor is on to start with but then off once I logged in used to confuse me a little. I used to think I would have to unplug the external monitor every time I rebooted, but that really isn’t the case. Everything is how it should be once I’m logged in through gdm.
Connecting to an external projector is a little different. Many of these will auto-configure using standard resolutions of 800×600, 1024×768 or even higher. Some are smart enough to handle odd resolutions as well. But just because they handle that resolution doesn’t mean they display it very well. My experience has been that 1024×768 is about the best you’ll get without having lots of time to fiddle with the projector – something you don’t often have when giving a presentation.
For most of my presentations I like to create a new user and run the presentation from that user. The reason for this is to avoid accidently falling back to my well tuned desktop or shell configurations when explaining how to do something. From this new users desktop I configure panel launchers under GNOME to run xrandr scripts to enable the external projector. The commands are essentially the same but I fall back to smaller screen sizes on the projector:
xrandr –output LVDS –mode 1280×800 –output VGA –mode 1024×768 –right-of LVDS
The caveat to this one – which unfortunately I stumbled upon right as I was about to give my last presentation – is that OpenOffice didn’t see this as two screens but rather one big screen. Under my own login OpenOffice saw this as two screens. I have yet to determine why this happened. Why this is important comes from how you handle your OpenOffice presentation. With OpenOffice 3 (which comes with Fedora 10) you can have one screen (the external projector) showing the slides while the other screen shows the notes you prepared for each slide. It’s quite slick. It just didn’t work when I gave the presentation, but it worked at home when I rehearsed it.
Note that this may have been that I didn’t have OpenOffice configured properly for the new user to use both screens as independent screens. See what you discover when you don’t depend on your regular login?
The external TV port is an S-Video port. This port is outbound only, meaning that you can use your laptop to display to a TV but you can’t use your TV to display on your laptop. That would be nice, since our big screen TV projector pooped out at christmas. But that’s a story for another time.
Most TVs display video quite well at 640×480 and maybe 800×600. Newer TVs might display higher resolutions, but don’t count it. Higher resolutions are often required to get decent text output on the TV such as on screen displays like in MythTV, but the only way to know what works best is to try it out on your TV. MythTV offers a number of options for setting the size and quality of the text you see in the on-screen guides.
I haven’t used the TV-out port in some time and don’t want to disable the external VGA, drag the laptop downstairs and hook up the S-Video to test it again. If I get around to that sometime soon I’ll post an update on how it’s working.
Left, Right, Top, Bottom
One set of options to xrandr that is important are the options that position a second display relative to the first. You can specify positions left, right, above and below (as opposed to top and bottom) for the second display. This becomes important for configurations like mine. I currently have the external VGA set left-of the laptop LCD so I can drag my mouse side to side. The two screens function as one large screen for me.
However, this configuration also forces me to disable acceleration features in the X.org intel driver because the combined width of the two displays is large than 2048, and 2048 is the maximum I can use and still utilize acceleration features of the driver. I’ve opted to disable those features in order to get the full 2560 width (1280 for the LCD, 1280 for the external VGA) in a virtual space. Virtual is meaningful to the driver but to the end user it’s still one big screen spread across two monitors.
How you configure your monitors (left, right, etc.) may also determine some of the features you’ll be able to use. This is known to be an issue on Intel chips prior to the i945GM, I believe. Newer model chips (higher version number) are not limited by this and can still provide acceleration at the size screens I’m using.
There are a lot of other things you can do with xrandr but this covers the basic use most home users will require. If you have questions on the other options, post a comment. I’ll see what I can find out for you.