Hi, I have an Artix dinit system running KDE plasma wayland on an AMD cpu and Nvidia gpu.
Whenever I try to screenshare a game, whether it be through one of the discord clients that support wayland screensharing like vesktop, or screensharing through firefox using discord on web, the game I screenshare becomes completely unplayable. Screensharing will cause the game to stutter like crazy, for every ~0.3 seconds of it running fine it will freeze for around ~1-2 seconds. I have noticed that for some reason this only happens if the game is the focused application and is running in fullscreen. If I continue to screenshare and simply alt-tab to focus on a different window, the game stops stuttering. If I make the game windowed, it stops stuttering. If I run the game under gamescope, it stops stuttering. I really have no clue what could be causing this, any help would be appreciated!
could you provide some more basic info? what gpu? driver version? kernel version and params? pure gayland or xgayland app? do you have nvidia modules preloaded?
cat /etc/modprobe.d/nvidia.conf (or at least a file that modifies nvidia NVReg parameters) vs cat /proc/driver/nvidia/params?
My gpu is the 4080, on driver nvidia-open-dkms version 565.57.01-1
kernel is 6.11.7-artix1-1 with parameters of
BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=e7fd22c2-4c03-492f-8f1b-f7db6fce0506 rw net.ifnames=0 quiet amd_iommu=on iommu=pt nvidia-drm.modeset=1 nvidia-drm.fbdev=1
application doing the screensharing is native wayland and application being screenshared I would assume is running under xwayland, thats the standard for basically every game isn't it?
I have this in my /etc/mkinitcpio.conf to preload the nvidia stuff
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
amd_iommu=on iommu=pt
This is enabled by default on any ryzen platform, so it's redundant.
You didn't provided:
cat /proc/driver/nvidia/paramsand I assume you don't have anything nvidia related in /etc/modprobe.d/?
If you run pure wayland, you should route every game through valve's gamescope compositor.
cat /proc/driver/nvidia/params
ResmanDebugLevel: 4294967295
RmLogonRC: 1
ModifyDeviceFiles: 1
DeviceFileUID: 0
DeviceFileGID: 0
DeviceFileMode: 438
InitializeSystemMemoryAllocations: 1
UsePageAttributeTable: 4294967295
EnableMSI: 1
EnablePCIeGen3: 0
MemoryPoolSize: 0
KMallocHeapMaxSize: 0
VMallocHeapMaxSize: 0
IgnoreMMIOCheck: 0
TCEBypassMode: 0
EnableStreamMemOPs: 0
EnableUserNUMAManagement: 1
NvLinkDisable: 0
RmProfilingAdminOnly: 1
PreserveVideoMemoryAllocations: 1
EnableS0ixPowerManagement: 0
S0ixPowerManagementVideoMemoryThreshold: 256
DynamicPowerManagement: 3
DynamicPowerManagementVideoMemoryThreshold: 200
RegisterPCIDriver: 1
EnablePCIERelaxedOrderingMode: 0
EnableResizableBar: 0
EnableGpuFirmware: 18
EnableGpuFirmwareLogs: 2
RmNvlinkBandwidthLinkCount: 0
EnableDbgBreakpoint: 0
OpenRmEnableUnsupportedGpus: 1
DmaRemapPeerMmio: 1
ImexChannelCount: 2048
CreateImexChannel0: 0
RegistryDwords: ""
RegistryDwordsPerDevice: ""
RmMsg: ""
GpuBlacklist: ""
TemporaryFilePath: "/var/tmp"
ExcludedGpus: ""
yes, /etc/modprobe.d/ is completely empty.
I would like this issue fixed without having to use gamescope since when I don't screenshare games work perfectly fine without gamescope and I get around a 20% performance loss when using gamescope.
Hmmm, at this point this seems like more of an GSP <-> nvidia-open issue, could you try installing full proprietary package and disable GSP by creating a file:
# /etc/modprobe.d/nvidia.conf
# https://download.nvidia.com/XFree86/Linux-x86_64/565.57.01/README/gsp.html
options nvidia NVreg_EnableGpuFirmware=0
It's just for a test if it changes anything, you can switch back to nvidia-open and delete that file, because that'd mean it's just wayland shenanigans, and if it is actually a wayland issue then I'm out of ideas...
Also I'm not sure what 18 as a value means here, and from the what I got on reddit it seems like it forces GSP firmware to be always active in this mode on nvidia-open, so that's why I recommend trying going with nvidia-dkms instead.
Marking this one as offtopic, because it's performance related and just what I noticed on my GTX 1060:
I'm getting around 5-10 FPS more in Tekken 8 and framepacing is a lot more stable with those settings:
# References:
# https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
# https://forums.developer.nvidia.com/t/does-modprobe-d-nvidia-conf-nvreg-enablestreammemops-need-to-be-set-for-gpudirect-to-work/79511
# Requires nvidia.ko >= 510.40.3 loaded with PeerMappingOverride=1. https://docs.nvidia.com/nvshmem/install-guide/index.html
# https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers/en
# https://github.com/ventureoo/nvidia-tweaks
# https://nvdam.widen.net/s/k8vrp9xkft/tech-overview-magnum-io-1790750-r5-web
# https://developer.download.nvidia.com/devzone/devcenter/cuda/docs/GPUDirect_Technology_Overview.pdf
# https://docs.nvidia.com/nvshmem/pdf/NVSHMEM-Installation-Guide.pdf
# Explainations:
# https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/src/nvidia/interface/nvrm_registry.h
# https://github.com/NVIDIA/open-gpu-kernel-modules/blob/main/kernel-open/nvidia/nv-reg.h
options nvidia NVreg_EnableGpuFirmware=0 # Turing and above
options nvidia NVreg_EnableGpuFirmwareLogs=0 # Disable this for Pascal and Maxwell
options nvidia NVreg_UsePageAttributeTable=1
options nvidia NVreg_EnablePCIeGen3=1
options nvidia NVreg_EnableStreamMemOPs=1
options nvidia NVreg_RegistryDwords="PeerMappingOverride=1;"
options nvidia NVreg_EnableResizableBar=1 # Doesn't work on Pascal for some reason...
options nvidia NVreg_EnablePCIERelaxedOrderingMode=1
options nvidia NVreg_InitializeSystemMemoryAllocations=0
I swapped to nvidia-dkms instead of nvidia-open-dkms and added the nvidia.conf file with "options nvidia NVreg_EnableGpuFirmware=0" in the /etc/modprobe.d/ directory and the issue still persists, Thanks for trying at least.