Bug 82205 - Preferred Mode not selected for primary monitor
Summary: Preferred Mode not selected for primary monitor
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/intel (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-05 17:58 UTC by jugg
Modified: 2014-12-31 22:55 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.0.log (37.81 KB, text/plain)
2014-08-05 17:58 UTC, jugg
no flags Details
Infer VirtualSize from driver modes (1.84 KB, patch)
2014-08-05 18:22 UTC, Chris Wilson
no flags Details | Splinter Review
Reorder outputs for xf86InitialConfiguration() (3.38 KB, patch)
2014-08-09 07:09 UTC, Chris Wilson
no flags Details | Splinter Review

Description jugg 2014-08-05 17:58:20 UTC
Created attachment 104092 [details]
Xorg.0.log

I'm using a build from Git commit gf36b7a4 of the xf86-video-intel driver (running under Archlinux with xorg-server 1.16).

(II) intel(0): Printing probed modes for output eDP1
(II) intel(0): Modeline "1600x900"x60.1  100.40  1600 1648 1680 1792  900 902 907 932 -hsync -vsync (56.0 kHz eP)
<snip>
(II) intel(0): Printing probed modes for output HDMI1
(II) intel(0): Modeline "1920x1200"x60.0  154.00  1920 1968 2000 2080  1200 1203 1209 1235 +hsync -vsync (74.0 kHz eP)
<snip>
(II) intel(0): Using user preference for initial modes
(II) intel(0): Output eDP1 using initial mode 1600x900
(II) intel(0): Output HDMI1 using initial mode 1440x900

[full log attached]

As you can see the initial mode selected for HDMI1 is not the native preferred mode.

In previous versions of the driver (2.99.911 and earlier) I could correct this by setting the HDMI1 Monitor as "Primary":

Section "Monitor"
  Identifier "HDMI1"
  Option "Primary" "true"
  Option "RightOf" "eDP1"
EndSection

In which case it would then select the native preferred mode of the external monitor properly.

This no longer works.

Alternatively, I can force the preferred mode in the Monitor section, but since I connect different monitors from time to time to HDMI1, this is not desirable.

Section "Monitor"
  Identifier "HDMI1"
  Option "RightOf" "eDP1"
  Option "PreferredMode" "1920x1200"
EndSection

So, the behavior I would ultimately prefer is if the preferred mode was auto selected for each monitor and applied respectively whether it was primary or not.  Which I expect means that the Display's Virtual screen resolution must be large enough to accommodate the largest Monitor mode.  Given the text in the manual regarding the Virtual value:

"If this entry is not present, the virtual screen resolution will be set to accommodate all the valid video modes given in the Modes entry"

which seems to indicate that the desired behavior should be the default behavior, assuming the Modes entry is auto populated with the detected modes (which other text says it should be).
Comment 1 Chris Wilson 2014-08-05 18:22:34 UTC
Created attachment 104093 [details] [review]
Infer VirtualSize from driver modes

Check this patch (against Xorg) - I can't remember if this has the effect you describe, but it is closely related so worth testing.
Comment 2 Chris Wilson 2014-08-05 18:23:34 UTC
Aside: at this point, if you have different preferences for different combinations of monitors, it is probably worth investing some time setting up one of the modern display managers that remember settings per combination of monitors.
Comment 3 jugg 2014-08-05 18:53:34 UTC
I'll try the patch out.  In the mean time, if you are interested in more background on this (but based on the previous xorg server and intel driver):

https://bbs.archlinux.org/viewtopic.php?id=183742

Basically, xrandr command line always does what is expected, but xorg does not on startup.  I'm not sure why there should be a difference in behavior.

Thanks.
Comment 4 Chris Wilson 2014-08-05 19:06:19 UTC
Unless I completely override the selection in the driver, this requires patching the xorg server to get the behaviour you desire. You are not alone in asking for a change in the default mode selection.
Comment 5 jugg 2014-08-05 19:55:54 UTC
The patch did not appear to change any behavior.

To clarify the current behavior (with or without this patch).

If I start X without any monitor section config file, both eDP1 and HDMI1 come up in their native resolutions (1600x900 and 1920x1200 respectively) with a virtual display size of 1920x1200, both anchored at 0,0; also HDMI1 is auto set as the primary monitor.

If I add monitor section config file, as simple as:

Section "Monitor"
  Identifier "HDMI1"
  Option "RightOf" "eDP1"
EndSection

Then HDMI1 becomes no longer the primary monitor (rather eDP1 is), and its resolution is set to 1440x900 and the virtual resolution is set to 3040x900.

Up until this point, this is the same behavior is my old (pre-1.16 xorg-server) system installation. With the pre 1.16 xorg and intel driver, if I change the monitor section to be:

Section "Monitor"
  Identifier "HDMI1"
  Option "RightOf" "eDP1"
  Option "Primary" "true"
EndSection

Then HDMI1 stays as the primary monitor, and its resolution is set to the native 1920x1200 and the virtual resolution is 3520x1200.

But now with 1.16 xorg-server and latest intel driver, the addition of Option "Primary" "true", no longer causes the HDMI1 monitor to have its native resolution selected, although with the fix of Bug 82193, it does stay as the Primary monitor.

So, to summarize, previously as long as the HDMI1 external monitor was the primary monitor, then the correct native resolution was selected and the virtual display sized was properly set when the monitors were positioned.  But with the current versions, even with HDMI1 as the primary monitor, its resolution and the virtual resolution is not being properly configured.

Thanks for taking the time to grok all of that.
Comment 6 jugg 2014-08-06 13:01:46 UTC
Another way to put it:

When adding a positioning option to a Monitor section, the primary monitor no longer starts in its native resolution.

For example:

Section "Monitor"
  Identifier "HDMI1"
  Option "Primary" "true"
EndSection

Section "Monitor"
  Identifier "eDP1"
  Option "Primary" "false"
EndSection

At start, both monitors are in their native resolution.

(II) intel(0): Output eDP1 using initial mode 1600x900
(II) intel(0): Output HDMI1 using initial mode 1920x1200

Adding a positioning element (to any monitor, doesn't matter):

Section "Monitor"
  Identifier "HDMI1"
  Option "Primary" "true"
EndSection

Section "Monitor"
  Identifier "eDP1"
  Option "Primary" "false"
  Option "RightOf" "HDMI1"
EndSection

Now, the primary monitor (HDMI1) is no longer in its native resolution.

(II) intel(0): Output eDP1 using initial mode 1600x900
(II) intel(0): Output HDMI1 using initial mode 1440x900

This functioned properly (the primary monitor did not change resolutions when a monitor was positioned) in 1.15 xorg-server and associated intel driver.  This broke with xorg-server 1.16 and associated intel driver.

If, as you inferred, this behavior can not be depended upon, and it is what it is, I'll survive. :)  Thanks for listening.
Comment 7 Chris Wilson 2014-08-08 11:19:10 UTC
(In reply to comment #6)
> Another way to put it:
> 
> When adding a positioning option to a Monitor section, the primary monitor
> no longer starts in its native resolution.

Right, if you do not specify any placement or mode options, then xf86-video-intel does override the usual mode selection algorithm to preserve the current configuration.

The initial mode selection code in the xserver does not take the primary monitor into account for its initial mode selection, nor does it take the preferred modes on each monitor into account
Comment 8 Chris Wilson 2014-08-09 07:09:10 UTC
Created attachment 104326 [details] [review]
Reorder outputs for xf86InitialConfiguration()

Can you please test this patch? It should restore the ordering expected by xf86InitialConfiguration() before fixing it up again.
Comment 9 Chris Wilson 2014-08-10 05:54:22 UTC
Whilst the default algorithm isn't quite what you want,

commit f6e85048b0789162e389ad2b838d417d517d62d9
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat Aug 9 08:02:39 2014 +0100

    sna: Reorder output array to match primary placement for InitialConfiguration
    
    xf86InitialConfiguration() depends upon the order of the outputs for its
    mode selection and expects the Primary output to be listed first.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82205
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

should restore the mode selection (when a user override is present) to as it was before.
Comment 10 jugg 2014-08-17 16:08:25 UTC
Sorry for the delayed reply.  I can confirm the patch and correspondingly latest git code now behave as previously.

Thanks for taking the time to work on this.

You previously said: "You are not alone in asking for a change in the default mode selection."

Is their a place (existing bug report) to follow that request?


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.