elementary / greeter

Login and Lock Screen greeter for elementary OS and Pantheon, using LightDM
GNU General Public License v3.0
152 stars 39 forks source link

xorg configuration ignored #404

Open quequotion opened 4 years ago

quequotion commented 4 years ago

Prerequisites

I belive #65 may be a subset of this issue. Because the greeter does not acknowledge xorg's configuration files, when a user has configured multiple monitors for xorg, the greeter may guess the wrong one to use as the primary display in addition to guessing the wrong resolution and screen ratio.

Describe the bug

The greeter appears to use a default autoconfiguration, despite the existence of xorg configuration files, and to apply that incorrectly as well. This could result in a number of issues, such as misconfigured xinput devices, in addition to incorrect screen settings.

In my case, xorg's setup appears exactly as it would without configuration files (according to nvidia-settings and xrandr -q) while the actual screen resolution and ratio in use is neither that default autoconfiguration nor the configuration I have specified. If I could take a guess, I suspect pantheon-greeter is coming up with a screen ratio and resolution that is intended to fit across, or average out, the two autoconfigured displays.

It is likely users with only a single monitor would not notice a problem, as the default autoconfiguration is likely to provide at least the correct resolution and screen ratio.

To Reproduce

Steps to reproduce the behavior:

  1. Have multiple monitors
  2. Save their configuration to files in */etc/X11/xorg.conf.d/.conf**
  3. Restart lightdm, configured to use pantheon-greeter
  4. Observe incorrect primary monitor, incorrect resolution, and/or incorrect screen ratio.

Expected behavior

xorg should be configured as it is configured, and not reconfigured agnostically of its configuration files.

Platform Information

/etc/X11/xorg.conf.d/00-keyboard.conf

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "jp"
        Option "XkbModel" "jp106"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

/etc/X11/xorg.conf.d/01-server.conf

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

/etc/X11/xorg.conf.d/02-monitor.conf

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Mitsubishi RDT234WLM"
    HorizSync       31.0 - 82.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

/etc/X11/xorg.conf.d/03-device.conf

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 630"
EndSection

/etc/X11/xorg.conf.d/04-screen.conf

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "DVI-D-0: 1920x1080 +0+0, HDMI-0: 1920x1080 +0+0 {viewportin=1920x1080, viewportout=1820x980+50+50}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Please check what applies: -->

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/88094603-xorg-configuration-ignored?utm_campaign=plugin&utm_content=tracker%2F60068889&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F60068889&utm_medium=issues&utm_source=github).
quequotion commented 4 years ago

Redditor Sadlaughinglad has the same problem with his multimonitor setup, it might explain why leaf444's input configuration was broken upon rebooting, and I suspect the same thing may be the cause of iguano80 and OneForLiberty's tiny greeters on 4k monitors (although 4K support could be its own issue).

Another redditor may have found an angle for a workaround. KRONie mentions a lightdm configuration option, greeter-setup-script which can be used to specify things such as xrandr options.

Is pantheon-greeter expecting something like this to be done / does it make no attempt to read an existing xorg configuration by default in comparison to gtk-greeter which apparently does (or at least, does not override it and reset to defaults)?

Edit: There does not appear to be any no way to get the xrandr executable to read in xorg configuration files, making it rather difficult to work around this by using a script. It seems the assumption is that xorg itself will feed the configuraiton to the RandR extension when initiated. Seems like pantheon-greeter is undoing that by setting its own (default) configuration, although I have not as yet found how it is doing so in the code.

quequotion commented 3 years ago

I have since come to understand that elementary's greeter is attempting to set up the monitor configuration from monitors.xml, which is created--I suppose--by using the Displays plug of switchboard (or Gnome Control Center's Displays panel).

It seems like a whole lot of people didn't get this memo: unless that file exists, or if that file only contains initial, default configuration, elementary's greeter will tell XRandR to configure monitors according to initial defaults, which tend to be egregiously wrong with multi-monitor setups.

The content of the file itself is an entirely undocumented mystery. Fumbling in the dark, I have as yet not found it capable of many intricacies of configuration that one normally relies on Xorg configuration files for (in my case, cloning a screen onto a TV that requires scaling to work around its overscan; doesn't handle input configurations, etc).

It would be very helpful if the greeter checked for Xorg configuration files and allowed them to override monitors.xml--especially in the case that the file does not exist.

Edit: Also super not helpful is that monitors.xml can only be created while using a mutter-based window manager/compositor such as GNOME Shell or Gala. Gnome Control Center flat out refuses to open outside of its native DE; switchboard's Displays plug crashes if it can't find the org.gnome.Mutter.DisplayConfig dbus service. I understand that is not much of a problem if users are not customizing their DE, and use elementary's greeter with Gala.

tintou commented 3 years ago

monitors.xml is created by mutter ( https://gitlab.gnome.org/GNOME/mutter/-/blob/master/src/backends/meta-monitor-config-store.c#L38 )

quequotion commented 3 years ago

At what stage would this file be created for a fresh installation of elementary OS?

tintou commented 3 years ago

I believe that it is created in ${XDG_CONFIG_HOME}/monitors.xml when you manually change the default configuration in Switchboard (or GNOME Control Center). You can configure it for your need and then copy it into one folder of ${XDG_CONFIG_DIRS} to apply it system-wide.

jwillikers commented 3 years ago

This appears to be an issue for my 2010 Macbook where my X configuration fixes the brightness slider having no effect when using the Nvidia proprietary drivers. It appears to work intermittently, sometimes working sometimes not after boot. This is only for a single monitor, though. After suspending the computer the brightness slider never works even if it had been working before suspend.