Bug 487833 - Graphical glitches in plasma 6.1 when AMD GPU is used on AMD/NVIDIA hybrid GPU system
Summary: Graphical glitches in plasma 6.1 when AMD GPU is used on AMD/NVIDIA hybrid GP...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: git-stable-Plasma/6.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-31 12:26 UTC by Lucas Lima
Modified: 2024-08-13 16:53 UTC (History)
8 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Lima 2024-05-31 12:26:07 UTC
SUMMARY

Windows and other screen components seem to be glitching in kwin 6.1 beta in wayland 
The issue can be seeing happening here: https://youtu.be/3SYpui4vV-Q

STEPS TO REPRODUCE
1. Move windows around, or enter full-screen in a video in Firefox.
2. 
3. 

OBSERVED RESULT

The screen should glitch with what appears to be content from the windows behind it.

EXPECTED RESULT

Only the contents of the current screen should be shown

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux, Kernel 6.9.2-arch1-1
KDE Plasma Version: 6.1 Beta
KDE Frameworks Version: 6.2
Qt Version: 6.7.1
Mesa Version: 24.1.0-1

ADDITIONAL INFORMATION
This is in a Hybrid Graphics system with AMD Integrated graphics and Nvidia Discrete graphics, using the AMD graphics as the main renderer.
The issues doesn't seem to happen if I use the Nvidia graphics as the primary renderer using KWIN_DRM_DEVICES
Comment 1 David Redondo 2024-06-05 09:53:45 UTC
Does it only happen with Konsole? Is your konsole slightly transparent?
Comment 2 Lucas Lima 2024-06-05 13:45:09 UTC
No, it happens around many applications. I'm not using any transparency in Konsole.
As mentioned, it also happens when displaying a YouTube video in full-screen.

Here's an example of it happening in Firefox: https://youtu.be/xUSUyo_cfNo
Comment 3 David Redondo 2024-06-06 12:01:36 UTC
Thank you quite anooying indeed. To which card are the screens connected?
Comment 4 Lucas Lima 2024-06-06 12:11:35 UTC
So my hardware is the following:

~ lspci -nnk | grep VGA                                                                                  
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104M [GeForce RTX 3080 Mobile / Max-Q 8GB/16GB] [10de:249c] (rev a1)
06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c4)
---

I have a setup to change the main renderer using KWIN_DRM_DEVICES as the following line in /etc/enviroment (please note that there are udev rules to setup those paths mentioned here)

1. KWIN_DRM_DEVICES=/dev/dri/fixed-reference/amd-card:/dev/dri/fixed-reference/nvidia-card

Or when I want when I want to use the nvidia card:

2. KWIN_DRM_DEVICES=/dev/dri/fixed-reference/nvidia-card:/dev/dri/fixed-reference/amd-card

Surprisingly enough, the issue seems to happen only when I'm using the amd-card as the primary renderer. When using 2., the issue doens't seem to happen.
Comment 5 Zamundaaa 2024-06-12 23:22:47 UTC
Can reproduce with Intel + NVidia as well. Replacing the egl explicit sync code used for multi gpu copies in the drm backend with glFinish() makes the glitches go away, so this might be a driver issue.
Comment 6 Lucas Lima 2024-07-01 22:54:43 UTC
Looks like more users are facing the same issue in reddit: https://www.reddit.com/r/kde/comments/1dt0wlj/display_issues_after_nvidia_555_driver_update/
Comment 7 Zamundaaa 2024-07-02 12:46:22 UTC
As the egl explicit sync code was already used in 6.0, I bisected this to figure out what changed and the glitches only happen with triple buffering. As a workaround you can set KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 for KWin.
Comment 8 Bug Janitor Service 2024-07-02 12:49:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6033
Comment 9 Zamundaaa 2024-07-02 13:06:52 UTC
Git commit b437c65815b2898564748f3be48c4145671a750f by Xaver Hugl.
Committed on 02/07/2024 at 12:48.
Pushed by zamundaaa into branch 'Plasma/6.1'.

backends/drm: disable triple buffering on NVidia

Until we figure out what's wrong, it's best to leave it disabled

M  +1    -1    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/b437c65815b2898564748f3be48c4145671a750f
Comment 10 Lucas Lima 2024-07-05 12:11:58 UTC
Hey guys, sorry to bring the bad news but this is still happening in kwin_wayland 6.1.2 when using the AMD graphics as the primary.
Using KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 makes it go away.

Here's some evidence: https://youtu.be/Bp9Lkkh_On8
Comment 11 Zamundaaa 2024-07-05 13:24:13 UTC
The patch didn't make it into 6.1.2, it's only in 6.1.3
Comment 12 Lucas Lima 2024-07-05 13:27:21 UTC
Apologies! Thought it was included based on the change log: https://kde.org/announcements/changelogs/plasma/6/6.1.1-6.1.2/
Comment 13 Andreas Korb 2024-07-17 11:05:23 UTC
The changelog for the Nvidia driver 550.100 [0]:

> Fixed a bug that caused OpenGL triple buffering to behave like double buffering.

[0] https://www.nvidia.com/Download/driverResults.aspx/228542/en-us/
Comment 14 Zamundaaa 2024-07-17 12:40:43 UTC
That's about a different thing, but also great to see that fixed