Extended Brain Storage

X.Org: Incorrect Screen Resolution with LightDM

Posted on May 2, 2019

Several tips and tricks to manually configure a missing resolution option that the X Window System (X11, or simply X) would normally use, but for some reason (e.g. an unreadable EDID file) it does not...

Introduction

The solution was tested in Artix Linux running the X.Org Server 1.20 and LightDM 1.28, which is a lightweight cross-desktop display manager, which supports various display technologies (X, Mir, Wayland ...)

The problem is that the X.org server does not detect the highest possible resolution the graphic card can use as well as the monitor can display:

$ grep "Not using" /var/log/Xorg.0.log
[    22.692] (II) modeset(0): Not using default mode "1920x1080" (bad mode clock/interlace/doublescan)

Testing Supported Screen Resolutions

After starting the X Window System and logging in, a tool called XRandR can be used to display the currently used resolution as follows:

$ xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
DVI-I-1 disconnected (normal left inverted right x axis y axis)
VGA-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 553mm x 311mm
   1920x1080*    59.96    60.00    60.00    50.00    59.94    59.93    30.00    25.00    24.00    29.97    23.98
   1920x1080i    60.00    50.00    59.94
   1680x1050     59.95    59.88
<OUTPUT-OMITTED>

Being sure that the used monitor and graphic card support a higher resolution (e.g. 2560x1440p also known as Quad HD (QHD), Wide Quad HD (WQHD) or 2K), the missing VESA Coordinated Video Timing (CVT) modeline, can be calculated as follows (e.g. for a "reduced blanking", which allows for higher frequency signals with a lower or equal dotclock):

$ cvt --reduced 2560 1440 60
# 2560x1440 59.95 Hz (CVT 3.69M9-R) hsync: 88.79 kHz; pclk: 241.50 MHz
Modeline "2560x1440R"  241.50  2560 2608 2640 2720  1440 1443 1448 1481 +hsync -vsync

Whether the maximum screen resolution (i.e. the previously generated modeline) works or not, the xrandr command can be used as follows:

$ xrandr --newmode "2560x1440R"  241.50  2560 2608 2640 2720  1440 1443 1448 1481 +hsync -vsync
$ xrandr --addmode HDMI-1 2560x1440R
$ xrandr --output HDMI-1 --mode 2560x1440R

The --newmode parameter is the Modeline generated by the previously used cvt command and the HDMI-1 is the first HDMI port that is used to connect the graphic card to the monitor.


Making the Changes Permanent

If the aforementioned solution works, it can be made permanent for LightDM by running:

$ sed -i "s_^#display-setup-script=_display-setup-script=/etc/lightdm/Xsetup_g" /etc/lightdm/lightdm.conf
$ cat <<EOT > /etc/lightdm/Xsetup
xrandr --newmode "2560x1440R"  241.50  2560 2608 2640 2720  1440 1443 1448 1481 +hsync -vsync
xrandr --addmode HDMI-1 2560x1440R
xrandr --output HDMI-1 --mode 2560x1440R
EOT
$ chmod +x /etc/lightdm/Xsetup

After computer (or xdm restart), the manually added resolution should be used as default.

Tags: #X.Org #resolution #LightDM #cvt #xrandr

⏴ Previous Post Next Post ⏵