Bug 494547 - Parts of external screens "flickering"
Summary: Parts of external screens "flickering"
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 6.2.0
Platform: Fedora RPMs Linux
: NOR grave
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen, regression
Depends on:
Blocks:
 
Reported: 2024-10-11 15:42 UTC by Lech
Modified: 2024-10-15 20:50 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lech 2024-10-11 15:42:04 UTC
SUMMARY

After upgrading to KDE 6.2.0 on Wayland on Fedora 40, I experienced screen "flickering" on my external monitors connected to a laptop. Most visible on updating items, such as panels with widgets or movies.




STEPS TO REPRODUCE
1. Run KDE 6.2.0 on Wayland on an optimus laptop with AMD Radeon 780M/NVidia 4070 graphic cards
2. Connect any external monitor (HDMI or USB-C->DP)
3. Observe the flickering on updating objects (panels, movies) on external monitors

OBSERVED RESULT

By "flickering" I mean very short corruptions of parts of the screen. Too short to notice what the corruptions "include", but I think sometimes garbage, sometimes parts of windows from other parts of the screen. Not sure though. Most visible on movies, because occupying bigger part of the screen (not whole image though). Tried with movies playing both in Firefox and through the system player.

EXPECTED RESULT

No flickering/corruption. Was perfectly fine before the update, on Plasma 6.1.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 40
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION

1. Bug present regardless if 1 or 2 external monitors is connected, and which one of them (HDMI or USB-C->DP)
2. Not present on the built-in monitor of the laptop, regardless of the refresh rate (144 Hz, or 60 Hz like the external monitors)
3. Chaning scaling on the external monitors did not help
4. I am not sure if both my external monitors are connected to the dGPU, or just one. My laptop is ASUS TUF Gaming A15 FA507XI_FA507XI
Comment 1 Lech 2024-10-11 16:37:06 UTC
An update: after ~3 hours of work, screens started flickering very often even with all programs minimised, and kwin_wayland process started using >=62% of a single core. Closing the programs did not help, but logging out and back into KDE brought the situation back to the somewhat less intrusive flickering described in the main bug report.
Comment 2 Zamundaaa 2024-10-12 17:18:00 UTC
Git commit 0133431c1d4b8a07ff5027df7f59928382562b38 by Xaver Hugl.
Committed on 12/10/2024 at 17:00.
Pushed by zamundaaa into branch 'master'.

backends/drm: disable triple buffering on NVidia by default

There's some unresolved glitches on multi gpu systems. Until that's taken care of,
triple buffering is disabled by default on NVidia unless the environment variable
KWIN_DRM_DISABLE_TRIPLE_BUFFERING=0 is set
Related: bug 494407

M  +3    -2    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/0133431c1d4b8a07ff5027df7f59928382562b38
Comment 3 Lech 2024-10-12 18:10:06 UTC
Thank you! export KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 for the session fixed the problem. When will it no longer be needed?
Comment 4 Zamundaaa 2024-10-12 20:38:21 UTC
Git commit b3358350b67b39ecea8fd4234df4ad8c0fa99017 by Xaver Hugl.
Committed on 12/10/2024 at 20:14.
Pushed by zamundaaa into branch 'Plasma/6.2'.

backends/drm: disable triple buffering on NVidia by default

There's some unresolved glitches on multi gpu systems. Until that's taken care of,
triple buffering is disabled by default on NVidia unless the environment variable
KWIN_DRM_DISABLE_TRIPLE_BUFFERING=0 is set
Related: bug 494407


(cherry picked from commit 0133431c1d4b8a07ff5027df7f59928382562b38)

Co-authored-by: Xaver Hugl <xaver.hugl@gmail.com>

M  +3    -2    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/b3358350b67b39ecea8fd4234df4ad8c0fa99017
Comment 5 Nick H 2024-10-12 22:59:13 UTC
(In reply to Lech from comment #3)
> Thank you! export KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1 for the session fixed
> the problem. When will it no longer be needed?

Lech - How did you apply that fix?
(thanks)
Comment 6 Lech 2024-10-13 07:55:07 UTC
I've created kwin_settings.sh file in  ~/.config/plasma-workspace/env and added there:
export KWIN_DRM_DISABLE_TRIPLE_BUFFERING=1

This way the file is called when KDE is started and the variable is set for the whole session. It can be confirmed with "printenv".
Comment 7 Zamundaaa 2024-10-13 21:10:47 UTC
*** Bug 494675 has been marked as a duplicate of this bug. ***