KDE Wayland custom resolution AND refresh rate

I want to change (lower) my screen resolution and use a high refresh rate but I can’t.
My monitor supports 144 Hz and at the native resolution this mode is available. When I want any other (lower) resolution I don’t get high refresh rates to choose from.

Modes reported by kscreen-doctor -o:
Modes: 0:3840x1080@144*! 1:3840x1080@120 2:3840x1080@100 3:3840x1080@60 4:2560x1080@60 5:1920x1080@60 6:1920x1080@60 7:1920x1080@50 8:1680x1050@60 9:1600x900@60 ...

My current understanding of the situation is the following:

In theory one could “add” reported modes by doing something with EDID and adding kernel boot options. But since nvidia is involved, this does not work. I got this from here:

Available modes are the ones reported by the monitor + modes with common resolutions that are generated.

Support for these additional common resolutions was added in KDE 5.25.3 as mentioned here: discuss . kde . org : 8997

This bug tracked it: bugs . kde . org : 448398

And this commit by zamundaaa fixed it: KWin : 9ed87a4e

From the commit I got that the refresh rate for generated modes is an estimate based on bandwidth. The result of this guess is wrong (maybe a bug?).

Overall this seems straightforward but impossible at the same time.

How do I add custom modes with resolution AND refresh rate? Is this even possible?
Maybe: Can I influence the generation of modes to get the desired result?

I’m on a up-to-date KDE Neon on Wayland using nvidia.

PS: Sorry for the images but apparently links are not permitted.
PSS: New users can only add one image… :frowning:

EDID is the information the screen itself is sending back to the computer about its capabilities.

You can review the EDID information directly by asking it from the kernel and decoding it using edid-decode like so:

edid-decode /sys/devices/pciXXXX:XX/XXXX:XX:XX.X/drm/cardX/cardX-PORTNAME-NUM/edid

Replace the Xs and the PORTNAME-NUM with the relevant value for your system - you can find all the possible paths by running:

ls /sys/devices/*/*/drm/*/*/edid

Note that this will list all display connections that the Kernel sees, regardless of whether there’s a screen connected to them - only when you read them the kernel will try to fetch the EDID. If you try to read from a disconnected port edid-decode will complain and say “EDID extract of 'PATH' failed: unknown format.” - which is fine, it just means nothing is connected.

Can you share the output of edid-decode for your screen?

It’s probably not relevant but it seems that I have a thrid pci address level. I added another /* and running the resulting command gave me the desired list of edid files.
ls /sys/devices/*/*/*/drm/*/*/edid

/sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/card0/card0-DP-1/edid      /sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/controlD64/card0-DP-1/edid
/sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/card0/card0-DP-2/edid      /sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/controlD64/card0-DP-2/edid
/sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/card0/card0-DP-3/edid      /sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/controlD64/card0-DP-3/edid
/sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/card0/card0-HDMI-A-1/edid  /sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/controlD64/card0-HDMI-A-1/edid

running edid-decode like this:
edid-decode /sys/devices/pci0000:00/0000:00:03.1/0000:3f:00.0/drm/card0/card0-DP-3/edid

gave me the following output:

edid-decode (hex):

00 ff ff ff ff ff ff 00 4c 2d 5e 0e 39 52 52 30
34 1b 01 04 b5 78 22 78 3a cf f5 ae 4f 45 a8 26
0e 50 54 bf ef 80 71 4f 81 00 81 c0 81 80 95 00
a9 c0 b3 00 01 01 1e ff 00 50 f0 38 4d 40 08 20
f8 0c ac 50 41 00 00 1a 00 00 00 fd 00 32 90 1e
aa 42 00 0a 20 20 20 20 20 20 00 00 00 fc 00 43
34 39 48 47 39 78 0a 20 20 20 20 20 00 00 00 ff
00 48 54 4a 4a 43 30 30 34 35 33 0a 20 20 01 4e

02 03 1f f1 47 90 1f 04 13 03 12 5a 23 09 07 07
83 01 00 00 e3 05 c0 00 e6 06 05 01 73 5a 17 1a
68 00 a0 f0 38 1f 40 30 20 3a 00 ac 50 41 00 00
1a 02 3a 80 18 71 38 2d 40 58 2c 45 00 ac 50 41
00 00 1e f4 b0 00 a0 f0 38 35 40 30 20 3a 00 ac
50 41 00 00 1a 74 d6 00 a0 f0 38 40 40 30 20 3a
00 ac 50 41 00 00 1a 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 66

----------------

Block 0, Base EDID:
  EDID Structure Version & Revision: 1.4
  Vendor & Product Identification:
    Manufacturer: SAM
    Model: 3678
    Serial Number: 810701369
    Made in: week 52 of 2017
  Basic Display Parameters & Features:
    Digital display
    Bits per primary color channel: 10
    DisplayPort interface
    Maximum image size: 120 cm x 34 cm
    Gamma: 2.20
    DPMS levels: Off
    Supported color formats: RGB 4:4:4, YCrCb 4:4:4, YCrCb 4:2:2
    First detailed timing includes the native pixel format and preferred refresh rate
  Color Characteristics:
    Red  : 0.6826, 0.3085
    Green: 0.2724, 0.6591
    Blue : 0.1513, 0.0576
    White: 0.3134, 0.3291
  Established Timings I & II:
    IBM     :   720x400    70.082 Hz   9:5    31.467 kHz  28.320 MHz
    DMT 0x04:   640x480    59.940 Hz   4:3    31.469 kHz  25.175 MHz
    Apple   :   640x480    66.667 Hz   4:3    35.000 kHz  30.240 MHz
    DMT 0x05:   640x480    72.809 Hz   4:3    37.861 kHz  31.500 MHz
    DMT 0x06:   640x480    75.000 Hz   4:3    37.500 kHz  31.500 MHz
    DMT 0x08:   800x600    56.250 Hz   4:3    35.156 kHz  36.000 MHz
    DMT 0x09:   800x600    60.317 Hz   4:3    37.879 kHz  40.000 MHz
    DMT 0x0a:   800x600    72.188 Hz   4:3    48.077 kHz  50.000 MHz
    DMT 0x0b:   800x600    75.000 Hz   4:3    46.875 kHz  49.500 MHz
    Apple   :   832x624    74.551 Hz   4:3    49.726 kHz  57.284 MHz
    DMT 0x10:  1024x768    60.004 Hz   4:3    48.363 kHz  65.000 MHz
    DMT 0x11:  1024x768    70.069 Hz   4:3    56.476 kHz  75.000 MHz
    DMT 0x12:  1024x768    75.029 Hz   4:3    60.023 kHz  78.750 MHz
    DMT 0x24:  1280x1024   75.025 Hz   5:4    79.976 kHz 135.000 MHz
    Apple   :  1152x870    75.062 Hz 192:145  68.681 kHz 100.000 MHz
  Standard Timings:
    DMT 0x15:  1152x864    75.000 Hz   4:3    67.500 kHz 108.000 MHz
    DMT 0x1c:  1280x800    59.810 Hz  16:10   49.702 kHz  83.500 MHz
    DMT 0x55:  1280x720    60.000 Hz  16:9    45.000 kHz  74.250 MHz
    DMT 0x23:  1280x1024   60.020 Hz   5:4    63.981 kHz 108.000 MHz
    DMT 0x2f:  1440x900    59.887 Hz  16:10   55.935 kHz 106.500 MHz
    DMT 0x53:  1600x900    60.000 Hz  16:9    60.000 kHz 108.000 MHz (RB)
    DMT 0x3a:  1680x1050   59.954 Hz  16:10   65.290 kHz 146.250 MHz
  Detailed Timing Descriptors:
    DTD 1:  3840x1080  143.999 Hz  32:9   166.607 kHz 653.100 MHz (1196 mm x 336 mm)
                 Hfront    8 Hsync  32 Hback  40 Hpol P
                 Vfront   63 Vsync   8 Vback   6 Vpol N
  Display Range Limits:
    Monitor ranges (GTF): 50-144 Hz V, 30-170 kHz H, max dotclock 660 MHz
    Display Product Name: 'C49HG9x'
    Display Product Serial Number: 'HTJJC00453'
  Extension blocks: 1
Checksum: 0x4e

----------------

Block 1, CTA-861 Extension Block:
  Revision: 3
  Underscans IT Video Formats by default
  Basic audio support
  Supports YCbCr 4:4:4
  Supports YCbCr 4:2:2
  Native detailed modes: 1
  Video Data Block:
    VIC  16:  1920x1080   60.000 Hz  16:9    67.500 kHz 148.500 MHz (native)
    VIC  31:  1920x1080   50.000 Hz  16:9    56.250 kHz 148.500 MHz
    VIC   4:  1280x720    60.000 Hz  16:9    45.000 kHz  74.250 MHz
    VIC  19:  1280x720    50.000 Hz  16:9    37.500 kHz  74.250 MHz
    VIC   3:   720x480    59.940 Hz  16:9    31.469 kHz  27.000 MHz
    VIC  18:   720x576    50.000 Hz  16:9    31.250 kHz  27.000 MHz
    VIC  90:  2560x1080   60.000 Hz  64:27   66.000 kHz 198.000 MHz
  Audio Data Block:
    Linear PCM:
      Max channels: 2
      Supported sample rates (kHz): 48 44.1 32
      Supported sample sizes (bits): 24 20 16
  Speaker Allocation Data Block:
    FL/FR - Front Left/Right
  Colorimetry Data Block:
    BT2020YCC
    BT2020RGB
  HDR Static Metadata Data Block:
    Electro optical transfer functions:
      Traditional gamma - SDR luminance range
      SMPTE ST2084
    Supported static metadata descriptors:
      Static metadata type 1
    Desired content max luminance: 115 (603.666 cd/m^2)
    Desired content max frame-average luminance: 90 (351.250 cd/m^2)
    Desired content min luminance: 23 (0.049 cd/m^2)
  Detailed Timing Descriptors:
    DTD 2:  3840x1080   59.968 Hz  32:9    66.625 kHz 266.500 MHz (1196 mm x 336 mm)
                 Hfront   48 Hsync  32 Hback  80 Hpol P
                 Vfront    3 Vsync  10 Vback  18 Vpol N
    DTD 3:  1920x1080   60.000 Hz  16:9    67.500 kHz 148.500 MHz (1196 mm x 336 mm)
                 Hfront   88 Hsync  44 Hback 148 Hpol P
                 Vfront    4 Vsync   5 Vback  36 Vpol P
    DTD 4:  3840x1080   99.956 Hz  32:9   113.250 kHz 453.000 MHz (1196 mm x 336 mm)
                 Hfront   48 Hsync  32 Hback  80 Hpol P
                 Vfront    3 Vsync  10 Vback  40 Vpol N
    DTD 5:  3840x1080  119.974 Hz  32:9   137.250 kHz 549.000 MHz (1196 mm x 336 mm)
                 Hfront   48 Hsync  32 Hback  80 Hpol P
                 Vfront    3 Vsync  10 Vback  51 Vpol N
Checksum: 0x66

It looks like your display supports 144Hz only in the native 3840x1080 resolution (where it also supports 100Hz) and 60Hz or 75Hz for any other resolution.

So I don’t think you can set a non-native resolution with a high refresh rate - your hardware claim that it cannot do that.

Just to be 100% sure that my memory was right, I tested it with another device running Windows.

It worked, demonstrating that the monitor can handle different modes despite what it promotes.

To make sure that it can work with my system, I switched to X11 and set it up following the instructions found here: linuxquestions.org : How to do custom (non EDID) resolution with nvidia BUT works with nv?

What I had to do was:

  1. Remove mode validation checks by adding the following line to the Section "OutputClass" in /usr/share/X11/xorg.conf.d/10-nvidia.conf.
    Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck,
  2. Doing a reboot.
  3. Running gtf 2560 1080 144 to generate a modeline.
    Modeline "2560x1080_144.00" 603.19 2560 2776 3064 3568 1080 1081 1084 1174 -HSync +Vsync
  4. Create the new mode running:
    xrandr --newmode "2560x1080_144.00" 603.19 2560 2776 3064 3568 1080 1081 1084 1174 -HSync +Vsync
  5. Adding the new mode:
    xrandr --addmode DP-4 "2560x1080_144.00"
  6. Using kscreen to set the resolution + refresh rate.

But this was with X11. Can the same be achieved using Wayland?

Supposedly, if you have an X11 modeline - you can convert it to an EDID firmware override file and then load it into the kernel - as described in this article:

I have not tried this myself.

Thanks your help!

If i find the time in the future I’ll report back on my results trying this.