[ltp] x hang switching screens using xrandr

Phil Shotton linux-thinkpad@linux-thinkpad.org
Tue, 30 Dec 2008 09:48:53 +0000


I regularly switch my laptop between twin external monitors (work) and 
single external with laptop LCD (home), and wrote two scripts to switch 
between the two using xrandr (having suspended/resumed):

home.sh
 xrandr --output VGA-0 --auto
 xrandr --output DVI-0 --off
 xrandr --output LVDS --auto
 xrandr --output VGA-0 --auto --right-of LVDS

work.sh
 xrandr --output DVI-0 --auto
 xrandr --output VGA-0 --auto
 xrandr --output LVDS --off
 xrandr --output DVI-0 --auto
 xrandr --output VGA-0 --auto --left-of DVI-0

These used to work fine with Ubuntu Hardy, with the latest radeon 
drivers from git. Now I'm running Ubuntu 8.10 with the standard distro x 
support which works really nicely, except about 30% of the time when 
switching from home to work the screen hangs. Today I managed a bit more 
investigation.

When running work.sh, the second xrandr call reports:
    X Error pof failed request: BadMatch (invalid parameter attributes)
       Major opcode of failed request: 153 (RANDR)
       Minor opcode of failed request: 21 ()
       Serial number of failed request: 18
       Current serial number in output stream: 18

The rest of the xrandr calls in the script execute, but the last one 
appears to hang. At that stage both external monitors are displaying but 
in clone mode, the laptop screen is disabled, the mouse moves and 
keyboard is scanned, but I'm unable to do anything. I can't select a 
different window, non of the panel icons responds, the cpu monitor is 
frozen.

I can switch to a virtual terminal and back to X. I tried running strace 
on various bits of the X system from the vt. The X server appeared to be 
behaving normally, but when I ran strace on the x-session-manager it 
appeared to be hung. Output was something like:
    thread 17095 restart_syscall(... unfinished)
    thread 17241 read(19,

(the last line really was truncated as shown).
Trying to exit using control-c, strace reported detach from 17095 but 
failed to detach from 17241.
Back to X, I killed the X-server with ctrl-alt-backspace. Screens 
blanked, but x did not restart. Back to the vt, found the 
x-session-manager was still running. kill did not kill it, but kill -9 
did, and gdm then kicked in and restarted the x server.

So it looks like sometimes xrandr does somethink that hangs up 
x-session-manager. Any ideas?

Machine is T60p, running stock kernel 2.6.27-9-generic, using radeon 
v6.9.0 with X server 1.5.2 (all stock from Ubuntu distro).
Video is ATI Technologies Inc M56GL [Mobility FireGL V5250]

Thanks
Phil