Bug 453701 - Night Color transition animation leads to low fps and stutter
Summary: Night Color transition animation leads to low fps and stutter
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-12 14:08 UTC by Malte
Modified: 2024-01-05 03:46 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments
The issue when running a fullscreen game (through DXVK->Vulkan) on the large middle screen (795.48 KB, video/webm)
2022-05-12 14:08 UTC, Malte
Details
The issue on an otherwise idle Plasma desktop (1018.65 KB, video/webm)
2022-05-12 14:09 UTC, Malte
Details
The issue when running Plasma through X11 (797.47 KB, video/webm)
2022-05-12 14:11 UTC, Malte
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Malte 2022-05-12 14:08:20 UTC
Created attachment 148762 [details]
The issue when running a fullscreen game (through DXVK->Vulkan) on the large middle screen

SUMMARY
When Night Color is enabled and I enable or disable the effect temporarily through the icon in the taskbar, the FPS of the complete desktop - all windows/clients and the plasmashell itself - drops to massively for the duration of the transition animation. As soon as the Night Color mode is completely enabled/disabled the FPS go back to the 60Hz refresh rate of my screens

STEPS TO REPRODUCE
1. Start a Plasma session
2. Enable Night Color in the system settings
3. Manually enable/disable Night Color in the taskbar for a fast transition between full on/off mode

OBSERVED RESULT
The whole session/desktop has low fps and stutters. When using X11 the cursor still moves smoothly but moving windows for example is obviously lagging. In a wayland session even the cursor lags and stutters together with all applications etc.. 

EXPECTED RESULT
A smooth desktop experience during the transition without stutter and framedrops.

Operating System: openSUSE Tumbleweed 20220509
KDE Plasma Version: 5.24.5
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.2
Kernel Version: 5.17.5-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 5 2400G with Radeon Vega Graphics
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series

ADDITIONAL INFORMATION
I've 3 screens: 2* 1920x1200@60Hz and 1* 2560x1080@60Hz
I have this problem since I use the Night Color effect. So the issue exists for at least 9 months I think and I can't say if it worked some time ago.

I've attached three videos showing the problem. The video of the WoW login shows the low framerate very nicely through mangohud. The two videos of the empty sidescreen have the FPS effect in the top right corner. It's not as obvious as it is when sitting in front of the screen but I think the problem is visible.
The videos are VP9 encoded in a webm container. I hope everyone can watch them. :)

(And just to make that clear: It lags and stutters just as much when OBS is not running and I transition on a completely idle system. ;) )
Comment 1 Malte 2022-05-12 14:09:21 UTC
Created attachment 148763 [details]
The issue on an otherwise idle Plasma desktop
Comment 2 Malte 2022-05-12 14:11:30 UTC
Created attachment 148764 [details]
The issue when running Plasma through X11
Comment 3 Nate Graham 2022-05-12 15:24:16 UTC
Can confirm.
Comment 4 gudvinr+kde 2022-07-16 01:49:45 UTC
I am struggling with this since when Night Color was released and I don't like it ):
Comment 5 Zamundaaa 2023-08-29 17:29:21 UTC
Afaik this is a kernel bug triggered by Xorg using the legacy modesetting API. Please test if this also happens on Wayland
Comment 6 Malte 2023-08-29 18:57:25 UTC
(In reply to Zamundaaa from comment #5)
> Afaik this is a kernel bug triggered by Xorg using the legacy modesetting
> API. Please test if this also happens on Wayland

It happens on Wayland. I'm running Wayland only since ~2 years and I can trigger it just as I'm writing this response by turning Night Colors off and on.

In fact when I reported it, I reported it for both: X11 and Wayland. Please see the second attached file. That was recorded on Wayland. 

Operating System: openSUSE Tumbleweed 20230823
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.11-1-default (64-bit)
Graphics Platform: Wayland
Processors: 8 × AMD Ryzen 5 2400G with Radeon Vega Graphics
Memory: 31.2 GiB of RAM
Graphics Processor: AMD Radeon RX 580 Series
Comment 7 Patrick Silva 2023-10-02 16:25:46 UTC
I have just noticed this bug on my system.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4670K CPU @ 3.40GHz
Memory: 15,5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 4600
Comment 8 Bug Janitor Service 2023-11-25 18:21:36 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4710
Comment 9 Zamundaaa 2023-12-06 09:39:56 UTC
Git commit f3aaede3823c9962ea53d9ba7d323f00c37ea967 by Xaver Hugl.
Committed on 06/12/2023 at 10:32.
Pushed by zamundaaa into branch 'master'.

backends/drm: properly handle neither CTM and gamma being supported

Instead of hardcoding only NVidia, try to use CTM and GAMMA_LUT before falling
back to the shader path. This way it also works on other GPUs that lack
color management hardware, and only falls back to the color management path
on older NVidia drivers.

This commit also ensures that the color management hardware is set properly
after toggling color management on and off again, and simplifies ColorDevice
to only deal with rgb factors instead of always calculating luts. This should
improve performance of night color animations on hardware where CTMs are
supported

M  +0    -6    src/backends/drm/drm_gpu.cpp
M  +0    -2    src/backends/drm/drm_gpu.h
M  +37   -28   src/backends/drm/drm_output.cpp
M  +2    -1    src/backends/drm/drm_output.h
M  +14   -0    src/backends/drm/drm_pipeline.cpp
M  +2    -0    src/backends/drm/drm_pipeline.h
M  +7    -2    src/backends/x11/standalone/x11_standalone_output.cpp
M  +1    -1    src/backends/x11/standalone/x11_standalone_output.h
M  +23   -149  src/colors/colordevice.cpp
M  +27   -0    src/core/colortransformation.cpp
M  +2    -0    src/core/colortransformation.h

https://invent.kde.org/plasma/kwin/-/commit/f3aaede3823c9962ea53d9ba7d323f00c37ea967
Comment 10 Zamundaaa 2023-12-06 23:28:17 UTC
Could you retest this on Wayland? With that commit on all the hardware I see listed here, the amount of work both KWin and the kernel do for color changes should be effectively zero now.
Comment 11 Bug Janitor Service 2023-12-21 03:45:57 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 12 Bug Janitor Service 2024-01-05 03:46:17 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now 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

Thank you for helping us make KDE software even better for everyone!