Bug 505954 - Dramatic Factorio Wayland rendering performance regression
Summary: Dramatic Factorio Wayland rendering performance regression
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (other bugs)
Version First Reported In: 6.4.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-06-22 03:55 UTC by Jean-Francois Roy
Modified: 2025-06-25 16:15 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.4.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Francois Roy 2025-06-22 03:55:19 UTC
SUMMARY
I just updated my Arch system to KDE Plasma 6.4 and the rendering performance of Factorio using the Wayland backend has seriously degraded. The performance of the X11 backend appears to be the same as before.

You can reproduce in a brand new standard scenario game or just from the main menu using game's free demo.

https://factorio.com/download

STEPS TO REPRODUCE
1. Launch Factorio in a Wayland session
2. Settings > Graphics > Select Wayland backend and restart

OBSERVED RESULT
Extremely poor rendering performance and large CPU usage.

EXPECTED RESULT
Normal CPU usage and 60 fps.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1
Kernel Version: 6.15.3-2-cachyos (64-bit)
Graphics Platform: offscreen
Processors: 32 × AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 64 GiB of RAM (62.4 GiB usable)

ADDITIONAL INFORMATION
A Factorio bug report was filed at https://forums.factorio.com/viewtopic.php?t=129517. It is unlikely to be a Factorio issue, but it could be an SDL issue.
Comment 1 orangep9 2025-06-22 18:49:05 UTC
I also have the issue described above.

Operating System: Arch Linux 
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1
Kernel Version: 6.15.2-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 7900X 12-Core Processor
Memory: 32 GiB of RAM (30.5 GiB usable)
Graphics Processor 1: NVIDIA GeForce RTX 4070 Ti SUPER/PCIe/SSE2
Graphics Processor 2: NVIDIA GeForce RTX 4070 Ti SUPER/PCIe/SSE2
Manufacturer: ASUS
Comment 2 Vlad Zahorodnii 2025-06-23 07:38:07 UTC
Do you know whether factorio uses SDL?
Comment 3 bartlomiej345 2025-06-23 13:46:26 UTC
> Do you know whether factorio uses SDL?

Yes, it does. They statically link it. (https://www.factorio.com/blog/post/fff-408)
Comment 4 orangep9 2025-06-23 13:48:59 UTC
(In reply to Vlad Zahorodnii from comment #2)
> Do you know whether factorio uses SDL?

Factorio does use SDL you can see confirmation of that about half way through this blog post. https://www.factorio.com/blog/post/fff-408
The setting that they mentioned adding in 2.0 "Preferred Video Driver" is the one that we are changing from "Wayland" to "X11" in order to restore performance.
Comment 5 Jean-Francois Roy 2025-06-24 05:44:01 UTC
A forum member pointed out from the log that Factorio had fallen off to software rendering (llvmpipe). So something is preventing SDL from initializing a hardware context.

I have an Nvidia GPU using the Arch packaged drivers (575.64 as of right now).
Comment 6 Jean-Francois Roy 2025-06-24 20:26:46 UTC
The issue appears to in fact only reproduce with the Steam version of the game. Even with the Steam overlay disabled, the llvmpipe OpenGL implementation gets picked. The same game version downloaded from the web site with the same config properly loads my GPU vendor (Nvidia)'s OpenGL driver.
Comment 7 bartlomiej345 2025-06-25 13:49:13 UTC
I just tested it after updating KDE to 6.4.1 (on Arch) and the issue is gone. Factorio (Steam version) now properly detects my NVIDIA card. Someone else on Factorio forums also reported that 6.4.1 fixes the problem.
Comment 8 Nate Graham 2025-06-25 13:51:05 UTC
Could be the direct scanout fix in 6.4.1. Good news, and thanks for following up!
Comment 9 Jean-Francois Roy 2025-06-25 16:15:27 UTC
(In reply to Nate Graham from comment #8)
> Could be the direct scanout fix in 6.4.1. Good news, and thanks for
> following up!

I just did some regression testing on this using the changelog, and it's actually "Wayland_server: re-enable wl_drm by default." https://invent.kde.org/plasma/kwin/-/commit/3fbcdf475b67faf129034baacfcef8b38d8306af. I'm guessing the steam API or overlay or some other component they inject depends on wl_drm, and if it fails, it fails the entire OpenGL context creation, which causes SDL to fallback to software. Probably something KDE could follow up with Valve, and probably worth an additional comment in the code.