How to add a custom screen refresh rate on Wayland session?

Description:
I attempt to add a nonnative refresh rate on Wayland+KDE, but it doesn’t work.

Try:
I found 2 two method on Internet:

  1. xrandr, a method for Xorg, apparently will not work on a Wayland session.
  2. Modify /etc/default/grub. It worked but not quite. It only affects my boot animation and sddm screen, it stops work when I sign in.

Related Information:
屏幕截图_20240818_234102
(And this resolution is not right, which should be 1920x1080)

nvidia-smi

Sun Aug 18 23:44:43 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.28.03              Driver Version: 560.28.03      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1060 3GB    Off |   00000000:04:00.0  On |                  N/A |
| 23%   41C    P5             10W /  130W |    1031MiB /   3072MiB |     13%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      1150      G   /usr/lib/Xorg                                  10MiB |
|    0   N/A  N/A      2359      G   /usr/bin/kwalletd6                              2MiB |
|    0   N/A  N/A      2388      G   /usr/bin/kwin_wayland                         136MiB |
|    0   N/A  N/A      2480      G   /usr/bin/Xwayland                               8MiB |
|    0   N/A  N/A      2555      G   /usr/bin/ksmserver                              2MiB |
|    0   N/A  N/A      2557      G   /usr/bin/kded6                                  2MiB |
|    0   N/A  N/A      2573      G   /usr/bin/plasmashell                          247MiB |
|    0   N/A  N/A      2612      G   /usr/lib/kactivitymanagerd                      2MiB |
|    0   N/A  N/A      2616      G   ...b/polkit-kde-authentication-agent-1          2MiB |
|    0   N/A  N/A      2617      G   /usr/lib/org_kde_powerdevil                     2MiB |
|    0   N/A  N/A      2618      G   /usr/lib/xdg-desktop-portal-kde                 2MiB |
|    0   N/A  N/A      2830      G   /usr/user-repo/steam++/Steam++                  4MiB |
|    0   N/A  N/A      2845      G   /usr/bin/kdeconnectd                            2MiB |
|    0   N/A  N/A      2870      G   /usr/bin/kaccess                                2MiB |
|    0   N/A  N/A      2871      G   /usr/bin/kalendarac                             2MiB |
|    0   N/A  N/A      3112      G   /usr/bin/akonadi_control                        2MiB |
|    0   N/A  N/A      3284      G   ...erProcess --variations-seed-version         75MiB |
|    0   N/A  N/A      3290      G   ...ures=SpareRendererForSitePerProcess         72MiB |
|    0   N/A  N/A      3304      G   ...erProcess --variations-seed-version         98MiB |
|    0   N/A  N/A      3514      G   /usr/bin/akonadi_akonotes_resource              2MiB |
|    0   N/A  N/A      3515      G   /usr/bin/akonadi_contacts_resource              2MiB |
|    0   N/A  N/A      3519      G   /usr/bin/akonadi_ical_resource                  2MiB |
|    0   N/A  N/A      3521      G   /usr/bin/akonadi_ical_resource                  2MiB |
|    0   N/A  N/A      3522      G   /usr/bin/akonadi_indexing_agent                 2MiB |
|    0   N/A  N/A      3523      G   /usr/bin/akonadi_maildir_resource               2MiB |
|    0   N/A  N/A      3524      G   /usr/bin/akonadi_maildispatcher_agent           2MiB |
|    0   N/A  N/A      3526      G   /usr/bin/akonadi_migration_agent                2MiB |
|    0   N/A  N/A      3528      G   /usr/bin/akonadi_newmailnotifier_agent          2MiB |
|    0   N/A  N/A      8468      G   /usr/lib/baloorunner                            2MiB |
|    0   N/A  N/A      8693      G   /usr/bin/krunner                               11MiB |
|    0   N/A  N/A      9960      G   ....17-ca-jdk21.0.2-linux_x64/bin/java         32MiB |
|    0   N/A  N/A     10539      G   /usr/user-repo/edge/msedge                      2MiB |
|    0   N/A  N/A     10599      G   ...80,262144 --variations-seed-version        170MiB |
|    0   N/A  N/A     10850      G   ...bin/plasma-browser-integration-host          2MiB |
|    0   N/A  N/A    134757      G   /usr/bin/konsole                                2MiB |
|    0   N/A  N/A    135617      G   /usr/lib/kf6/kioworker                          2MiB |
|    0   N/A  N/A    135676      G   /usr/lib/kf6/kioworker                          2MiB |
+-----------------------------------------------------------------------------------------+
cat /etc/default/grub                                                                  


# GRUB boot loader configuration

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash udev.log_priority=3 nvidia_drm.modeset=1 video=HDMI-A-1:1920x1080@75"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Set to 'countdown' or 'menu' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=hidden

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
GRUB_THEME="/usr/share/grub/themes/manjaro/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires
# setting 'GRUB_DEFAULT=saved' above.
GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

Help.

System settings → Display & Monitor → Refresh rate

You can set refresh rate here. 75Hz shouldn’t be problem if your monitor support it. I have set same refresh rate :wink: (though I have AMD not Nvidia)

The setting is locked on 60Hz, and said “60Hz is the only rate the monitor supports”. However, my monitor physically supports up to 84Hz(its default rate is 60Hz, but I had made it to 84Hz when I was still using Windows).

I see, that’s different situation :sweat_smile:

You can try set KWIN_DRM_USE_MODIFIERS=0 in /etc/environment, more info on Reddit and Arch Forum

https://bbs.archlinux.org/viewtopic.php?id=286810
https://www.reddit.com/r/kde/comments/11i8l25/nvidia_external_monitor_issues_lowfpsvsync_look/

Thanks, but doing this just makes me unable to enter the desktop.(It blacks screen after I sign in.) :thinking:

I found something interest in kernel logs:

2024/8/19 13:56	nvidia 0000	4:00.0: [drm] User-defined mode not supported: "1920x1080": 75 220597 1920 2056 2264 2608 1080 1081 1084 1128 0x20 0x6

Although it disappears after I set GRUB_CMDLINE_LINUX_DEFAULT="quiet splash udev.log_priority=3 nvidia_drm.modeset=1 video=HDMI-A-1:1920x1080@60"
, this doesn’t make sense.