Bug 510847 - Feature request: implement zero-copy shared buffers on iGPU+dGPU systems
Summary: Feature request: implement zero-copy shared buffers on iGPU+dGPU systems
Status: RESOLVED NOT A BUG
Alias: None
Product: kwin
Classification: Plasma
Component: egl (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-20 21:20 UTC by Adel KARA SLIMANE
Modified: 2025-10-21 22:11 UTC (History)
1 user (show)

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


Attachments
Kwin: Overwatch iGPU+dGPU utilization (1.00 MB, video/mp4)
2025-10-20 21:24 UTC, Adel KARA SLIMANE
Details
Mutter: Overwatch iGPU+dGPU utilization (1.51 MB, video/mp4)
2025-10-20 21:25 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-20 21:20:57 UTC
SUMMARY

While playing games (Xwayland) on my iGPU+dGPU system, with the monitor connected to the iGPU while the game is running on the dGPU, I can see that 
- Kwin: 100% utilization on both GPUs
- Mutter: 100% only on the dGPU, while the game is in fullscreen, mid-utilization otherwise (in "overview" mode for example, where compositing is happening)

This would entirely remove performance issues where the iGPU is too slow to follow (see bug bug 510579) and would make using the iGPU as primary entirely equivalent (or better?) to plugging the screen to the dGPU in terms of performance, while having better power savings when the dGPU is unused (in which case it's entirely off, it saves 40W in my machine)

I suspect that this is because gnome uses "accelerated iGPU/dGPU framebuffer sharing" in zero-copy mode [1] for which I could not see a counterpart in Kwin's code-base.

Thank you very much!

[1] https://gitlab.gnome.org/GNOME/mutter/-/blob/4ebec786d7aed50a9a2fb0d22305a1995378937d/src/backends/native/meta-renderer-native.c#L2031


SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux 2.18
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.3
Kernel Version: 6.17.2-tkg-eevdf (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


ADDITIONAL INFORMATION
This came up while I was reporting bug 510579
Comment 1 Adel KARA SLIMANE 2025-10-20 21:24:44 UTC
Created attachment 185936 [details]
Kwin: Overwatch iGPU+dGPU utilization
Comment 2 Adel KARA SLIMANE 2025-10-20 21:25:31 UTC
Created attachment 185937 [details]
Mutter: Overwatch iGPU+dGPU utilization
Comment 3 Zamundaaa 2025-10-21 12:51:57 UTC
The (very much implemented) zero copy mode is not relevant for this at all. Your investigation is welcome, but like I already said, you just happen to hit direct scanout on Mutter, because you didn't have a color profile set there.

There is really nothing that can be done about your setup.
Comment 4 Adel KARA SLIMANE 2025-10-21 13:18:31 UTC
I am really sorry for bothering you, but there's something you seem to miss: 
- with the color profile disabled in KDE, the iGPU usage is still ~100%, 
  - but it does fix VRR-FPS issue in  bug 510579. 
- Gnome does not have that behavior and the iGPU usage is 0%

I tried to disable fractional scaling in KDE (the only extra setting I had vs Gnome) but that made no difference.

So there probably is something Kwin could do, given the difference in behavior in Kwin vs Mutter
Comment 5 Adel KARA SLIMANE 2025-10-21 13:19:38 UTC
PS: see the two videos attached to understand what I mean. Thanks again!
Comment 6 Zamundaaa 2025-10-21 21:06:16 UTC
Okay, first thing to check would be if you actually get direct scanout, or if the color profile just happened to increase iGPU load enough to cause the issue.
You can do that with the kwin debug console, just search for "kwin debug console" in krunner. The rightmost tab in it has the "showcompositing" effect, if you load it, it will show "compositing" in the top right unless direct scanout happens.

The second thing to check, if you do get direct scanout, would be whether or not the iGPU is actually used by KWin or some other process. nvtop should be able to show that; you can run it through ssh (to not show anything above the fullscreen game).
Comment 7 Adel KARA SLIMANE 2025-10-21 22:11:52 UTC
Hey,

Thank you very much for your time and for the instruction for this nifty debug feature to show whether direct scanout is happening or not !

So, I wasn't hitting direct scanout, and... Sorry for being ignorant... I had the color profile set to 'built-in' thinking that was the default mode (which fixed my VRR-FPS sync issue), I changed it to 'None' and I started hitting direct scanout with 0% iGPU usage. 

Apologies... and thank you again ! I'll make sure to document it and have this information be available in the wild