| Summary: | kwin-wayland struggles with external GPUs | ||
|---|---|---|---|
| Product: | [Plasma] kwin | Reporter: | Khanich <khanich.opensource> |
| Component: | performance | Assignee: | KWin default assignee <kwin-bugs-null> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | nate, xaver.hugl |
| Priority: | NOR | ||
| Version First Reported In: | 6.1.5 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Khanich
2024-09-27 17:10:00 UTC
Gaming on external GPUs is indeed very challenging. By default, what happens is that 1. the app renders on the external GPU. Because of limited bandwidth of the USB C connection and https://gitlab.freedesktop.org/mesa/mesa/-/issues/7340, performance is worse compared to having it in a 16x PCIe slot 2. the driver copies the rendered results to a buffer in system memory 3. KWin gets that buffer in system memory, composites a results with the integrated GPU 4. KWin either presents the composited result directly, or copies the composited result back to the eGPU and presents it on a display connected to that There are efforts to fix that (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/268), but none of this has changed in any way in the last few years. > While trying to run a game fullscreen the eGPU gets used as expected (at least according to radeontop), but I don't see a picture, just a black screen That sounds like a problem we can investigate though. If you put KWIN_DRM_NO_DIRECT_SCANOUT=1 into /etc/environment and reboot, does anything change in regard to that? (In reply to Zamundaaa from comment #1) > Gaming on external GPUs is indeed very challenging. By default, what happens > is that > 1. the app renders on the external GPU. Because of limited bandwidth of the > USB C connection and https://gitlab.freedesktop.org/mesa/mesa/-/issues/7340, > performance is worse compared to having it in a 16x PCIe slot > 2. the driver copies the rendered results to a buffer in system memory > 3. KWin gets that buffer in system memory, composites a results with the > integrated GPU > 4. KWin either presents the composited result directly, or copies the > composited result back to the eGPU and presents it on a display connected to > that > > There are efforts to fix that > (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/ > 268), but none of this has changed in any way in the last few years. > Well, hopefully there won't take as long as many other protocols did. > > While trying to run a game fullscreen the eGPU gets used as expected (at least according to radeontop), but I don't see a picture, just a black screen > That sounds like a problem we can investigate though. If you put > KWIN_DRM_NO_DIRECT_SCANOUT=1 into /etc/environment and reboot, does anything > change in regard to that? I just tested it with this variable in /etc/environment with both a Proton game (Farming Simulator 22 with Proton version 9.0-3) and a native game fullscreen (War Thunder again) and it works. So, the black screen apparently is a bug in KWin's direct scanout implementation I guess? I also decided to do the same test in War Thunder in windowed mode again with this variable and without (because a Patch on the side of WT could have changed this after all and I think I saw a MESA update in the last few days, although I am not sure; besides, it makes thinks more comparable): With variable on internal monitor: ~60 With variable on external monitor connected to the eGPU where the game runs: ~55 Without variable on internal monitor: ~45 Without variable on external monitor connected to the eGPU where the game runs: ~40 I am not sure, but should this be the case in windowed mode? > I am not sure, but should this be the case in windowed mode?
No, the environment variable doesn't change anything for windowed mode (yet)
(In reply to Zamundaaa from comment #3) > > I am not sure, but should this be the case in windowed mode? > No, the environment variable doesn't change anything for windowed mode (yet) Well, in this case there's another bug I guess |