Bug 450779 - Strange background pattern/dithering on Wayland session
Summary: Strange background pattern/dithering on Wayland session
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.24.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-24 01:15 UTC by skylake118
Modified: 2022-03-02 19:08 UTC (History)
4 users (show)

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


Attachments
Notice how the header and icons, which should be solid, have a pattern. the blur effect also has this problem, just like everything else on the Wayland session. (25.16 KB, image/png)
2022-02-24 01:15 UTC, skylake118
Details

Note You need to log in before you can comment on or make changes to this bug.
Description skylake118 2022-02-24 01:15:49 UTC
Created attachment 147091 [details]
Notice how the header and icons, which should be solid, have a pattern. the blur effect also has this problem, just like everything else on the Wayland session.

SUMMARY
There is a dithering or background pattern across all the screen when using the Wayland session. See the attached picture and Reddit post for concrete examples.
***

STEPS TO REPRODUCE
1. Login to a Wayland session.
2. Watch the screen, and notice a pattern that does not appear using the X11 session.

OBSERVED RESULT
A dithering/background pattern appears all over the screen, on the wallpaper, the windows (on both Qt and GTK), applets, etc. It's especially (but not exclusively) noticeable on backgrounds that should be a single solid color.

EXPECTED RESULT
No distortion caused by the aforementioned dithering pattern. Colors should be as smooth as in the X11 session.

SOFTWARE/OS VERSIONS

Linux: 5.16.10-1-default (64-bit)
KDE Plasma: 5.24.1
KDE Frameworks: 5.90.0
Qt Version: 5.15.2
OpenSUSE Tumbleweed 20220222

RELEVANT HARDWARE
Graphics Processor: Mesa DRI Intel® HD Graphics 4400

ADDITIONAL INFORMATION
A Reddit user (Zamundaaa) suggested sharing the output of drm_info, and checking the driver used by Xorg in my system.
drm_info output on Wayland: https://pastebin.com/db6U4Nd3

As far as I can tell, my system uses modesetting driver on Xorg.
Relevant Reddit post with more examples: https://www.reddit.com/r/kde/comments/srlycr/theres_some_weird_dithering_effect_going_on_in/

Changing the RGB Range setting to either Full, Limited, or Auto, does not fix the problem. Neither does adding "KWIN_DRM_PREFER_COLOR_DEPTH=24" into the /etc/environment file and rebooting.

While I'm using OpenSUSE Tumbleweed, this problem persisted after changing the default repos to the master-git KDE repos (OpenSUSE Krypton). I'm no longer using Krypton, so I'm filling this bug report with my current setup. The creator of the Reddit thread uses Arch Linux, but has the same graphics processor, and also suffers from this problem.
Comment 1 Zamundaaa 2022-02-24 03:39:56 UTC
The issue is this: "Format: RGB565". Somehow KWins format selection prefers to use this low-precision format instead of the better 10 or 8 bit per color formats that are also available on your hardware.
Comment 2 Bug Janitor Service 2022-02-24 05:33:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/2068
Comment 3 Zamundaaa 2022-02-24 05:37:02 UTC
Could you please test the MR without KWIN_DRM_PREFER_COLOR_DEPTH set and check with drm_info which format gets used with it? The bug should've only caused 8 bit color to be used, instead of 10 bit color, there could be more going on
Comment 4 Zamundaaa 2022-02-24 21:16:13 UTC
Git commit 1d058a79d1b73091e4427e106eb4b98d13c57bb4 by Xaver Hugl.
Committed on 24/02/2022 at 20:39.
Pushed by zamundaaa into branch 'Plasma/5.24'.

backends/drm: fix format choosing

The logic was inverted and would choose the format after the first one that
is suitable. On most hardware that wouldn't cause noticable issues as that
will choose the ARGB variant of the normal format, but some Intel hardware
doesn't support these and thus a lower bit depth format than intended gets
used.

M  +3    -3    src/backends/drm/egl_gbm_backend.cpp

https://invent.kde.org/plasma/kwin/commit/1d058a79d1b73091e4427e106eb4b98d13c57bb4
Comment 5 skylake118 2022-02-25 04:48:16 UTC
(In reply to Zamundaaa from comment #4)
> Git commit 1d058a79d1b73091e4427e106eb4b98d13c57bb4 by Xaver Hugl.
> Committed on 24/02/2022 at 20:39.
> Pushed by zamundaaa into branch 'Plasma/5.24'.
> 
> backends/drm: fix format choosing
> 
> The logic was inverted and would choose the format after the first one that
> is suitable. On most hardware that wouldn't cause noticable issues as that
> will choose the ARGB variant of the normal format, but some Intel hardware
> doesn't support these and thus a lower bit depth format than intended gets
> used.
> 
> M  +3    -3    src/backends/drm/egl_gbm_backend.cpp
> 
> https://invent.kde.org/plasma/kwin/commit/
> 1d058a79d1b73091e4427e106eb4b98d13c57bb4

Very interesting! It seems that the MR got approved into the Plasma 5.24 branch before I got to test it. I will test the updated KWin with Wayland as soon as I can.