randr 1.2: mode and display switching for Intel graphics chipsets

Wow, I'm on a roll today! After getting VirtualBox going earlier, I came across a blog post from Ross Burton. He and I have been in the same situation for a while. We both have laptops with Intel chipsets that we use regularly with external displays. For both of us, our external display has a different (larger) resolution than the internal display. We want to be able to switch from one display to the other, have the desktop resize appropriately, and carry on using the system. Seems simple enough, but with current stable X.org stuff it's actually impossible. It's not really capable of detecting the available modes for more than one connected display. xrandr will only ever give you the correct mode for one of the displays; if you try and switch to the other and use xrandr to resize the display appropriately, the correct mode just won't be available. However, the bleeding edge code is very different. Keith Packard is currently implementing a new version of the randr stuff, 1.2, which is able to detect all connected displays and the resolutions of which they're capable at all times. It's fine with you connecting and disconnecting monitors, and it will be trivial to write daemons and tray applets etc which will be able to do pretty much whatever you like for any number of connected displays, change status on plugging / removal of a display, etc. For now, all there is is the new version of the command line tool xrandr, but it's good enough for me. After seeing Ross' post I went off and built all the mentioned stuff directly from tarballs, and...it didn't work. X wouldn't start as user due to privilege issues (missing some patches from our x11-server RPM package), and starting it as root, there was a problem with libdrm. So I decided I'd go another route - rebuild the Cooker SRPMs with the appropriate code. This seemed a bit ambitious as I've never really built modified packages before and the X server didn't exactly seem an easy place to start, but what the hell. I know just enough from doing straight rebuilds and looking inside .src.rpms to get me in trouble, so I went ahead, figuring out the rest of the stuff as I went along. Basically it came down to installing the .src.rpms, replacing the source tarballs with tarred up versions of the git snapshots for all the randr 1.2 stuff, fixing a few things (had to remove a patch, change some file references etc), adding changelog entries and bumping the release versions. To my frank shock and amazement, this all worked first time: I got each RPM built and installed, restarted X, ran xrandr, and lo and behold: [adamw@lenovo ~]$ xrandr Screen 0: minimum 320 x 240, current 1680 x 1050, maximum 1680 x 1200 VGA connected 1680x1050+0+0 (normal left inverted right) 433mm x 271mm ... LVDS connected 1280x800+0+0 (normal left inverted right) 261mm x 163mm Using the appropriate xrandr commands, I can now switch between my two displays easily without restarting X. It's brilliant, it'll make it much easier to just wander around the house when the feeling takes me, or to take my laptop out with me. I won't be submitting the packages to Cooker as, apart from the fact they're slightly hacky (I couldn't figure out how to do pre-release version tags based on dates, as is the policy, so I just pretended everything was 1.2.0 final, and some other little things), they're useless to anyone who DOESN'T have an Intel chipset. In fact they're probably harmful, as I don't think xrandr 1.2 will work at all - even with restricted functionality - on any other chipset. But I'm happy to provide them for anyone with an Intel chipset who wants to take a look. Obviously no guarantee they won't blow up in your face, but they work here. The binaries are for Cooker, I can provide .src.rpms for anyone on 2007.0, not sure if they'd build clean there though.

Comments

No comments.