Bug 461657 - Night color does not deactivate when waking the computer up from sleep
Summary: Night color does not deactivate when waking the computer up from sleep
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.27.5
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: wayland
: 462672 468295 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-10 10:09 UTC by kde
Modified: 2023-11-08 23:03 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.27.8


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2022-11-10 10:09:30 UTC
SUMMARY
When night color is set to activate on a set schedule, if you put the computer to sleep at night time and wake it up at day time, then the night color stays active once you wake the computer up during day time. It is then needed to manually enable night color all the time and then disable it (clicking the applet twice does not work).

STEPS TO REPRODUCE
1. Enable night shift on a schedule (I use location)
2. Sleep the computer during night time
3. Wake the computer up during day time

OBSERVED RESULT
Night shift is active

EXPECTED RESULT
Night shift is not active

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.7
Kernel Version: 6.0.7-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Memory: 62.7 Gio of RAM
Graphics Processor: AMD Radeon RX 5700 XT

ADDITIONAL INFORMATION
This seems to be a regression as it was working as expected on 5.25.4.
Comment 1 Nate Graham 2022-11-10 16:52:31 UTC
Possibly the same root cause as Bug 428357.
Comment 2 anusser 2023-02-14 08:53:41 UTC
I can reproduce this bug under Manjaro using plasma version 5.26.5-1. It also started around the time that this bug was reported.
Comment 3 maelstrom256+bugs.kde.com 2023-05-05 05:56:32 UTC
The bug persist in 5.27.4-1 on Archlinux.

When laptop left locked over night on morning unlock it keeps night colour.

When time for night colour is reached, it set up colour to day colour as an instant (that blue flash hurts my eyes) and slowly transiting to normal night colour.
Comment 4 coomac 2023-05-20 14:34:36 UTC
Also showed up on Endeavour OS a couple months ago.
Comment 5 jade 2023-05-29 01:33:12 UTC
I don't think it's the same bug as https://bugs.kde.org/show_bug.cgi?id=428357, since the bug here is that the state of night color is mismatched with the state of the actual colour of the monitors, and stays that way.

An example of something that will fix this condition for one monitor is to unplug it and plug it back in, or change the resolution.

Also, making it preview a different colour temperature then disable the preview will rectify it across all screens.

Reproduced on KWin Wayland 5.27.5 on Arch Linux, with AMD Mesa drivers. I believe that this is a wayland only bug since it did not appear to happen on X11 when I was still on X11, but occurs on the same system with the same software version on wayland.

Poking the preview can be achieved with a script like so:

#!/bin/sh

busctl call --user org.kde.KWin /ColorCorrect org.kde.kwin.ColorCorrect preview u 5000
sleep 1
busctl call --user org.kde.KWin /ColorCorrect org.kde.kwin.ColorCorrect stopPreview
Comment 6 Ilya Bizyaev 2023-07-15 21:27:40 UTC
Wow, I have an almost identical script!

$ cat ~/bin/fix-kwin-color.sh
#!/usr/bin/env bash
qdbus-qt5 org.kde.KWin /ColorCorrect org.kde.kwin.ColorCorrect.preview 4000
sleep 5s
qdbus-qt5 org.kde.KWin /ColorCorrect org.kde.kwin.ColorCorrect.stopPreview

Looks like this might be the same problem as described in https://bugs.kde.org/show_bug.cgi?id=468295. WDYT?
Comment 7 maelstrom256+bugs.kde.com 2023-07-15 22:16:04 UTC
(In reply to Ilya Bizyaev from comment #6)
> Looks like this might be the same problem as described in
> https://bugs.kde.org/show_bug.cgi?id=468295. WDYT?

It sounds reasonable for me.
I think main reasons are:
* night-to-day transition doesn't occurs for some reason
* day-to-night transition doesn't calculate real transition, but forces start point at instant
Comment 8 jade 2023-07-15 22:30:11 UTC
Another thought I have is there's another bug that I sometimes experience in which the monitor brightness gets desynchronized after monitors dim for sleep warning: is this a general DDC/DPMS handling bug where the monitor's state gets out of sync?
Comment 9 Vlad Zahorodnii 2023-07-25 09:51:34 UTC
Can you please post the output of `qdbus org.kde.KWin /ColorCorrect GetAll org.kde.kwin.ColorCorrect` when screen color temperature is incorrect? Please also specify the expected screen temperature
Comment 10 Nate Graham 2023-07-25 13:42:54 UTC
.
Comment 11 kinghat 2023-07-25 14:45:06 UTC
$ qdbus org.kde.KWin /ColorCorrect GetAll org.kde.kwin.ColorCorrect
available: true
currentTemperature: 6500
enabled: true
inhibited: false
mode: 0
previousTransitionDateTime: 1690281092
previousTransitionDuration: 2936755
running: true
scheduledTransitionDateTime: 1690334696
scheduledTransitionDuration: 2936755
targetTemperature: 6500

Operating System: Fedora Linux 38
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.4.4-200.fc38.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-5600U CPU @ 2.60GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 5500
Manufacturer: LENOVO
Product Name: 20BX001FUS
System Version: ThinkPad T450s
Comment 12 kde 2023-07-28 22:13:18 UTC
This also happens when the screens are off, for example:
1. Lock the session at 5PM and press escape to turn off the screens, not putting the computer to sleep (temperature is 6500K)
2. Wake up the screens at 12AM (temperature should be 3900K)

The target temperature is not applied at this point, however this is the output of the qdbus command:
$ qdbus org.kde.KWin /ColorCorrect GetAll org.kde.kwin.ColorCorrect
available: true
currentTemperature: 3900
enabled: true
inhibited: false
mode: 1
previousTransitionDateTime: 1690572475
previousTransitionDuration: 3351000
running: true
scheduledTransitionDateTime: 1690603343
scheduledTransitionDuration: 3337175
targetTemperature: 3900

Clicking the applet twice works to fix this case.
Comment 13 Zamundaaa 2023-08-02 09:43:43 UTC
*** Bug 468295 has been marked as a duplicate of this bug. ***
Comment 14 Zamundaaa 2023-08-02 09:44:43 UTC
*** Bug 462672 has been marked as a duplicate of this bug. ***
Comment 15 Bug Janitor Service 2023-08-02 09:45:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4286
Comment 16 Zamundaaa 2023-08-03 11:09:12 UTC
Git commit befb50ebece843e6223d59577a9e1644704ba6c1 by Xaver Hugl.
Committed on 03/08/2023 at 12:46.
Pushed by zamundaaa into branch 'master'.

backends/drm: allow modesets with atomic tests if a modeset is already pending

Otherwise the tests will always fail

M  +10   -0    src/backends/drm/drm_pipeline.cpp

https://invent.kde.org/plasma/kwin/-/commit/befb50ebece843e6223d59577a9e1644704ba6c1
Comment 17 Zamundaaa 2023-08-03 13:32:57 UTC
Git commit c580f8ed516c6c93d1e0a91cd96837744badd25e by Xaver Hugl.
Committed on 03/08/2023 at 14:59.
Pushed by zamundaaa into branch 'Plasma/5.27'.

backends/drm: allow modesets with atomic tests if a modeset is already pending

Otherwise the tests will always fail
(cherry picked from commit befb50ebece843e6223d59577a9e1644704ba6c1)

M  +10   -0    src/backends/drm/drm_pipeline.cpp

https://invent.kde.org/plasma/kwin/-/commit/c580f8ed516c6c93d1e0a91cd96837744badd25e
Comment 18 Teemu Rytilahti 2023-11-08 23:03:34 UTC
(In reply to kde from comment #12)
> This also happens when the screens are off, for example:
> 1. Lock the session at 5PM and press escape to turn off the screens, not
> putting the computer to sleep (temperature is 6500K)
> 2. Wake up the screens at 12AM (temperature should be 3900K)

This might be a completely separate issue as I am seeing this behavior still on kwin_x11 version 5.27.9.