Bug 453070 - Night Color not working on Wayland session with legacy mode
Summary: Night Color not working on Wayland session with legacy mode
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: master
Platform: openSUSE Linux
: VHI normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-04-26 21:59 UTC by Behzad A
Modified: 2022-05-03 22:40 UTC (History)
4 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Behzad A 2022-04-26 21:59:34 UTC
After two week I upcated KDE Plasma from OpenSUSE Krypton repo and now Night-Color doesn't work on Wayland session, This issue doesn't happened before update and also works fine on X11 session. And also Night-Color mode setting is "Always on".

System Info
System:    Host: localhost.localdomain Kernel: 5.17.4-1-default x86_64 bits: 64 compiler: gcc v: 11.2.1
           Desktop: KDE Plasma 5.24.80 tk: Qt 5.15.2 wm: kwin_wayland dm: SDDM Distro: openSUSE Tumbleweed 20220424
CPU:       Info: Dual Core model: Intel Core2 Duo T6670 bits: 64 type: MCP arch: Penryn rev: A cache: L2: 2 MiB
           flags: lm nx pae sse sse2 sse3 sse4_1 ssse3 vmx bogomips: 8772
           Speed: 1196 MHz min/max: 1200/2201 MHz boost: enabled Core speeds (MHz): 1: 1196 2: 1196
Graphics:  Device-1: Intel Mobile 4 Series Integrated Graphics vendor: Sony driver: i915 v: kernel bus-ID: 00:02.0
           chip-ID: 8086:2a42
           Device-2: Ricoh Sony Vaio Integrated Webcam type: USB driver: uvcvideo bus-ID: 4-2:2 chip-ID: 05ca:18b3
           Display: wayland server: SUSE LINUX 1.21.1.3 compositor: kwin_wayland driver: loaded: modesetting
           unloaded: fbdev,vesa alternate: intel resolution: 1280x800~60Hz s-dpi: 96
           OpenGL: renderer: Mesa Mobile Intel GM45 Express (CTG) v: 2.1 Mesa 22.2.0-devel-git-a6a4bf0f direct render: Yes
Comment 1 Behzad A 2022-04-26 22:04:43 UTC
I'm not sure but maybe this issue related to  https://bugs.kde.org/show_bug.cgi?id=453069 , just because happened on same time
Comment 2 Nate Graham 2022-04-27 16:14:36 UTC
Can confirm. It doesn't work for me either with current git master.
Comment 3 Robert Britton 2022-05-02 04:31:27 UTC
I can third this issue. Like Behzad -- Night Color works just fine on X11, but it's completely broken on Wayland.  I'm on Arch with a fully up-to-date system as of today 5/1. 

I can't say whether or not this happened before the current version of Plasma I'm on was released into Arch repositories; I've only started trying to use Wayland in the past week.

Night Color doesn't work whatsoever for me on Wayland. It doesn't matter what activation time you set it to or what temperature you set it to adjust to, it just doesn't work. It's as if it doesn't exist. The Night Color widget can be toggled on or off, and it displays changes as such, but nothing happens. 

I AM NOT A DEVELOPER but from my troubleshooting I think this might have to do with the way monitor names are detected and tracked in Wayland versus X11. The other major issue with Wayland I've been having is that on my current user account, existing since January and whatever version of Plasma was available on Arch then, any changes I make to display settings don't get saved, either resolution or refresh rate. This means I have to re-set my monitor to output at 144 Hz every single time I start a Wayland session. I've tested pretty extensively with a test user I made this weekend, and that user doesn't have the settings-not-being-saved issue, but it does also have a broken Night Color. I use a single monitor with DVI. I think these two issues may possibly be related somehow.

System info:

Operating System: Arch Linux
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3
Kernel Version: 5.17.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-6700 CPU @ 3.40GHz
Memory: 15.4 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2 running proprietary driver version 510.60.02


I'd be happy to provide more info if needed -- config files, etc.
Comment 4 Zamundaaa 2022-05-02 14:55:23 UTC
Please attach the output of drm_info, and the log of kwin_wayland after enabling night color (ideally with debug logging enabled)

(In reply to Robert Britton from comment #3)
> Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2 running proprietary
> driver version 510.60.02
NVidia doesn't support applying color transformations in a way that doesn't degrade performance yet, that is a different problem.
Comment 5 Nate Graham 2022-05-02 15:27:22 UTC
I found that for me, this was caused by having KWIN_DRM_NO_AMS=1 set as a workaround for a thing that used to be broken but seems better now. Unsetting it and rebooting caused Night Color to resume working normally.

Bezhad, do you have that environment variable set? You can check with `env | grep -i KWIN_DRM_NO_AMS`
Comment 6 Nate Graham 2022-05-02 15:29:48 UTC
And if not, can you paste the output of `journalctl --boot 0 | grep kwin_wayland_drm`?
Comment 7 Behzad A 2022-05-02 16:26:19 UTC
(In reply to Nate Graham from comment #6)
> And if not, can you paste the output of `journalctl --boot 0 | grep
> kwin_wayland_drm`?

(In reply to Nate Graham from comment #5)
> I found that for me, this was caused by having KWIN_DRM_NO_AMS=1 set as a
> workaround for a thing that used to be broken but seems better now.
> Unsetting it and rebooting caused Night Color to resume working normally.
> 
> Bezhad, do you have that environment variable set? You can check with `env |
> grep -i KWIN_DRM_NO_AMS`

No, I don't have the 'KWIN_DRM_NO_AMS' environment variable.
And output of `journalctl --boot 0 | grep kwin_wayland_drm`:

May 02 12:22:43 localhost.localdomain kwin_wayland[1673]: kwin_wayland_drm: drmSetClientCap for Atomic Mode Setting failed. Using legacy mode on GPU "/dev/dri/card0"
Comment 8 Nate Graham 2022-05-02 16:29:40 UTC
Ok, so for you KWin is using legacy mode even though it hasn't been forced into that mode.
Comment 9 Behzad A 2022-05-02 16:40:15 UTC
(In reply to Nate Graham from comment #8)
> Ok, so for you KWin is using legacy mode even though it hasn't been forced
> into that mode.

My GPU is intel Gen-4.5(GMA 4500MHD) and doesn't support Atomic modesetting. But I don't think this issue causing the problem because until three weeks ago(before updating) Night-Color works fine on Wayland session.
Comment 10 Nate Graham 2022-05-02 16:46:11 UTC
Yes, same here, but then Night Color broke when AMS is not in use. It was a recent regression, and it's in the process of being fixed with https://invent.kde.org/plasma/kwin/-/merge_requests/2324.
Comment 11 Nate Graham 2022-05-02 16:46:40 UTC
That merge request fixes the issue for me. If you have the capacity to test it out and see if it fixes the issue for you too, that would be much appreciated.
Comment 12 Zamundaaa 2022-05-02 18:18:29 UTC
Git commit b5aebc83eef72fb0d43dc82e647381e514636dd8 by Xaver Hugl.
Committed on 02/05/2022 at 15:39.
Pushed by zamundaaa into branch 'master'.

backends/drm: fix gamma ramps with legacy

With legacy, gamma ramps wouldn't be calculated from the color transformation,
which made them not be applied.

M  +1    -4    src/backends/drm/drm_pipeline.cpp

https://invent.kde.org/plasma/kwin/commit/b5aebc83eef72fb0d43dc82e647381e514636dd8
Comment 13 Behzad A 2022-05-03 22:40:39 UTC
(In reply to Nate Graham from comment #11)
> That merge request fixes the issue for me. If you have the capacity to test
> it out and see if it fixes the issue for you too, that would be much
> appreciated.

(In reply to Zamundaaa from comment #12)
> Git commit b5aebc83eef72fb0d43dc82e647381e514636dd8 by Xaver Hugl.
> Committed on 02/05/2022 at 15:39.
> Pushed by zamundaaa into branch 'master'.
> 
> backends/drm: fix gamma ramps with legacy
> 
> With legacy, gamma ramps wouldn't be calculated from the color
> transformation,
> which made them not be applied.
> 
> M  +1    -4    src/backends/drm/drm_pipeline.cpp
> 
> https://invent.kde.org/plasma/kwin/commit/
> b5aebc83eef72fb0d43dc82e647381e514636dd8

The problem solved with this commit.
Thanks