Bug 496316 - Night Light slows down mouse movements and animations
Summary: Night Light slows down mouse movements and animations
Status: REOPENED
Alias: None
Product: kwin
Classification: Plasma
Component: night color (show other bugs)
Version: 6.2.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-11-15 18:15 UTC by medin
Modified: 2025-03-21 12:37 UTC (History)
4 users (show)

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


Attachments
T4400_drm_info.txt (22.44 KB, text/plain)
2024-11-15 18:15 UTC, medin
Details
i3-1005g1_drm_info.txt (221.45 KB, text/plain)
2024-11-15 18:16 UTC, medin
Details
NIGHT_LIGHT_OFF_kwin perf statistics LVDS-1.csv (304.24 KB, text/csv)
2025-02-24 11:25 UTC, medin
Details
NIGHT_LIGHT_ON_kwin perf statistics LVDS-1.csv (216.09 KB, text/csv)
2025-02-24 11:25 UTC, medin
Details
TEST_NIGHT_LIGHT_AND_KWIN_DRM_OVERRIDE_SAFETY_MARGIN (511.28 KB, application/x-7z-compressed)
2025-03-21 12:37 UTC, medin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description medin 2024-11-15 18:15:42 UTC
Created attachment 175849 [details]
T4400_drm_info.txt

After upgrading to Plasma 6.2, if I enable Night Light, the mouse movements become laggy, and animations are rendered slowly. This problem was not present at all in Plasma 6.1.
Comment 1 medin 2024-11-15 18:16:35 UTC
Created attachment 175850 [details]
i3-1005g1_drm_info.txt
Comment 2 medin 2024-11-15 18:17:45 UTC
Operating System: Manjaro Linux 
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.7-1-MANJARO (64-bit)
Graphics Platform: Wayland
Comment 3 Sander Lindeman 2024-11-26 15:28:33 UTC
Same here.

Operating System: Fedora Linux 41
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.0
Kernel Version: 6.11.8-300.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics
Memory: 58.5 GiB of RAM
Graphics Processor: AMD Radeon 780M
Manufacturer: LENOVO
Product Name: 21K5CTO1WW
System Version: ThinkPad P14s Gen 4
Comment 4 Zamundaaa 2024-12-19 01:38:38 UTC
*** This bug has been marked as a duplicate of bug 495167 ***
Comment 5 Bug Janitor Service 2025-01-05 03:14:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/6967
Comment 6 Zamundaaa 2025-01-05 13:41:32 UTC
Git commit 77c81aef08ba841f30f77745787d06973ecea170 by Xaver Hugl.
Committed on 05/01/2025 at 03:14.
Pushed by zamundaaa into branch 'master'.

backends/drm: fall back to applying night light in non-linear space when linear fails

While this isn't correct for gamma 2.2 with non-zero black level, it's close enough for
most people, and it's definitely preferable for less capable hardware to have good
performance over slightly more correct night light.

M  +20   -9    src/backends/drm/drm_output.cpp

https://invent.kde.org/plasma/kwin/-/commit/77c81aef08ba841f30f77745787d06973ecea170
Comment 7 medin 2025-02-18 20:05:00 UTC
I didn't want to be fast to report it, but after well testing 6.3 then 6.3.1, it seems the fix makes it possible to use the desktop with night light enabled, but there is still a degradation of performance, it's like 25% of speed is lost, this became apparent the more I use the same session for many hours. But upon disabling night color that speed is instantly regained and mouse and animations revert to their normal speed and smoothness.


Operating System: Manjaro Linux 
KDE Plasma Version: 6.3.1
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.2
Kernel Version: 6.6.78-1-MANJARO (64-bit)
Graphics Platform: Wayland
Comment 8 Zamundaaa 2025-02-19 14:44:25 UTC
Some performance impact is expected, as the shaders get a little bit increased in complexity, but it shouldn't be noticeable.

Please attach the output of kscreen-doctor -o, set https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_log_performance_data, reboot and then use the system for a minute with night light off, and attach the csv KWin put in your home folder here. Then enable night light, log out, log in again, and after a minute attach the csv you get then here as well.
Comment 9 medin 2025-02-24 11:24:25 UTC
(In reply to Zamundaaa from comment #8)
> Some performance impact is expected, as the shaders get a little bit
> increased in complexity, but it shouldn't be noticeable.
> 
> Please attach the output of kscreen-doctor -o, set
> https://invent.kde.org/plasma/kwin/-/wikis/Environment-
> Variables#kwin_log_performance_data, reboot and then use the system for a
> minute with night light off, and attach the csv KWin put in your home folder
> here. Then enable night light, log out, log in again, and after a minute
> attach the csv you get then here as well.

Sorry I was away from home.

Output of "kscreen-doctor -o":
Output: 1 LVDS-1
        enabled
        connected
        priority 1
        Panel
        Modes:  1:1366x768@60*!  2:1024x768@60  3:1280x720@60 
        Geometry: 0,0 1366x768
        Scale: 1
        Rotation: 1
        Overscan: 0
        Vrr: incapable
        RgbRange: unknown
        HDR: incapable
        Wide Color Gamut: incapable
        ICC profile: none
        Color profile source: sRGB
        Color power preference: prefer efficiency and performance
        Brightness control: supported, set to 65% and dimming to 100%
Comment 10 medin 2025-02-24 11:25:11 UTC
Created attachment 178795 [details]
NIGHT_LIGHT_OFF_kwin perf statistics LVDS-1.csv
Comment 11 medin 2025-02-24 11:25:44 UTC
Created attachment 178796 [details]
NIGHT_LIGHT_ON_kwin perf statistics LVDS-1.csv
Comment 12 Zamundaaa 2025-03-05 16:57:39 UTC
hmm, my tool to look at those stats says that performance was even worse with night light off. Did you maybe get the files mixed up?

Either way, in both cases, nearly all commits (86% with night light, 96% without) are dropped because they happen too late. In 6.3.3 (will be released next week), you'll be able to use https://invent.kde.org/plasma/kwin/-/wikis/Environment-Variables#kwin_drm_override_safety_margin to increase the safety margin - please test with 2000, 3000 and if that doesn't improve things 5000 or even 8000.
Comment 13 Bug Janitor Service 2025-03-20 03:46:58 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 14 medin 2025-03-21 12:36:58 UTC
(In reply to Zamundaaa from comment #12)
> hmm, my tool to look at those stats says that performance was even worse
> with night light off. Did you maybe get the files mixed up?
> 
> Either way, in both cases, nearly all commits (86% with night light, 96%
> without) are dropped because they happen too late. In 6.3.3 (will be
> released next week), you'll be able to use
> https://invent.kde.org/plasma/kwin/-/wikis/Environment-
> Variables#kwin_drm_override_safety_margin to increase the safety margin -
> please test with 2000, 3000 and if that doesn't improve things 5000 or even
> 8000.

I tried to change KWIN_DRM_OVERRIDE_SAFETY_MARGIN to 2000, 3000 and 5000 and turn on/off light night, but in each test the slowness is always present when night light is enabled. I attached various results in each test.
Comment 15 medin 2025-03-21 12:37:41 UTC
Created attachment 179628 [details]
TEST_NIGHT_LIGHT_AND_KWIN_DRM_OVERRIDE_SAFETY_MARGIN