Bug 497991 - Severe lag with direct scanout
Summary: Severe lag with direct scanout
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: 6.2.4
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-28 17:05 UTC by Ken Vermette
Modified: 2025-02-24 03:46 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Vermette 2024-12-28 17:05:31 UTC
SUMMARY
When an application goes full-screen on KWin-Wayland it becomes unusable due to lag when KWin disables compositing. Using the "Show Compositing" effect to display when compositing is active shows this is the issue.

STEPS TO REPRODUCE
1. Enable "Show Compositing" effect (optional)
2. Open any full-screen application (Video players, games)
3. Put the application into a full-screen state, if not already in full-screen.

OBSERVED RESULT
Extreme frame-rate drops, stuttering mouse. "Feels" within the range of 12fps.

EXPECTED RESULT
Smooth video playback, or smooth gameplay under low load.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon 6.2
KDE Plasma Version: 6.2.4 (also present in at least 6.2.3)
KDE Frameworks Version: 6.9.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION
 - The "Show FPS" effect forces compositing to be enabled, so it cannot be used to benchmark. It does prove that it's not otherwise a performance issue.
 - For quick testing, shaking the mouse momentarily enables compositing. You can shake the mouse to instantly see full-screen applications run smoothly.
 - Some applications, like Firefox, do not disable compositing in full-screen mode. Applications exhibiting this effect include Haruna (Video player), Factorio (Game), Oxygen not Included (Game).
 - Using Intel Arc Graphics

WORKAROUNDS:
 - Using a brew of KWin rules, games can be forced to run full-screen in a composited environment.
Comment 1 Nate Graham 2025-01-04 04:58:59 UTC
KWin doesn't disable compositing on Wayland, JFYI; this only happens on X11. So if you're using Wayland, the issue isn't caused by disabling compositing.
Comment 2 Ken Vermette 2025-01-07 00:35:58 UTC
Here is a video of the issue as described:
https://youtu.be/KkPrFrWLmaI

Specifically during the Factorio segments you can see the game visibly speed up and slow down depending on the state of 'compositing' (as reported by the plugin); I shake the mouse several times during the video to force compositing during gameplay. When 'compositing' is off, the mouse is also incredibly sluggish and stuttery.

Big buck bunny is a bit harder to see the issue with, but it's in the video as well.

It's likely an issue when Kwin kicks into direct scanout, but that's a lamens' best guess. If there's a method to disable direct scanout, I'm willing to give it a shot.
Comment 3 Nate Graham 2025-01-07 17:51:37 UTC
Thanks. I'll let the KWin devs investigate from here.
Comment 4 Zamundaaa 2025-01-09 14:04:03 UTC
(In reply to Ken Vermette from comment #2)
> It's likely an issue when Kwin kicks into direct scanout, but that's a
> lamens' best guess. If there's a method to disable direct scanout, I'm
> willing to give it a shot.
There's https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_drm_no_direct_scanout for that
Comment 5 Ken Vermette 2025-01-10 18:24:14 UTC
(In reply to Zamundaaa from comment #4)
> (In reply to Ken Vermette from comment #2)
> > It's likely an issue when Kwin kicks into direct scanout, but that's a
> > lamens' best guess. If there's a method to disable direct scanout, I'm
> > willing to give it a shot.
> There's
> https://invent.kde.org/plasma/kwin/-/wikis/Environment-
> Variables#kwin_drm_no_direct_scanout for that

Okay, aaaaannnnddd.... That works like a charm!

So it seems scanout and Intel Arc don't play too nicely. I personally am happy, but I'll check into this ticket later and do any troubleshooting steps in case you want to use me as your guinea pig. :)

For any Googlers, run the command "kate /etc/environment" (might create a new file) and add the line:
KWIN_DRM_NO_DIRECT_SCANOUT=1
Then save & restart.
Comment 6 Zamundaaa 2025-01-25 12:49:37 UTC
The assumption that it's a driver bug seems likely, but let's try to verify it and move the bug report to the driver devs if possible.

To do that, can you follow the steps at https://invent.kde.org/plasma/kwin/-/wikis/Debugging/Debugging-DRM-issues?redirected_from=Debugging-DRM-issues to get a drm debug log for when direct scanout kicks in?
Comment 7 Bug Janitor Service 2025-02-09 03:47:04 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Bug Janitor Service 2025-02-24 03:46:42 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.