Bug 450327 - Night Color doesn't work at all on Plasma Wayland with NVIDIA
Summary: Night Color doesn't work at all on Plasma Wayland with NVIDIA
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.24.1
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWin default assignee
Depends on:
Reported: 2022-02-15 18:07 UTC by TrueTechie
Modified: 2023-05-27 11:17 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Note You need to log in before you can comment on or make changes to this bug.
Description TrueTechie 2022-02-15 18:07:12 UTC
When setting up Night Color on KDE in a Wayland session with the NVIDIA driver, it seems that no reddening color change is applied to the system. On X11 with the exact same system and configuration, this feature works as intended.

1.  Login to a Wayland session via SDDM on a machine running the NVIDIA proprietary driver
2.  Open the "Night Color"  tab in the system settings
3. Click "Activate Night Color" and select "Always On" in the activation time drop-down menu. 

No color changing effect is applied to the display(s) on hitting "Apply" or on startup.

The reddening effect is applied to the displays on hitting "Apply" or on startup.

Artix Linux on the Zen Kernel 5.16.8
KDE Plasma Version:  5.24
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Comment 1 Zamundaaa 2022-02-15 19:32:30 UTC
This is because the NVidia driver doesn't support setting gamma ramps. In order for night color to work either NVidia has to implement it or we have to implement a (less efficient) shader based fallback
Comment 2 ByteEnable 2022-11-03 04:51:56 UTC
Worked on Xorg.  Still broken in 5.26.2 and NVidia driver 520.56 with Wayland  Has a bug or feature request been submitted to Nvidia?
Comment 3 andrew morris 2023-01-15 08:57:05 UTC
Bug confirmed on my machine. Works on x11 but not wayland.
Operating System: Fedora Linux 36
KDE Plasma Version: 5.25.4
KDE Frameworks Version: 5.97.0
Qt Version: 5.15.5
Kernel Version: 5.18.18-200.fc36.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-4720HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 980M/PCIe/SSE2
Product Name: G751JY
System Version: 1.0
Relevent packages:
Name         : akmod-nvidia
Version      : 515.65.01
Name         : akmods
Version      : 0.5.7
Comment 4 Oliver Beard 2023-02-07 20:22:14 UTC
The specific message logged: kwin_wayland[1069]: kwin_wayland_drm: Failed to create gamma blob! Invalid argument

From: https://forums.developer.nvidia.com/t/wayland-information-for-r515-beta-release/214275
The nvidia-drm module does not support the GAMMA_LUT, DEGAMMA_LUT, CTM, COLOR_ENCODING, or COLOR_RANGE connector properties, which may impact some compositor features related to color correction.
Comment 5 Damian C 2023-04-23 21:23:51 UTC
I want to add that with the Night Color feature enabled, each time the "kwin_wayland_drm: Failed to create gamma blob! Invalid argument" message shows on the logs, the screen freezes (one of them, the other two won't), and it can completely freeze the kwin session.

3 monitors: One Display Port, one HDMI and one DVI.

Operating System: Arch Linux 
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9
Kernel Version: 6.2.12-zen1-1-zen (64-bit)
Graphics Platform: Wayland
Processors: 12 × Intel® Core™ i7-8700K CPU @ 3.70GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 1070/PCIe/SSE2

Nvidia Drivers: 530.41.03-1

Workaround has been to disable this feature completely.
Comment 6 Zamundaaa 2023-04-24 06:54:44 UTC
Please create a separate bug report for the freeze
Comment 7 Damian C 2023-04-24 09:36:02 UTC
(In reply to Zamundaaa from comment #6)
> Please create a separate bug report for the freeze

Done, https://bugs.kde.org/show_bug.cgi?id=468895

Thank you,
Comment 8 Zamundaaa 2023-05-24 14:18:49 UTC
Git commit cdafbbbd6f80d6ca0639660ed4ec121754553f54 by Xaver Hugl.
Committed on 24/05/2023 at 13:48.
Pushed by zamundaaa into branch 'master'.

backends/drm: always do color management on NVidia GPUs

This comes with a small performance hit but ensures that night color works
Related: bug 468895

M  +1    -1    src/backends/drm/drm_egl_cursor_layer.cpp
M  +1    -1    src/backends/drm/drm_egl_layer.cpp
M  +3    -3    src/backends/drm/drm_egl_layer_surface.cpp
M  +1    -1    src/backends/drm/drm_egl_layer_surface.h
M  +7    -2    src/backends/drm/drm_output.cpp
M  +1    -0    src/backends/drm/drm_output.h

Comment 9 mirh 2023-05-27 11:17:26 UTC
See also https://github.com/NVIDIA/open-gpu-kernel-modules/issues/162
Actual gamma LUT support shouldn't be too far.