Bug 483221 - On Wayland, Screen Flickering with KDE Plasma 6 on AMD Radeon 780M
Summary: On Wayland, Screen Flickering with KDE Plasma 6 on AMD Radeon 780M
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 6.0.1
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland
Depends on:
Blocks:
 
Reported: 2024-03-11 11:27 UTC by byd2004
Modified: 2024-06-11 16:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
modified kwin package (1.27 KB, application/zip)
2024-03-13 23:36 UTC, Zamundaaa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description byd2004 2024-03-11 11:27:22 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Boot up device
2. SDDM screen shown
3. Start flickering

OBSERVED RESULT
Screen flickering randomly and won't stop even after reinstalling AMD driver. 

After switching to x11, no bug appeared again.

EXPECTED RESULT
Screen won't flickering during and after logging in.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
(available in About System)
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0 
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Kernel: 6.7.9-arch1-1
CPU: AMD Ryzen 7 8845H
GPU: AMD ATI 63:00.0 Phoenix3
vulkan-radeon 1:24.0.2-2
mesa 1:24.0.2-2
mesa-utils 9.0.0-3
Comment 1 Zamundaaa 2024-03-11 23:04:18 UTC
> even after reinstalling AMD driver
What do you mean with that?

Also, what exactly does the flickering look like? Could you attach an image? Is it visible in screenshots or screen recordings?
Comment 2 byd2004 2024-03-12 10:24:40 UTC
(In reply to Zamundaaa from comment #1)
> > even after reinstalling AMD driver
> What do you mean with that?
> 
> Also, what exactly does the flickering look like? Could you attach an image?
> Is it visible in screenshots or screen recordings?

> What do you mean with that?
After browsing the archwiki I tried reinstalling `mesa` and `vulkan-radeon` via pacman.

> Also, what exactly does the flickering look like? Could you attach an image?
> Is it visible in screenshots or screen recordings?

I tried screen recording however it can't be recorded so I recorded the flickering via phone camera and posted on Telegram.
https://t.me/LaclaclacOppa/2

Apologize for my poor english and it's my first month starting using linux :). 
The screen flickering still exists until now (2024-12-03 10:22:30 UTC).
If more info is needed plz let me know and I'll try to provide all you need.
Thanks for your works on the amazing KDE Plasma 6!
Comment 3 Zamundaaa 2024-03-12 12:02:56 UTC
Okay. Do you only see those glitches on things with blur behind them, like the app launcher and the panel, or elsewhere too?
Comment 4 byd2004 2024-03-12 12:23:13 UTC
(In reply to Zamundaaa from comment #3)
> Okay. Do you only see those glitches on things with blur behind them, like
> the app launcher and the panel, or elsewhere too?

Actually it appears everywhere and the severity varies and may appear irregularrly. 
As for what can make this happen, scrolling pages, dragging windows, locking screen, etc. can.

I've confirmed that my laptop doesn't have problems in hardware because I just purchased it last week and it runs perfectly under Windows 11. 

Before upgrading to plasma 6, the glitches would occationally appear on SDDM login interface. However it gets worse after upgrading.
Comment 5 byd2004 2024-03-12 12:32:46 UTC
And I also found another bug and I wonder if it is capable to post it here.

https://t.me/LaclaclacOppa/3

As the pic showed, there is a white gap around the window even after extended to full screen. Sometimes it may not be white but the pixel coming from the desktop background or anything else. It is globally visible and won't appear until reboot. Also, it appears  randomly and frequently and may not show immediately after booting (maybe after a sleep i guess).
Comment 6 Zamundaaa 2024-03-12 12:35:48 UTC
Okay, I think this is a display driver bug. Let's test a few things: if you put
KWIN_DRM_PREFER_COLOR_DEPTH=24
into /etc/environment and reboot, does that help?
If not, does KWIN_DRM_NO_AMS=1 change anything?

(In reply to byd2004 from comment #5)
> And I also found another bug and I wonder if it is capable to post it here.
> 
> https://t.me/LaclaclacOppa/3
> 
> As the pic showed, there is a white gap around the window even after
> extended to full screen. Sometimes it may not be white but the pixel coming
> from the desktop background or anything else. It is globally visible and
> won't appear until reboot. Also, it appears  randomly and frequently and may
> not show immediately after booting (maybe after a sleep i guess).

That's bug 459373
Comment 7 byd2004 2024-03-12 12:49:00 UTC
> KWIN_DRM_PREFER_COLOR_DEPTH=24
> into /etc/environment and reboot, does that help?

No, it didn't work. However, the latter one KWIN_DRM_NO_AMS=1 works. After adding the entry into /etc/environment, the problem solved.

> That's bug 459373

So that means the bug still exists now? Well okay.

Thanks for your excellent work!
Comment 8 Zamundaaa 2024-03-12 13:22:24 UTC
Interesting. Would you be willing to run a patched KWin to narrow down what's causing this more?
Comment 9 byd2004 2024-03-12 13:26:17 UTC
(In reply to Zamundaaa from comment #8)
> Interesting. Would you be willing to run a patched KWin to narrow down
> what's causing this more?

I'd love to do it if it won't make my laptop a mess. But I'm new to Linux and KDE Plasma, I wonder if any instruction could be given for getting it done?
Comment 10 Zamundaaa 2024-03-13 23:36:01 UTC
Created attachment 167135 [details]
modified kwin package

Okay, so here's what you can do. If you extract the archive I attached, and run
> makepkg --syncdeps --install
in that folder, it'll compile and install a modified KWin package. With that, check again if you see the flickering without any environment variables, and if its still there, check if KWIN_DRM_PREFER_COLOR_DEPTH=24 fixes it this time.
Afterwards you can go back to the system provided KWin with
> sudo pacman -Syu kwin
Comment 11 byd2004 2024-03-14 00:46:12 UTC
I tried makepkg --syncdeps --install however error poped up with the message

CMake Error at /usr/lib/cmake/KF6CoreAddons/KF6CoreAddonsMacros.cmake:29 (message):
  Must specify INSTALL_NAMESPACE for kcm_auroraedecoration
Call Stack (most recent call first):
  src/plugins/kdecorations/aurorae/src/config/CMakeLists.txt:1 (kcoreaddons_add_plugin)

I tried googling with no solution. Anyway to  solve it?
Comment 12 Zamundaaa 2024-03-14 23:28:32 UTC
Not sure what's going on there, it builds fine on my system. Maybe you're missing some dependency or something... I just built the package on my system, you can download it at https://nx44777.your-storageshare.de/s/zgSzDRzCDjYQdQe. It won't work forever but for a quick test it should be okay. Just remove the environment variables, reboot, install the package with
> sudo pacman -U kwin-6.0.2-4-x86_64.pkg.tar.zst
log out + log in, verify if it works or not, do the same with the KWIN_DRM_PREFER_COLOR_DEPTH=24 environment variable and then revert to the system package with
> sudo pacman -S kwin
Comment 13 byd2004 2024-03-15 02:00:43 UTC
OK. I've made some tests with the patched kwin and got these situation.

1. Patched kwin without env variable = Still glitching

2. Patched kwin with env variable (KWIN_DRM_PREFER_COLOR_DEPTH=24) = Still glitching

3. Unpatched kwin (6.0.2-3) without env variable = Still glitching

4. Unpatched kwin (6.0.2-3) with env variable (KWIN_DRM_NO_AMS=1) = NO GLITCHING

Hope these info can help you and if more logs are needed plz let me know.
Comment 14 Zamundaaa 2024-03-15 02:29:50 UTC
Okay, then this only happens with atomic modesetting, even if the same buffer format is used. There's one last thing that I think could be the cause, and that's the format modifier. To test that one, just run KWin with
> KWIN_DRM_USE_MODIFIERS=0
and
> KWIN_DRM_NO_AMS=0
Comment 15 byd2004 2024-03-15 06:13:10 UTC
I added these two entries into /etc/environment with unmodified kwin package and the glitching no longer appears.

Do I need to provide you with more log?
Comment 16 Zamundaaa 2024-05-22 13:28:46 UTC
Sorry, I kinda missed the email about this.

The last thing to do here is to get the output of drm_info without any environment variables set / when you can trigger the glitches, and also again with KWIN_DRM_USE_MODIFIERS=0 set. With that, the source of the problem is narrowed down a lot, and we can make a driver bug report about this
Comment 17 byd2004 2024-05-27 06:46:46 UTC
(In reply to Zamundaaa from comment #16)
> Sorry, I kinda missed the email about this.
> 
> The last thing to do here is to get the output of drm_info without any
> environment variables set / when you can trigger the glitches, and also
> again with KWIN_DRM_USE_MODIFIERS=0 set. With that, the source of the
> problem is narrowed down a lot, and we can make a driver bug report about
> this

Ok I've pasted into pastebin and here is the link.

drm_info without any var: https://pastebin.com/kiKRufTa

drm_info with var 'KWIN_DRM_NO_AMS=1': https://pastebin.com/b6C7nJwW
Comment 18 Bug Janitor Service 2024-06-11 03:46:30 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 19 Zamundaaa 2024-06-11 16:18:45 UTC
This is the modifier with glitches: AMD(TILE_VERSION = GFX11, TILE = GFX9_64K_R_X, DCC, DCC_RETILE, DCC_INDEPENDENT_64B, DCC_INDEPENDENT_128B, DCC_MAX_COMPRESSED_BLOCK = 64B, PIPE_XOR_BITS = 2) (0x200000010437b04)
and this is the one without glitches: AMD(TILE_VERSION = GFX11, TILE = GFX9_64K_R_X, PIPE_XOR_BITS = 2) (0x200000010401b04)

Seems to be a a problem with DCC specifically. You can report that at https://gitlab.freedesktop.org/drm/amd/-/issues, and mention those two modifiers as having / not having glitches. Hopefully some amdgpu developer knows what's up.