Bug 510579 - [xwayland] VRR not in sync with game FPS
Summary: [xwayland] VRR not in sync with game FPS
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: performance (other bugs)
Version First Reported In: 6.4.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-13 20:07 UTC by Adel KARA SLIMANE
Modified: 2025-10-20 21:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Overwatch showcase video 1 - KDE (1.70 MB, video/mp4)
2025-10-13 20:07 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 2 - KDE (1.47 MB, video/mp4)
2025-10-13 20:08 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 3 - KDE (1.83 MB, video/mp4)
2025-10-13 20:08 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 4 - KDE (1.35 MB, video/mp4)
2025-10-13 20:09 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 1 - GNOME (1.81 MB, video/mp4)
2025-10-13 20:09 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 2 - GNOME (1.83 MB, video/mp4)
2025-10-13 20:09 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 3 - GNOME (2.13 MB, video/mp4)
2025-10-13 20:09 UTC, Adel KARA SLIMANE
Details
Overwatch showcase video 4 - GNOME (1.51 MB, video/mp4)
2025-10-13 20:10 UTC, Adel KARA SLIMANE
Details
kwin journal logs (3.47 KB, application/x-xz)
2025-10-14 19:48 UTC, Adel KARA SLIMANE
Details
drm_info (238.78 KB, text/plain)
2025-10-14 19:48 UTC, Adel KARA SLIMANE
Details
monitor=iGPU env=KWIN_DRM_DEVICES="/dev/dri/card0:/dev/dri/card1" (1.68 MB, video/mp4)
2025-10-15 18:09 UTC, Adel KARA SLIMANE
Details
monitor=iGPU env=KWIN_DRM_NO_DIRECT_SCANOUT=1 (1.68 MB, video/mp4)
2025-10-15 18:10 UTC, Adel KARA SLIMANE
Details
monitor=dGPU env= (1.04 MB, video/mp4)
2025-10-15 18:11 UTC, Adel KARA SLIMANE
Details
Capture without color profile (1.00 MB, video/mp4)
2025-10-15 21:17 UTC, Adel KARA SLIMANE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adel KARA SLIMANE 2025-10-13 20:07:20 UTC
Created attachment 185743 [details]
Overwatch showcase video 1 - KDE

SUMMARY

On Overwatch I could feel that the game isn't smooth and decided to look into it.

I have a 270Hz QHD monitor, driven by / connected to the iGPU of an 9950X3D through USB-C, and an 6950XT dGPU that is used when I game.

The monitor supports VRR and has an embedded FPS counters that can be used to show the VRR FPS it is receiving from the OS. On Overwatch, I realized that the game's FPS doesn't match with the montor's reported VRR FPS (which is much lower), and that is the cause of the junky feel to the game.

I have tested the same on Mutter 48.5 and this issue does not happen.

Please see attached 960FPS video captures

SOFTWARE/OS VERSIONS

Operating System: Gentoo Linux 2.18
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.3
Kernel Version: 6.17.0-tkg-pds-llvm (64-bit)
Graphics Platform: Wayland
Processors: 32 × AMD Ryzen 9 9950X3D 16-Core Processor
Memory: 64 GiB of RAM (60.5 GiB usable)
Graphics Processor 1: AMD Radeon Graphics
Graphics Processor 2: AMD Radeon RX 6950 XT
Comment 1 Adel KARA SLIMANE 2025-10-13 20:08:36 UTC
Created attachment 185744 [details]
Overwatch showcase video 2 - KDE
Comment 2 Adel KARA SLIMANE 2025-10-13 20:08:53 UTC
Created attachment 185745 [details]
Overwatch showcase video 3 - KDE
Comment 3 Adel KARA SLIMANE 2025-10-13 20:09:05 UTC
Created attachment 185746 [details]
Overwatch showcase video 4 - KDE
Comment 4 Adel KARA SLIMANE 2025-10-13 20:09:19 UTC
Created attachment 185747 [details]
Overwatch showcase video 1 - GNOME
Comment 5 Adel KARA SLIMANE 2025-10-13 20:09:35 UTC
Created attachment 185748 [details]
Overwatch showcase video 2 - GNOME
Comment 6 Adel KARA SLIMANE 2025-10-13 20:09:52 UTC
Created attachment 185749 [details]
Overwatch showcase video 3 - GNOME
Comment 7 Adel KARA SLIMANE 2025-10-13 20:10:11 UTC
Created attachment 185750 [details]
Overwatch showcase video 4 - GNOME
Comment 8 Adel KARA SLIMANE 2025-10-13 20:14:56 UTC
I've attached various videos comparing KDE to Gnome (xwayland)
- Number 1: game menu
- Number 2-3: character selection
- Number 4: in game (practice-range, where FPS is smooth 270FPS)
  - This is the main video where we see a huge difference
Comment 9 Zamundaaa 2025-10-14 17:04:06 UTC
Please put
QT_LOGGING_RULES=kwin_wayland_*.debug=true
into /etc/environment, reboot and then attach the output of
> journalctl --user-unit plasma-kwin_wayland --boot 0
and
> drm_info
here
Comment 10 Adel KARA SLIMANE 2025-10-14 19:48:03 UTC
Hey,

Thanks for your quick input !

journalctl --user-unit plasma-kwin_wayland --boot 0

Did not output anything, so I am attaching instead

journalctl --boot 0 --grep kwin
Comment 11 Adel KARA SLIMANE 2025-10-14 19:48:27 UTC
Created attachment 185774 [details]
kwin journal logs
Comment 12 Adel KARA SLIMANE 2025-10-14 19:48:47 UTC
Created attachment 185775 [details]
drm_info
Comment 13 Zamundaaa 2025-10-15 15:59:10 UTC
Alright, KWin is running on the integrated GPU, so the driver is doing multi GPU copies under the hood. I would assume that if these copies were too slow, the game would be throttled as well.

Does anything change if you put
KWIN_DRM_NO_DIRECT_SCANOUT=1
into /etc/environment and reboot?

Also, without the direct scanout environment variable, does
KWIN_DRM_DEVICES="/dev/dri/card0:/dev/dri/card1"
make a difference?

Also, without any environment variables, does connecting the screen to the dedicated GPU and rebooting help?
Comment 14 Adel KARA SLIMANE 2025-10-15 17:27:35 UTC
> Alright, KWin is running on the integrated GPU, so the driver is doing multi GPU copies under the hood. I would assume that if these copies were too slow, the game would be throttled as well.

Somehow, with the same configuration (monitor connected to iGPU), on GNOME the iGPU utilization is 0% while the game takes the full screen, as if it switches entirely to the dGPU (the CPU utilization remains the same, so I am assuming that it doesn't go through RAM instead), but the moment I press Win key, which triggers the overview animation, utilization on iGPU goes up (because composition is happening instead I assume): GNOME seems to be doing something better than KDE.

Let me try your suggestions then come back to you
Comment 15 Adel KARA SLIMANE 2025-10-15 18:09:53 UTC
Created attachment 185811 [details]
monitor=iGPU env=KWIN_DRM_DEVICES="/dev/dri/card0:/dev/dri/card1"
Comment 16 Adel KARA SLIMANE 2025-10-15 18:10:59 UTC
Created attachment 185812 [details]
monitor=iGPU env=KWIN_DRM_NO_DIRECT_SCANOUT=1
Comment 17 Adel KARA SLIMANE 2025-10-15 18:11:52 UTC
Created attachment 185813 [details]
monitor=dGPU env=
Comment 18 Adel KARA SLIMANE 2025-10-15 18:16:45 UTC
Summary:

monitor=iGPU env=KWIN_DRM_DEVICES="/dev/dri/card0:/dev/dri/card1"
-> Made things worse: max FPS dropped, VRR-FPS all over the place

monitor=iGPU env=KWIN_DRM_NO_DIRECT_SCANOUT=1
-> No noticeable difference

monitor=dGPU env=
-> No issues anymore. So as we both guessed, it has something to do with having the monitor connected to the iGPU but using the dGPU for the game
Comment 19 Zamundaaa 2025-10-15 20:07:53 UTC
Maybe Gnome happens to hit direct scanout? If you have any of
- a color profile
- hdr
- night light
- non-default kwin effects
enabled, you don't get direct scanout in KWin. Other driver specific things can prevent it from working too.

In general that's a setup that's bound to hit problems to be honest. The integrated GPU is probably just not always fast enough to provide consistent results for compositing at those refresh rates when any other load is involved on top - the iGPU in your case only has two cores after all.
Comment 20 Adel KARA SLIMANE 2025-10-15 21:17:49 UTC
Created attachment 185818 [details]
Capture without color profile

> In general that's a setup that's bound to hit problems to be honest. The integrated GPU is probably just not always fast enough to provide consistent results for compositing at those refresh rates when any other load is involved on top - the iGPU in your case only has two cores after all.

Yeah I know, but it saves 40W of power (according to my wall powermeter 120W vs 160W), and I use my computer 8h a day, I thought it'd be a useless waste.

Thanks for you input! Turns out I was using a color profile (entirely forgot about it), removing that fixes the issue: the VRR FPS is smooth 270. But the iGPU usage is however still high, so there's probably something Kwin could take from Mutter :D
Comment 21 Zamundaaa 2025-10-17 12:31:47 UTC
If performance is good, I don't think KWin can be using the iGPU for compositing.
With that in mind though, I don't think there's really anything we can do here, except hoping that AMD will make their small iGPUs in normal CPUs more performant in future generations.

As for power usage, in the not so far future, we'll be able to do dynamic GPU switching in KWin, so you could then use a KVM to switch between iGPU and dGPU depending on the situation.
Comment 22 Adel KARA SLIMANE 2025-10-17 14:23:39 UTC
> As for power usage, in the not so far future, we'll be able to do dynamic GPU switching in KWin, so you could then use a KVM to switch between iGPU and dGPU depending on the situation.

Is that what Mutter is doing automatically, by achieving 0% iGPU usage when fullscreen in-game, while the monitor is still connected to the iGPU ?

> With that in mind though, I don't think there's really anything we can do here

If the answer to the above question is no, then Kwin could definitely do something right ?

Thanks !
Comment 23 Adel KARA SLIMANE 2025-10-20 20:45:07 UTC
@Zamundaaa Mutter seems to indeed be doing something smart: "accelerated iGPU/dGPU framebuffer sharing"

Look at this
https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/backends/native/meta-renderer-native.c?ref_type=heads#L2031
Comment 24 Adel KARA SLIMANE 2025-10-20 21:21:38 UTC
I opened a separate bug report on the matter: 510847. Thanks again!
Comment 25 Adel KARA SLIMANE 2025-10-20 21:21:56 UTC
see bug 510847