Bug 477223 - Setting an icc profile causes reduced system performance.
Summary: Setting an icc profile causes reduced system performance.
Status: CONFIRMED
Alias: None
Product: kwin
Classification: Plasma
Component: performance (show other bugs)
Version: 5.27.80
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: qt6
: 482909 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-11-19 08:35 UTC by Rean
Modified: 2024-06-30 13:19 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rean 2023-11-19 08:35:34 UTC
STEPS TO REPRODUCE
1. Use Wayland
2. Apply an icc profile in Display Configuration

OBSERVED RESULT
Reduced performance, especially when playing demanding video playback and gaming; it also causes higher CPU usage. I even noticed laggy, delayed mouse movement.

EXPECTED RESULT
Normal performance.

SOFTWARE/OS VERSIONS
Arch Linux/KDE Plasma: 
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.245.0
Qt Version: 6.6.0
Comment 1 Rean 2023-11-19 11:21:36 UTC
Oh, some more testing I did was with MPV itself. I set the color profile inside mpv's config, removed the one from the display configuration, and then played a high-res video in mpv. The results are the same. I simply get the same frame drops in MPV as I do setting icc from display configuration. I tested mpv in x11 as well with the icc profile set the same way; I didn't change the mpv.config, and there were no frame drops. I also spent time testing KDE Plasma Wayland 5.27.9 with the icc profile set in mpv because it does work there from mpv; you can tell by the colors looking different, so I know for sure it works in mpv under Wayland in 5.27.9, and I also see no frame drops there, so this performance drop issue seems to be specific to setting a icc profile in Plasma 5.27.80's wayland session only.
Comment 2 Rean 2023-11-19 11:36:37 UTC
(In reply to Myself from comment #1)
Damn, there is no way to edit a comment I made here, ok, this part where I said "under Wayland in 5.27.9, and I also see no frame drops there." This is wrong; ignore this. I tested again, and there is definitely the same performance drop, just not as bad as 5.27.80.
Comment 3 Rean 2023-11-19 17:17:47 UTC
I tested again, and it seems like the reason I didn't see any frame drops in X11 was because when mpv goes into fullscreen, the compositor is disabled, in turn giving better performance. If compositing is allowed, I get the same frame drops in x11, but there is no way to disable compositing in Wayland like in X11 because Wayland manages windows, etc. with the compositor, and if that dies, the entire session dies anyway. I thought the compositing in Wayland was supposed to be more efficient. Why does the compositor cause dropped frames like on X11 and cause applications to get higher CPU usage when using an icc profile?
Comment 4 Zamundaaa 2023-11-23 20:17:31 UTC
What hardware is this on? The alpha has some known performance issues on Intel due to driver bugs.
Comment 5 Rean 2023-11-23 23:26:53 UTC
(In reply to Zamundaaa from comment #4)
> What hardware is this on? The alpha has some known performance issues on
> Intel due to driver bugs.

My laptop's CPU is an i5 7300hq. Also, one thing to note is that I did a system update lately, and the higher CPU usage i was having before dropped a little bit even with the icc profile set, and the frame drops lessened a little bit after an update on Plasma 6 Alpha lately. I don't know what caused the performance increase, but somehow it's slightly better.
Comment 6 Zamundaaa 2023-11-24 14:57:38 UTC
Okay, then that's most likely already fixed in git master. Can you test a live boot of Neon unstable to confirm?
Comment 7 Rean 2023-11-24 16:02:03 UTC
(In reply to Zamundaaa from comment #6)
> Okay, then that's most likely already fixed in git master. Can you test a
> live boot of Neon unstable to confirm?

There is a kind of bad mouse judder in KDE Neon that is only really noticeable in the overview effect when you have an icc profile set. I know KDE's latest neon unstable has later packages for Plasma 6 than what Arch has currently, so there might've been an update that messed up performance again anyway. Here's the list of the latest KDE-Unstable repository for Arch: https://archlinux.org/packages/?page=2&sort=last_update&repo=KDE-Unstable.
Comment 8 Bug Janitor Service 2023-12-09 03:46:09 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 9 Rean 2023-12-14 20:43:26 UTC
Can someone just tell me if color management just makes performance drop or is this really not meant to happen? Is this even a bug, or does color management just require more powerful hardware?
Comment 10 Zamundaaa 2023-12-14 21:33:02 UTC
It's expected that KWin uses a bit more GPU power, but it shouldn't be noticeable
Comment 11 Rean 2023-12-14 23:53:27 UTC
(In reply to Zamundaaa from comment #10)
> It's expected that KWin uses a bit more GPU power, but it shouldn't be
> noticeable
CPU: Intel i5-7300HQ (4) @ 3.500GHz 
GPU: Intel HD Graphics 630 GPU: NVIDIA GeForce GTX 1050 Mobile

Mpv running with vulkan and vulkan-hwdec on the nvidia gpu with mpv's high-quality profile set FSR and smooth video project running to get videos to 60 fps to get the soap opera effect. I know MPV is using allot of my CPU because of all these things, around 60% to 70% according to the quality of the video, but I get no frame drops. The computer is still capable, mostly, but then when the ICC profile is set, that's when frame drops and the stuttering starts. Everything is just a slightly worst experience performance-wise, and games suffer fps drops as well.
Comment 12 Conn O'Griofa 2024-01-13 22:09:18 UTC
Just chiming in to confirm the same issue with the latest Plasma 6 RC1 release.

OS: Arch with kde-unstable, running kwin 5.92.0-1.
System: Ryzen 3 2200U with Vega 3 integrated graphics

A simple test that can illustrate the issue on my system:
* Open a Youtube video running at minimum 720p@60 in a Firefox or Chromium tab, with "stats for nerds" popup active
* Open and close the KDE Plasma Kicker.

Results:
* Without an ICC profile, the Kicker menu is smooth, but there are a few dropped frames in video playback (not a KDE/KWin specific issue, as even Mutter/GNOME has problems on this laptop with Wayland that isn't present on X11). The mouse cursor seems smooth.
* When an ICC profile is loaded, there is visible stuttering in the Kicker open/close animation, and more dropped frames present in the video playback compared to no ICC profile. Additionally, the mouse cursor exhibits stuttering at random times.

I'm dual booting a second Arch installation with Plasma 5 (i.e., kde-unstable is not active), and don't notice any performance reduction when using an ICC profile enabled via the older colord-kde menu.
Comment 13 Conn O'Griofa 2024-01-13 22:24:26 UTC
I can't edit my comment; apologies for double posting. I discovered a simpler way to test this issue: enable KWin's FPS monitor in Window Management -> Desktop Effects.

Test method:
* From a blank desktop with no applications open or visible, repeatedly click on the KDE Kicker to induce the open/close animations while watching the FPS display.

Results:
* No ICC profile loaded: averages ~60fps (some dips to 57fps, chalking up to my integrated graphics not being so powerful)
* ICC profile loaded: averages 45fps (with dips as low as 30fps)
Comment 14 Conn O'Griofa 2024-03-07 05:44:53 UTC
Unfortunately, this issue persists with KWin 6.0.1 in Arch. In case it helps, I've done some testing to try and isolate the issue.

Test procedure:
* Set Desktop Effects to defaults, then enable FPS counter
* Open a single 80x25 Konsole window, leaving visible in the middle of the screen
* With no other applications open or minimized, repeatedly click the kicker menu to trigger the open/close animation.

Some relevant results:
* Base settings, no ICC profile: 58-60fps
* Base settings with ICC profile: 30-45fps
* Blur plugin disabled with ICC profile: 55-60fps

Testing Night Light (5700K temperature forced):
* NL with no ICC profile: 58-60fps
* NL with no ICC profile, KWIN_DRM_FORCE_COLOR_MANAGEMENT=1: 30-45fps

My conclusion from the above behaviour is that the shader fallback is the primary cause of the performance issue, and can also be replicated when the Night Light is used with no ICC profile but the shader fallback is forced via the environment variable. If there is any other information I can provide, please let me know. Unfortunately, Kwin 6.0.1's X11 performance has also regressed badly on my system relative to the 5.27 release (unrelated to ICC profiles or Night Light; will file a separate bug when I have tested more thoroughly)/

Note that overall compositor performance is OK; e.g, displaying vsynctester.com in a browser will show a constant 60fps even if an ICC profile or NL + shader fallback is active, as long as no compositor effects are being triggered at the same time. The slowdown seems to occur mostly with certain desktop effects such as Blur or Overview, but other effects such as Squash or Magic Lamp have no problem maintaining a fluid 60fps.
Comment 15 Nicolas Fella 2024-03-08 23:34:39 UTC
*** Bug 482909 has been marked as a duplicate of this bug. ***
Comment 16 Bug Janitor Service 2024-03-15 18:04:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/5437
Comment 17 Zamundaaa 2024-04-08 15:54:23 UTC
Git commit c26101a9fe6e7e2f94d04e700519eafa215e59cc by Xaver Hugl.
Committed on 08/04/2024 at 15:19.
Pushed by zamundaaa into branch 'master'.

backends/drm: use a swapchain instead of an OpenGL texture for the shadow buffer(s)

This seems to have better performance on Intel GPUs, and allows us to implement damage
tracking for the shadow "buffer" in the future

M  +38   -13   src/backends/drm/drm_egl_layer_surface.cpp
M  +2    -2    src/backends/drm/drm_egl_layer_surface.h
M  +9    -0    src/utils/drm_format_helper.cpp
M  +1    -0    src/utils/drm_format_helper.h

https://invent.kde.org/plasma/kwin/-/commit/c26101a9fe6e7e2f94d04e700519eafa215e59cc
Comment 18 bofphile 2024-06-29 10:46:25 UTC
I have the same exact problem/bug when using an ICC profile.
As soon as I use/apply an ICC profile from the "Display & Monitor" menu, I experience a serious graphic performance drop especially when I'm using firefox or playing videos.

Everything is smooth again once I put back "no color profile" on the "Display Monitor" menu.

OS: Fedora Linux 40

System: Ryzen 5 PRO 4650U with Radeon Graphics
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.1
Kernel Version: 6.9.6-200.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Comment 19 Alexandre Pereira 2024-06-30 13:19:30 UTC
Also, the same. Kwin wayland with amdgpu.

Only difference is that I enabled "Built in profile" some days ago. Thought it was a good idea to try it out.

Started noticing random slowdowns and choppiness. Then disabled animations. Then noticed that some apps that never had choppiness before, were being choppy.

Searching in the kwin bug reports for a recent regression, came across this report. Upon disabling color profile (set to none), the desktop became again sweet buttery smooth!

Don't know much how to replicate, but the logout effect (one that darkens the background and adds blur) is always choppy with color profile enabled. (as to absolutely smooth without it (or as smooth as my eyes can see it)).

---
Operating System: Garuda Linux 
KDE Plasma Version: 6.1.1
KDE Frameworks Version: 6.3.0
Qt Version: 6.7.2
Kernel Version: 6.9.7-2-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: X470 AORUS ULTRA GAMING