Comment 2 for bug 1060365

Revision history for this message
Jacob Beck (beckjake) wrote :

A bit of debugging work I did to try to figure out what the deal is below.

The list of displays is generated by xrandr.core.Screen, specifically the 'outputs' dict generated in Screen._load_outputs. I'm reasonably proficient with python but I don't know anything about xrandr, so I naively tried replacing all calls in Screen to self.outputs.values() and self.outputs.keys() with self.outputs_values() and self.outputs_keys(), respectively. They work like this:

def outputs_values(self):
  olist = []
  for name in self.outputs.keys():
    if name.startswith('LVDS'): #internal laptop connector
      olist.insert(0, self.outputs[name])
    else:
      olist.append(self.outputs[name])
    return olist

outputs_keys follows the same principle but with keys instead of values.

When I do this, I get the right output order with "./disper.py -l" and "./disper.py --displays=VGA-0,DP-2 -e" works like it always did. But "./disper.py -s" throws an exception that begins at Screen.apply_output_config() on the 'raise RRError' line. It's right below a FIXME comment but I doubt that's the issue.

Stepping through the loading code, it appears that the LVDS-0 interface doesn't, in fact, have a crtc set. I don't know nearly enough about xrandr to understand why that would be. However, it looks like the code that sets that functionality involves querying libXrandr.so.2 directly, in Screen._load_outputs():

xrroutputinfo = goi(self._display, self_resources, o[i])
output = Output(xrroutputinfo, o[i], self)
crtc = self.get_crtc_by_xid(output.get_crtc()).

Some investigation via pdb reveals the following: output.get_crtc() returns 0 for 'LVDS-0' and so self.get_crtc_by_xid() returns None when I check it in the debugger in LVDS-0's part of the loop. The other two displays return >0 values and self._get_crtc_by_xid() returns something. I considered injecting my own values into there from the debugger or via a similar trick to the outputs_keys and outputs_values, but I don't think that's really going to help.

I hope all that helps you out a little, even if it just ends up being a WONTFIX or nVidia driver bug.