Custom resolution set in /etc/X11/mhwd.d/nvidia.conf reverts back after restart

Hello. I’ve recently switched to Linux and have been trying to reproduce a custom resolution I was able to use on Windows, which is 1920x1080@74Hz on a monitor that is normally 60Hz. This resolution is not present in the monitor’s EDID.
I’m using GNOME with nvidia drivers.

I first tried to use xrandr as follows:

    ~  cvt 1920 1080 74 
# 1920x1080 73.95 Hz (CVT) hsync: 83.49 kHz; pclk: 217.75 MHz
Modeline "1920x1080_74.00"  217.75  1920 2064 2264 2608  1080 1083 1088 1129 -hsync +vsync
    ~  xrandr --newmode "1920x1080_74.00" 217.75 1920 2064 2264 2608 1080 1083 1088 1129 -hsync +vsync
    ~  xrandr --addmode HDMI-0 "1920x1080_74.00"
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  37
  Current serial number in output stream:  38

then, given the error, I tried following the steps in the Arch Wiki instead, but applying them to /etc/X11/mhwd.d/nvidia.conf instead of /etc/X11/xorg.conf, since that seems to be the one Manjaro uses by default.

After making the necessary changes, this is my nvidia.conf:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 510.47.03


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

Section "Files"
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

Section "Monitor"

    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics 23MP55"
    HorizSync       30.0 - 86.0
    VertRefresh     56.0 - 75.0
    ModeLine       "1920x1080_74.00" 217.75 1920 2064 2264 2608 1080 1083 1088 1129 -hsync +vsync
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce GTX 1660 SUPER"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "ModeValidation" "NoVesaModes, NoXServerModes"
    Option         "ExactModeTimingsDVI" "True"
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-1"
    Option         "metamodes" "nvidia-auto-select +0+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
        Modes "1920x1080_74.00"
    EndSubSection
EndSection

note that besides what I could see in the arch wiki, I also changed

    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 61.0

to

    HorizSync       30.0 - 85.0
    VertRefresh     56.0 - 75.0

just to be safe.

After a reboot, my display uses the default 60Hz and no new resolutions/rates show up in either nvidia-settings or GNOME’s settings panel

Checking back nvidia.conf, I can see that

    SubSection     "Display"
        Depth       24
        Modes "1920x1080_74.00"
    EndSubSection

went back to

    SubSection     "Display"
        Depth       24
    EndSubSection

and

    HorizSync       30.0 - 85.0
    VertRefresh     56.0 - 75.0

went back to

    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 61.0

I suspect that after the reboot, the system is reading the EDID and invalidating the custom resolution since it is outside of what it considers that the monitor can push, but Nvidia’s Control Panel in Windows had no issues with this.

Thanks a lot for any help in solving this issue

Note: I would like to link to the section of the Arch Wiki I referenced, but it seems like I cannot create posts containing links yet

Hi,
Welcome, pleasantries and all that,

Herein lies a number of problems. Or at least things I would do differently.
mhwd and its respective directory is handled by that framework - it touches it, but you probably dont need or want to.
also - the normal procedure for these files is to prepend a number which indicates load order.
We also like to make our ‘addendums’ separate and in their own configuration file, rather than augmenting something sourced from and affected by a system package.
So … to put that together it really just means put your stuff in

/etc/X11/xorg.conf.d/99-nvidia.conf

Thanks for the quick response and for explaning to me how /etc/X11/xorg.conf.d/ works, I was not aware of that. I assume it applies the addendums going from lowest to highest number, adding any new options from each section, right?
I moved my attempt at the custom resolution to /etc/X11/xorg.conf.d/99-nvidia.conf like you said, and it stuck around without modifications after the restart, but no dice getting the custom resolution to work. After reading a little more of the Arch Wiki, I see that the xrandr error I encountered may be caused by the default nvidia driver only allowing resolutions explicitly reported by EDID, so tried adding Option "ModeValidation" "AllowNonEdidModes" to the Device section to no avail.

Here is my current 99-nvidia.conf:

Section "Monitor"
    Identifier "Monitor0"
    HorizSync       30.0 - 85.0
    VertRefresh     56.0 - 75.0
    Modeline "1920x1080_74.00"  217.75  1920 2064 2264 2608  1080 1083 1088 1129 -hsync +vsync
    Option "PreferredMode" "1920x1080_74.00"
EndSection

Section "Device"
    Identifier "Device0"
    Driver "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce GTX 1660 SUPER"
    Option         "ModeValidation" "AllowNonEdidModes"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "Device0"
    Monitor "Monitor0"
    SubSection "Display"
        Modes "1920x1080_74.00"
    EndSubSection
EndSection

This line should be without the quotation marks. See xrandr - ArchWiki :

xrandr --addmode HDMI-0 1920x1080_74.00

I see, it seems like omitting the quotation marks results in the same error:

    ~  xrandr --newmode "1920x1080_74.00" 217.75 1920 2064 2264 2608 1080 1083 1088 1129 -hsync +vsync  
    ~  xrandr --addmode HDMI-0 1920x1080_74.00
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  18 (RRAddOutputMode)
  Serial number of failed request:  35
  Current serial number in output stream:  36

Here is some other output that might be useful:

    ~  xrandr --listmonitors                                                                                                  ✔ 
Monitors: 1
 0: +*HDMI-0 1920/510x1080/290+0+0  HDMI-0
    ~  xrandr --listproviders                                                                                                 ✔ 
Providers: number : 1
Provider 0: id: 0x1b7 cap: 0x1, Source Output crtcs: 4 outputs: 4 associated providers: 0 name:NVIDIA-0
    ~  xrandr --current                                                                                                       ✔ 
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DVI-D-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+  59.94    50.00  
   1680x1050     59.95  
   1600x900      60.00  
   1440x900      59.89  
   1400x1050     59.98  
   1280x1024     60.02  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      60.00  
   1024x768      60.00  
   800x600       60.32  
   720x576       50.00  
   720x480       59.94  
   640x480       59.94    59.93  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
  1920x1080_74.00 (0x203) 217.750MHz -HSync +VSync
        h: width  1920 start 2064 end 2264 total 2608 skew    0 clock  83.49KHz
        v: height 1080 start 1083 end 1088 total 1129           clock  73.95Hz

We are going on the wrong path here. There’s no need to add a new resolution as 1920x1080 is clearly visible. The xrandr output doesn’t show a 74Hz refresh rate available. Does this command do anything?

xrandr --output HDMI-0 --mode 1920x1080 --rate 74

It does not do anything.

However, doing something like xrandr --output HDMI-0 --mode 1920x1080 --rate 50 (using a rate shown in the output) does work normally.

Have you tried a bit lower value? Like 73 or 72?
I am asking this since my monitor’s max rate is 73 with nominal rate of 60.
If you manage to find a proper working value, watch for colours - using rates above nominal ones may cause color distortion.

that’s a great idea, can’t believe I hadn’t tried it before. Unfortunately, even using 61Hz didn’t work.
I tried both using that in the Modeline in 99-nvidia.conf and through xrandr, the behavour on both is the same as with a higher rate.

SOLVED! (kind of)

I was getting kinda fed up with this problem. So I booted into windows and used the Custom Resolution Utility to modify my monitor’s preferred resolution/rate to the one I wanted and exported the custom EDID file. Then I followed this guide to make the graphics card use the custom EDID file.

However. If I added the option to /etc/X11/xorg.conf.d/99-nvidia.conf like @cscs explained, it did not take effect. But if I add the option to the Device section in /etc/X11/mhwd.d/nvidia.conf (which I probably shouldn’t be doing) it did actually work and used 74Hz as soon as I rebooted!

Did I somehow break the functionality of xorg.conf.d? Should I be using mhwd.d instead and cscs just switched them up by accident?

So yea, basically: Trying to make the graphics card allow custom resolutions that were not on the EDID info did not work. But generating a customized EDID file that allowed for that custom resolution did work.

If anyone knows of a good EDID editor available on linux, please lmk in this thread.

I am aware, I had used this rate in this monitor before and the colors were acceptable for my use case. Thanks for the heads up though!

So it works now only with custom EDID?

  • Btw there’s another trick to make extra refresh rates available in display settings:
    adding something like video=HDMI-1:1920x1080@74 into kernel command line (in grub config, for example). This is especially useful when using Wayland which of course ignores everything written to X11 configuration files.

  • You can also use a startup script like (instead of trying to modify Manjaro’s mhwd.d files):

#!/bin/bash
xrandr --newmode "1920x1080_70.00" 204.25  1920 2056 2256 2592  1080 1083 1088 1127 -hsync +vsync
xrandr --addmode HDMI-1 "1920x1080_70.00"
xrandr --output HDMI-1 --mode "1920x1080_70.00"

Yes.
I most likely could make it work by inputting the custom resolution as Modeline in xorg.conf.d/99-nvidia.conf if I knew the right options to make the card ignore the EDID entirely or allow non-EDID resolutions. But I was not able to find documentation on such options (lmk if anyone has a link), plus my xorg.conf.d/99-nvidia.conf didn’t even seem to work at the end there, not sure what’s happening there.

I read about that, but would rather understand a little better how the kernel command line works before messing with it.

xrandr --addmode HDMI-1 "1920x1080_70.00" errors out, see my earlier replies in this topic

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.