You are not logged in.

#1 2020-06-17 14:36:03

benvosper
Member
Registered: 2019-01-28
Posts: 9

[Solved] xorg.conf: Set preferred monitor refresh rate

My primary monitor is 2560x1440 with a maximum refresh-rate of 165Hz. But it's default refresh rate appears to be 60Hz. xrandr confirms this:

$ xrandr
Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384
DP-3 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   2560x1440     59.95*+ 165.00   144.00   120.00    99.95    84.98    23.97
   1024x768      60.00
   800x600       60.32
   640x480       60.00    59.94

I'd like to make the max refresh-rate of 165Hz the preferred mode here.

I can set the refresh rate manually using:

$ xrandr --output DP-3 --mode 2560x1440 --rate 165

Which then results in the correct refresh rate being selected:

$ xrandr
Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384
DP-3 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   2560x1440     59.95 + 165.00*   144.00   120.00    99.95    84.98    23.97
   1024x768      60.00
   800x600       60.32
   640x480       60.00    59.94

The accepted way of setting the preferred mode seems to be via an xorg.conf file. The PreferredMode option allows you to specify which mode to use as the default, but I can't see a way of saying I'd like the 2560-x1440  @165 mode. This leaves me with the option of providing a new ModeLine and setting the PreferredMode to that.

My xorg.log file gives all available modelines for this monitor:

[    16.960] (II) NOUVEAU(0): Printing probed modes for output DP-3
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x60.0  241.50  2560 2608 2640 2720  1440 1443 1448 1481 +hsync -vsync (88.8 kHz eP)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x165.0  635.54  2560 2568 2600 2640  1440 1443 1453 1459 +hsync +vsync (240.7 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x144.0  586.58  2560 2568 2600 2640  1440 1443 1453 1543 +hsync +vsync (222.2 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x120.0  497.75  2560 2608 2640 2720  1440 1443 1448 1525 +hsync -vsync (183.0 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x99.9  410.50  2560 2608 2640 2720  1440 1443 1448 1510 +hsync -vsync (150.9 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x85.0  346.50  2560 2608 2640 2720  1440 1443 1448 1499 +hsync -vsync (127.4 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "2560x1440"x24.0   95.00  2560 2608 2640 2720  1440 1443 1448 1457 +hsync -vsync (34.9 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "1024x768"x60.0   65.00  1024 1048 1184 1344  768 771 777 806 -hsync -vsync (48.4 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "800x600"x60.3   40.00  800 840 968 1056  600 601 605 628 +hsync +vsync (37.9 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "640x480"x60.0   25.20  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz e)
[    16.960] (II) NOUVEAU(0): Modeline "640x480"x59.9   25.18  640 656 752 800  480 490 492 525 -hsync -vsync (31.5 kHz e)

It's that second "x165.0" line that I want. So I set up /etc/X11/xorg.conf.d/10-monitor.conf as such:

Section "Monitor"
    Identifier "DP-3"
    Option "Primary" "true"
    ModeLine "1440@165" 635.54 2560 2568 2600 2640 1440 1443 1453 1459 +hsync +vsync
    Option "PreferredMode" "1440@165"
EndSection

This all loads up fine and I now get:

$ xrandr
Screen 0: minimum 320 x 200, current 4480 x 1440, maximum 16384 x 16384
DP-3 connected primary 2560x1440+0+0 (normal left inverted right x axis y axis) 598mm x 336mm
   1440@165     165.00*+
   2560x1440     59.95 + 165.00   144.00   120.00    99.95    84.98    23.97  
   1024x768      60.00  
   800x600       60.32  
   640x480       60.00    59.94  

But the monitor is not running at 165Hz. Running the xrandr command with the rate option again does set the correct value.

So what am I missing? Is the definition of that new modeline incorrect? Or is the preferred mode not being correctly detected? The xorg log seems to indicate that it's all fine:

$ grep 1440@165 ~/.local/share/xorg/Xorg.0.log    
[    16.950] (**) NOUVEAU(0): Option "PreferredMode" "1440@165"
[    16.960] (II) NOUVEAU(0): Modeline "1440@165"x165.0  635.54  2560 2568 2600 2640  1440 1443 1453 1459 +hsync +vsync (240.7 kHz UP)
[    17.100] (II) NOUVEAU(0): Output DP-3 using initial mode 1440@165 +0+0

Any thoughts appreciated! I guess I can always run the xrandr command on startup, but that feels unsatisfactory... I'm so close!

Last edited by benvosper (2020-06-17 21:33:11)

Offline

#2 2020-06-17 14:58:39

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

Maybe it's a bug in nouveau? I do the same here on amdgpu and it works fine.

My config file looks like this:

Section "Monitor"
    Identifier "DisplayPort-0"
    Modeline "2560x1440_144"  586.00  2560 2568 2600 2640  1440 1465 1473 1543 +hsync -vsync
    Option "PreferredMode" "2560x1440_144"
EndSection

Now that I think about it, I'm also changing the refresh rate for the Linux console. This does not influence the Xorg refresh rate here for me, but maybe it will for you? You could try that and see if something changes.

I do that with this kernel command line option:

video=DP-1:2560x1440@144

That "DP-1" name for the kernel command line, I found like this:

$ grep . /sys/class/drm/card0-*/status
/sys/class/drm/card0-DP-1/status:connected
/sys/class/drm/card0-DP-2/status:disconnected
/sys/class/drm/card0-DVI-D-1/status:disconnected
/sys/class/drm/card0-HDMI-A-1/status:disconnected
/sys/class/drm/card0-HDMI-A-2/status:disconnected

I only change the console refresh rate because switching between tty happens instantly if the desktop and the tty are using the same mode. If the console and Xorg use a different mode, then switching from Xorg desktop to tty has a monitor mode switch that needs a few seconds.

Last edited by Ropid (2020-06-17 15:00:51)

Offline

#3 2020-06-17 16:57:26

benvosper
Member
Registered: 2019-01-28
Posts: 9

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

@Ropid Thanks for the suggestion! But no luck, unfortunately. Added the parameter via my grub config. Booted fine, but didn't produce any visible difference. Preferred mode was still active when X started, but it's definitely not the right refresh rate.

I'll keep digging

Offline

#4 2020-06-17 17:51:49

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

Maybe the problem is in the Xorg video driver module from the "xf86-video-nouveau" package? Do you know if the nouveau kernel driver can work together with the generic "modesetting" driver that's inside the xorg-server package?

You can write a config like this to try the modesetting driver instead of the one in the "xf86-video-nouveau" package:

# Filename: /etc/X11/xorg.conf.d/01-modesetting.conf
Section "Device"
  Identifier "force modesetting"
  Driver "modesetting"
EndSection

Or you could try removing the xf86-video-nouveau package. I would guess the modesetting driver should take over automatically if there's no xf86-video-nouveau, without needing that config file.

If the driver loads correctly, then the messages about Modelines etc. in your Xorg log file will start with a "modeset(0):" text instead of the "NOUVEAU(0):" text you are currently seeing there.

Offline

#5 2020-06-17 19:49:01

benvosper
Member
Registered: 2019-01-28
Posts: 9

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

@Ropid That did work! xorg.log does indeed confirm that modeset is being used, and the resolution and refresh rate is correct.

But does that mean I'm now not using the nouveau drivers for my graphics at all? Forgive my ignorance here, my knowledge in this area is pretty hazy! Or is the modesetting driver just used on boot etc.? Reading around here (https://wiki.archlinux.org/index.php/Ke … de_setting) I can't quite tell.

Performance seems identical, and I'm not doing anything graphically-intensive. I just want to be sure I understand what's going on.

Thanks for your help!

Last edited by benvosper (2020-06-17 19:50:51)

Offline

#6 2020-06-17 21:10:28

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

Yes, that stuff is pretty confusing. There's several different parts that all are named "nouveau".

You are still using the nouveau OpenGL driver and the nouveau kernel module.

This Xorg video driver thing is a separate part. Both the modesetting and the nouveau Xorg video driver will do very similar stuff with the OpenGL driver and the kernel module.

I don't know how exactly the modesetting driver and the specialized drivers like xf86-video-nouveau relate to each other. I think in the past there were just the specialized ones and modesetting was written later.

modesetting and the other drivers have different Xorg config settings and features. You can check with "man modesetting", "man nouveau".

Offline

#7 2020-06-17 21:31:32

benvosper
Member
Registered: 2019-01-28
Posts: 9

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

@Ropid Thanks for the info, very helpful. I appreciate it!

Marking this as solved.

Offline

#8 2024-01-07 00:59:50

tiger64
Member
Registered: 2023-12-28
Posts: 10

Re: [Solved] xorg.conf: Set preferred monitor refresh rate

as a side note for if none of the above solutions work, make sure the value used to specify the refresh rate does not have decimals in it

for example, instead of using something such as "144.00", use just "144"

this took me an hour to realize sad

Offline

Board footer

Powered by FluxBB