Warning: Undefined variable $s_watching_topic_img in /usr/home/zenrat/public_html/tech/forums/viewtopic.php on line 677
|
Gamescope nested performance is poor under Liquorix
Gaming under Gamescope in nested mode (on top of a graphical desktop session) on 7.2.12-1-liquorix-amd64 is not very good. Mouse movement is jittery and/or choppy. Keyboard inputs are either delayed, prolonged, or dropped. When booting into the stable 6.1.0-54-amd64 kernel for Debian 12 I do not have this problem, which means that this may be unique to Liquorix / Zen. Could it be because of the higher polling rate? I can't remember if I always had this problem because I haven't been using Liquorix for that long.
:: Code :: MESA_VK_WSI_PRESENT_MODE=immediate-The issue does not happen with Liquorix in drm mode, i.e. when Gamescope is launched from a TTY terminal -The issue does not seem to happen with games that use a controller, i.e. no mouse/keyboard input at all -The issue does not happen when playing a game without Gamescope (this is simply not an option for me, so many games require Gamescope to set fullscreen on the right monitor, scale properly, not crash with ALT+TAB, etc) -The issue is present under both Wayland and Xorg sessions -No combination of Gamescope launch flags fixes the issue (--rt --immediate-flips --force-grab-cursor --adaptive-sync) -Setting CPU governor to performance does not help My system info: :: Code ::
System: Kernel: 7.2.12-1-liquorix-amd64 arch: x86_64 bits: 64 compiler: gcc v: 12.2.0 Desktop: GNOME v: 43.9 tk: GTK v: 3.24.38 wm: gnome-shell dm: GDM3 Distro: Debian GNU/Linux 12 (bookworm) Machine: Type: Desktop System: Micro-Star product: MS-7C91 v: 1.0 serial: <superuser required> Mobo: Micro-Star model: MAG B550 TOMAHAWK MAX WIFI (MS-7C91) v: 1.0 serial: <superuser required> UEFI: American Megatrends LLC. v: 2.A0 date: 09/03/2025 Battery: Device-1: hid-0003:17EF:60EE.0005-battery-19 model: Lenovo TrackPoint Keyboard II serial: N/A charge: N/A status: N/A Device-2: sony_controller_battery_00:24:33:6c:e4:a7 model: N/A serial: N/A charge: N/A status: N/A CPU: Info: 16-core AMD Ryzen 9 5900XT [MT MCP] arch: Zen 3+ speed (MHz): avg: 3869 min/max: 2200/4981 Graphics: Device-1: AMD Navi 14 [Radeon RX 5500/5500M / Pro 5300/5300M/5500M] vendor: Hewlett-Packard driver: vfio-pci v: N/A arch: RDNA-1 pcie: speed: 16 GT/s lanes: 16 bus-ID: 06:00.0 chip-ID: 1002:7340 Device-2: AMD Navi 23 [Radeon RX 6600/6600 XT/6600M] vendor: XFX driver: amdgpu v: kernel arch: RDNA-2 pcie: speed: 16 GT/s lanes: 16 ports: active: DP-2,DP-3 empty: DP-1,HDMI-A-1,Writeback-1 bus-ID: 2d:00.0 chip-ID: 1002:73ff Device-3: Linux Foundation EEM Gadget type: USB driver: snd-usb-audio,uvcvideo bus-ID: 3-3.1.1.3:9 chip-ID: 1d6b:0102 Display: wayland server: X.org v: 1.21.1.7 with: Xwayland v: 22.1.9 compositor: gnome-shell driver: X: loaded: amdgpu dri: radeonsi gpu: vfio-pci,amdgpu d-rect: 6000x6000 display-ID: 0 Monitor-1: DP-2 pos: primary,top-left res: 2160x3840 size: N/A Monitor-2: DP-3 pos: bottom-r model: DEL DELL S3225QS res: 3840x2160 dpi: 139 diag: 806mm (31.74") API: OpenGL v: 4.6 Mesa 25.0.7-2~bpo12+1 renderer: AMD Radeon RX 6600 (radeonsi navi23 LLVM 15.0.6 DRM 3.64 7.2.12-1-liquorix-amd64) direct-render: Yes Network: Device-1: MEDIATEK MT7922 802.11ax PCI Express Wireless Network Adapter driver: mt7921e v: kernel pcie: speed: 5 GT/s lanes: 1 bus-ID: 29:00.0 chip-ID: 14c3:0616 Device-2: Realtek RTL8125 2.5GbE vendor: Micro-Star MSI driver: r8169 v: kernel pcie: speed: 5 GT/s lanes: 1 port: d000 bus-ID: 2a:00.0 chip-ID: 10ec:8125 Drives: Local Storage: total: 72.82 TiB used: 63.3 TiB (86.9%) Info: Processes: 816 Uptime: 1d 2h 31m Memory: 46.96 GiB used: 16.55 GiB (35.3%) Init: systemd v: 254 target: graphical (5) default: graphical Compilers: gcc: 12.2.0 alt: 11/12 clang: 19.1.7 Packages: pm: dpkg pkgs: 6830 Shell: Bash v: 5.2.15 running-in: ghostty inxi: 3.3.26 I tried booting into 7.2.13-1-liquorix-amd64 today, but it was not able to find my displays, so that is a completely separate issue I'm having too. I guess I will wait for the next update and see if I can get a graphical session, but until then I've been really curious about this Gamescope problem. What could be causing this? Back to top |
|||||
|
:: Quote :: Gaming under Gamescope in nested mode (on top of a graphical desktop session) on 7.2.12-1-liquorix-amd64 is not very good.Even if gamescope supports nested mode, I highly recommend you do not use gamescope this way. It's meant to be a thin compositor that you run as the first and only layer to present games to your screen. Nested gamescope really is just a way to test if gamescope works for what you're trying to do _at all_. If you're already in a desktop, gamescope will only make things worse, not better in anyway. The reason why is you're compositing twice, once in gamescope, and another in the parent compositor (kwin for KDE, mutter for Gnome). The only advantage you get from gamescope is if you dedicate it its own TTY to run natively and manage resolution, HDR, frame pacing, VRR, all of that. As much as I'd like to figure out a solution that's unique to Liquorix, this is already a pathological use case and I don't believe anyone would play games like this long term. However if you're trying to test if gamescope works, once you've verified then you can setup a gamescope session to replace your regular desktop to reap all the benefits of what gamescope can do when run first party. Back to top |
|||||
|
While I agree that it's not ideal to composite twice, many games just have issues without it. With the way things are now, that means I'd have to open a TTY every time I want to play these games, which also means no easy multitasking while the game is open.
As I mentioned in my OP, I have a game that just refuses to fullscreen on the right monitor. Others crash with ALT+Tab. Problems like this are fixed by Gamescope. :: Quote :: As much as I'd like to figure out a solution that's unique to Liquorix, this is already a pathological use case and I don't believe anyone would play games like this long termI can assure you that this is the intended use case and that 90% of people on desktop Linux are using it this way. Notwithstanding the many testimonials you can find across sites like Github and Reddit, launchers such as Lutris have it toggle-able in their GUI, even Gamescope's own help output lists options for "nested mode", borderless windows and other options related to running in a desktop session. Back to top |
|||||
|
I tested this some more and it seems like performance is perfectly fine if Gamescope is running in a window. If it's fullscreen, or even a borderless window set to my native dimensions, the aforementioned problems happen. As I said, this does not happen on the default kernel for Debian. I don't know what this could mean.
I've been trying to change as many of my launch scripts as possible to stop using Gamescope, but it's been hard. I was also using Gamescope to apply shaders with vkBasalt. I found out that I can use the zink driver to translate OpenGL games to Vulkan, but performance is far worse when I want to use CRT Royale and I also have to render my game at 4K for it to look halfway decent. With Gamescope you can set a game's dimensions to be smaller but the window that the shaders are running on will be high resolution. Back to top |
|||||
|
I have a few things I'd like you to try.
1. Boot with sched_pds_sleep_credit=0 in your kernel boot parameters 2. Boot with nothreadirqs separately Then after verifying those do or don't fix your problem, with the bad configuration, please run these while you are gaming: :: Code :: sudo perf sched record -a -o stutter.data -- sleep 20 # fullscreen, moving the mouse the whole time
sudo perf sched record -a -o windowed.data -- sleep 20 # same game windowed, as control ps -eLo pid,tid,comm,cls,rtprio,ni,psr | grep -iE 'gamescope|xwayland|gnome-shell' > threads.txt cat /proc/cmdline > cmdline.txt tar -I zstd -cf stutter.tar.zst stutter.data windowed.data threads.txt cmdline.txt As for where to upload, you'll need to find some way to upload for me to download later. Back to top |
|||||
|
Well unfortunately I discovered something else that makes the problem even more complicated. Gamescope windowed is only perfect when I have the MESA_VK_WSI_PRESENT_MODE=immediate variable exported in my launch script. Without it, the performance is just as bad if not worse than fullscreen. Because I've been playing games with that variable ever since I made the thread, I collected perf data with that env var, as that's the only way to get a "perfect" session that I know of.
Neither of the boot params changed anything. I tried them one at a time, as instructed. nothreadirqs possibly made it worse. I then reverted my grub config back to normal to collect the perf data. Game tested: Half-Life 1 with xash3d-fwgs engine Launch command: windowed :: Code :: gamemoderun gamescope -w 1024 -h 768 -W 2880 -H 2160 --backend sdl --mangoapp --force-grab-cursor -b --rt -- './xash3d' -game valve -console +con_notifytime 0 +hud_scale 1fullscreen :: Code :: gamemoderun gamescope -w 1024 -h 768 --backend sdl --mangoapp -f --force-grab-cursor --rt -- './xash3d' -game valve -console +con_notifytime 0 +hud_scale 1It's worth noting that I did not realize how much heavy lifting MESA_VK_WSI_PRESENT_MODE=immediate was doing. Mouse stuttering was actually not very noticeable in fullscreen this time, but that could have gotten worse if I played for longer. The more annoying issue was the delayed/overheld key presses. Here's the zstd file, should be good for 10 days: https://gofile.io/d/egywuIAQ Back to top |
|||||
|
Ok this helps quite a bit. What it looks like from your traces is that when proper full screen, the swapchain thread wakes up about 1200 times per second. When run from a window, it's just above 200 a second.
What I suspect is happening is that when in window'd mode, vsync is forced by the Gnome shell, limiting the amount of work per refresh of your display. But when run in fullscreen, gamescope is unredirect (write directly to screen), and is allowed to run at unlimited refresh rates. Maybe you can pass in -r <refresh_rate> into gamescope to mitigate fullscreen? As for why this only appears to be an issue when you use gamescope inside of gnome-shell, apparently gamescope works through an X11 socket, so the more activity there is (frames, input from your keyboard/mouse), the more congestion there is. The worst configuration is high sampling rate mice + high frame rate games, this configuration will decimate gamescope under Xwayland. Controllers don't cause as many issues because of their low sampling rate. So IMO, the real problem is how Xwayland impacts this situation. But, I noticed you're on Debian 12. It's considered oldstable at this point, you probably stand to gain some performance wins by staying on modern stable (Debian 13). Remember, a lot of the advances of gaming that really matter came out in the last few years, and every few months there's another massive improvement. Running a distribution that was frozen in 2023 is not going to help with your situation at all. Back to top |
|||||
|
Oh, and unfortunately, framerate limiting on Gnome Wayland session is broken and there's an open issue: github.com/ValveSoftware/gamescope/issues/1479
You will probably want to change your desktop entirely, but I'd first try upgrading as you're probably experiencing known issues that have long been fixed. Even after you upgrade, the freeze for Debian 13 was 2025, there's still plenty more fixes and improvements made by both Gnome and KDE that make the experience of gaming on Linux much better, but you're only going to get that on rolling release. Maybe it's worthwhile to dual boot an Arch based distro for gaming and preserve your Debian install for everything else? Back to top |
|||||
|
All times are GMT - 8 Hours
|
|||||