Bug 20361

Summary: nouveau - incorrect resolution on an external monitor attached to a laptop
Product: xorg Reporter: Alex Kanavin <ak>
Component: Driver/nouveauAssignee: Nouveau Project <nouveau>
Status: RESOLVED INVALID QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
X log
none
dmesg output
none
X configuration
none
X configuration with virtual keyword none

Description Alex Kanavin 2009-02-27 11:05:23 UTC
Created attachment 23375 [details]
X log

I'm using the nouveau driver and offb shipped with Fedora 10 (xorg-x11-drv-nouveau-0.0.11-1.20090106git133c1a5.fc10.ppc) on my Powerobook G4 12" (NV34M [GeForce FX Go5200]). When an external monitor is connected, incorrect (lower) resolution is used with it (seems to be the same resolution as the one of laptop's built-in LCD screen). X logs, dmesg output and X config attached.
Comment 1 Alex Kanavin 2009-02-27 11:06:09 UTC
Created attachment 23376 [details]
dmesg output
Comment 2 Alex Kanavin 2009-02-27 11:06:46 UTC
Created attachment 23377 [details]
X configuration
Comment 3 Maarten Maathuis 2009-02-27 11:11:22 UTC
Is the monitor attached at X startup?
Comment 4 Alex Kanavin 2009-02-27 11:15:33 UTC
Yes, it is. I'm not trying to hotplug anything yet.
Comment 5 Maarten Maathuis 2009-02-27 11:19:59 UTC
My guess is that the arbitrary choice is made that your lvds size is the
starting size. Which results in a framebuffer which cannot support larger
resolutions.

You'll have to add a virtual line (grep
http://www.thinkwiki.org/wiki/Xorg_RandR_1.2).
Comment 6 Alex Kanavin 2009-02-27 11:32:52 UTC
Adding virtual did not help. I'll attach the new xorg.conf in case I did it wrong.
Comment 7 Alex Kanavin 2009-02-27 11:33:27 UTC
Created attachment 23378 [details]
X configuration with virtual keyword
Comment 8 Maarten Maathuis 2009-02-27 11:36:04 UTC
Tried manually setting the desired resolution (if it isn't doing it automatically in the first place it won't start magically doing something else)?
Comment 9 Alex Kanavin 2009-02-27 11:51:52 UTC
Yep, works great after
[ak@localhost SPECS]$ xrandr --output DVI-I-0 --mode 1920x1200

except I'm seeing slight pixel corruption, but that'd be a separate bug.

Anyway, this doesn't explain the non-sensible default choices - I'm no xrandr guru, but it's supposed to just work, no?
Comment 10 Maarten Maathuis 2009-02-27 11:54:37 UTC
Default choices became better at some point, not sure if xserver 1.5.3 already had them. Dynamic resizing of framebuffer will happen when we have a good memory manager.
Comment 11 Stuart Bennett 2009-02-28 06:09:52 UTC
As Maarten says, this is an xserver feature.  See http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/modes/xf86Crtc.c?h=server-1.5-branch and search for "Using exact sizes for initial modes" as appears in your log just before it picks 1024x768 for both heads.

Looking at the xf86TargetPreferred function (in the same file) that selects this behaviour, it tries to pick the largest preferred mode (an attribute specified in the screen's EDID) where the mode is available on all screens, hence you get 1024x768 as the laptop screen's preferred mode.  This behaviour appears mostly unchanged in master ( http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/modes/xf86Crtc.c ), so if you want it fixed you'll have to file an xserver bug, but I suspect they'd argue it's reasonable and intended behaviour.

Alternatively, before using this method of mode selection, the xserver allows consideration of user-specified preferences, so you could configure it in your xorg.conf (see http://wiki.debian.org/XStrikeForce/HowToRandR12 for details).  Also any DM you use may have a control panel to set this up for you when X starts.
Comment 12 Alex Kanavin 2009-02-28 07:50:17 UTC
I didn't mention this (thought it'd be obvious) but the notebook lid is closed. I think it's reasonable to detect this and not take the internal screen into consideration at all, and just set the external screen to its native resolution. Could it be that the driver somehow incorrectly assumes the internal screen is visible/enabled?
Comment 13 Maarten Maathuis 2009-02-28 09:09:25 UTC
As far as i'm aware we don't know when a lid is open or closed, so we assume it's always on.
Comment 14 Alex Kanavin 2009-02-28 09:29:07 UTC
The lid status is very easy to find out though, for example from hal:

udi = '/org/freedesktop/Hal/devices/pmu_lid'
  button.has_state = true  (bool)
  button.state.value = true  (bool)
  button.type = 'lid'  (string)
  info.addons = {'hald-addon-pmu'} (string list)
  info.capabilities = {'button'} (string list)
  info.category = 'button'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = 'Lid Switch'  (string)
  info.udi = '/org/freedesktop/Hal/devices/pmu_lid'  (string)
  linux.hotplug_type = 6  (0x6)  (int)
  linux.pmu_path = '/proc/pmu/info'  (string)
  linux.pmu_type = 2  (0x2)  (int)

Does X track the lid in any way?
Comment 15 Stuart Bennett 2009-03-11 18:12:59 UTC
(In reply to comment #14)
> Does X track the lid in any way?

I don't believe so.
Comment 16 Alex Kanavin 2009-03-12 04:58:03 UTC
So seems like correctly supporting all scenarios is a distribution's job?

Nouveau is the default driver in upcoming Fedora, so I should probably file this issue with them, if they haven't made the correct tweaks yet. 
Comment 17 Ilia Mirkin 2013-08-18 18:09:37 UTC
It appears that this bug report has laid dormant for quite a while. Sorry we haven't gotten to it. Since we fix bugs all the time, chances are pretty good that your issue has been fixed with the latest software. Please give it a shot. (Linux kernel 3.10.7, xf86-video-nouveau 1.0.9, mesa 9.1.6, or their git versions.) If upgrading to the latest isn't an option for you, your distro's bugzilla is probably the right destination for your bug report.

In an effort to clean up our bug list, we're pre-emptively closing all bugs that haven't seen updates since 2011. If the original issue remains, please make sure to provide fresh info, see http://nouveau.freedesktop.org/wiki/Bugs/ for what we need to see, and re-open this one.

Thanks,

The Nouveau Team

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.