Bug 502902

Summary: games renders only when window is not in focus
Product: [Plasma] kwin Reporter: benato.denis96
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED UPSTREAM    
Severity: normal CC: xaver.hugl
Priority: NOR    
Version First Reported In: 6.3.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description benato.denis96 2025-04-17 01:17:44 UTC
SUMMARY
I have been chasing an issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12744 that led me here.
Rendering certain games with an amdgpu on the screen attached to it makes it behave EXACTLY as if

if (window_in_focus) {} else {render()}

so the exact opposite of how it should work. Moving the window on another screen (connected to the igpu) solves the issue.

STEPS TO REPRODUCE
Assuming you have a system with an igpu and a gpu (can be internal. oculink or thunderbolt)
1.  Start the monster hunter wilds benchmark (free on steam) using the amdgpu rendering on the attached screen
2. Reproduced

OBSERVED RESULT
game changes frame only when not in focus

EXPECTED RESULT
game changes frame regardless of being in focus

SOFTWARE/OS VERSIONS
All plasma 6+ versions are affected. 5 are untested. Happens on every distro I tested. This issue was present in gnome too but they fixed it recently.
Comment 1 Zamundaaa 2025-04-17 11:53:28 UTC
Please follow https://invent.kde.org/plasma/kwin/-/wikis/Debugging/Debugging-DRM-issues to get a drm debug log and matching KWin log of the situation when the game is frozen
Comment 2 benato.denis96 2025-04-25 14:11:58 UTC
(In reply to Zamundaaa from comment #1)
> Please follow
> https://invent.kde.org/plasma/kwin/-/wikis/Debugging/Debugging-DRM-issues to
> get a drm debug log and matching KWin log of the situation when the game is
> frozen

https://cloud.neroreflex.duckdns.org/index.php/s/VkSf3zE3DbXO8m8
Comment 3 Zamundaaa 2025-05-06 14:34:47 UTC
Ok, this is the issue:
> [drm:amdgpu_dm_plane_helper_prepare_fb [amdgpu]] *ERROR* Failed to pin framebuffer with error -22

That's a driver bug, and tracked at https://gitlab.freedesktop.org/drm/amd/-/issues/2075

I *think* Plasma 6.3+ shouldn't be affected by this bug, because it attempts presentation in a different way, but either way you can use https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_drm_no_direct_scanout to disable direct scanout and work around the bug that way.