Bug 443148 - Invert screen colors action doesn't work on Wayland with an NVIDIA GPU
Summary: Invert screen colors action doesn't work on Wayland with an NVIDIA GPU
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (other bugs)
Version First Reported In: 5.90.0
Platform: RedHat Enterprise Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: accessibility, wayland-only
: 457441 477304 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-09-30 03:15 UTC by hovgaard
Modified: 2023-12-11 21:55 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:
vlad.zahorodnii: NVIDIA+


Attachments
attachment-22839-0.html (2.11 KB, text/html)
2021-10-01 15:58 UTC, hovgaard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hovgaard 2021-09-30 03:15:15 UTC
SUMMARY
Can't invert screen colors in a wayland session. Works fine in xorg.


STEPS TO REPRODUCE
1. Assign a shortcut in 
System Setting->Shortcut->Systemservices->Invert Screen Colors
2. Press the shorcut ... 
Works fine in an x11 session but unfortunately not in a wayland session!


OBSERVED RESULT
Presseing the shorcut nothing happens

EXPECTED RESULT
The screen colors should be inverted.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 35
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Kernel Version: 5.14.7-300.fc35.x86_64 (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-10750H CPU @ 2.60GHz
Memory: 15,5 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 2060/PCIe/SSE2

ADDITIONAL INFORMATION
Comment 1 Vlad Zahorodnii 2021-09-30 06:03:43 UTC
Works fine for me with an amd gpu. This might be an nvidia thing.
Comment 2 Nate Graham 2021-10-01 14:39:22 UTC
Works fine for me on Intel. Seems more like the effect itself isn't working for you, rather than the shortcut not working. Probably an NVIDIA bug indeed.
Comment 3 hovgaard 2021-10-01 15:58:46 UTC
Created attachment 142070 [details]
attachment-22839-0.html

This bug is now gone!

I had this update today, and after reboot all was fine!!!! So yes I 
think it might have been an nvidia bug.

kmod-nvidia-5.14.0-60.fc35.x86_64-3:470.63.01-1.fc35.x86_64

Thx for the feedbacks.... happy kde user from the beginnig of times. KDE 
forever! :-)

/Alan

Den 01.10.2021 kl. 16.39 skrev Nate Graham:
> https://bugs.kde.org/show_bug.cgi?id=443148
>
> Nate Graham<nate@kde.org>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |nate@kde.org
>             Keywords|                            |wayland
>              Summary|invert screen colors        |Invert screen colors action
>                     |shorcut in wayland session  |doesn't work on Wayland
>                     |doesn't work.               |with an NVIDIA GPU
>
> --- Comment #2 from Nate Graham<nate@kde.org>  ---
> Works fine for me on Intel. Seems more like the effect itself isn't working for
> you, rather than the shortcut not working. Probably an NVIDIA bug indeed.
>
Comment 4 hovgaard 2021-10-01 16:01:53 UTC
Ahh shoot....

Stil doesnt work. I happened tested from  an X11 session.

Reboot to wayland... Still doesnt work.

regards

Alan

Den 01.10.2021 kl. 16.39 skrev Nate Graham:
> https://bugs.kde.org/show_bug.cgi?id=443148
>
> Nate Graham <nate@kde.org> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |nate@kde.org
>             Keywords|                            |wayland
>              Summary|invert screen colors        |Invert screen colors action
>                     |shorcut in wayland session  |doesn't work on Wayland
>                     |doesn't work.               |with an NVIDIA GPU
>
> --- Comment #2 from Nate Graham <nate@kde.org> ---
> Works fine for me on Intel. Seems more like the effect itself isn't working for
> you, rather than the shortcut not working. Probably an NVIDIA bug indeed.
>
Comment 5 Nicolas Fella 2022-08-03 15:40:22 UTC
*** Bug 457441 has been marked as a duplicate of this bug. ***
Comment 6 fanzhuyifan 2023-11-21 06:48:32 UTC
*** Bug 477304 has been marked as a duplicate of this bug. ***
Comment 7 fanzhuyifan 2023-11-21 06:50:25 UTC
(In reply to fanzhuyifan from comment #6)
> *** Bug 477304 has been marked as a duplicate of this bug. ***

Actually for me the symptoms are a bit different: the colors get very dim. Should I mark my report as a duplicate of this one?
Comment 8 David Edmundson 2023-11-23 09:08:50 UTC
*** Bug 477304 has been marked as a duplicate of this bug. ***
Comment 9 fanzhuyifan 2023-12-11 03:24:30 UTC
Currently the invert colors effect is working on wayland for me again.
I have a prime system with intel iGPU and nvidia dGPU. This works when I only use my dGPU, and in a prime setup with external displays.

Not sure if this is due to an upsteam fix, or updates to kwin.

The versions of my nvidia drivers are:
lib32-nvidia-utils 545.29.06-1
lib32-opencl-nvidia 545.29.06-1
nvidia-dkms 545.29.06-1
nvidia-prime 1.0-4
nvidia-settings 545.29.06-1
nvidia-utils 545.29.06-1
opencl-nvidia 545.29.06-1

Operating System: Arch Linux 
KDE Plasma Version: 5.90.90
KDE Frameworks Version: 5.246.0
Qt Version: 6.6.1
Kernel Version: 6.6.5-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i9-13900H
Memory: 15.2 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 4060 Laptop GPU/PCIe/SSE2
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Zephyrus G16 GU603VV_GU603VV
System Version: 1.0
Comment 10 fanzhuyifan 2023-12-11 03:57:06 UTC
(In reply to fanzhuyifan from comment #9)
> Currently the invert colors effect is working on wayland for me again.
> I have a prime system with intel iGPU and nvidia dGPU. This works when I
> only use my dGPU, and in a prime setup with external displays.

Correction: the invert effect is not consistently working, but rather working with high probability.
And when it doesn't work, a `kwin_wayland --replace` often fixes things.

When it doesn't work, I see this in my dmesg
> [drm] [nvidia-drm] [GPU ID 0x00000100] Framebuffer memory not appropriate for scanout
and this in my journal:
> Dec 10 19:53:40 arch kwin_wayland[3380]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"
> Dec 10 19:53:40 arch kwin_wayland[3380]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Comment 11 fanzhuyifan 2023-12-11 04:10:29 UTC
Checking the open source version of the nvidia drivers, it seems that this error message is issued if the call to `nvKms->isMemoryValidForDisplay` returns false [0].
This call checks if the relevant memory is in video ram, and returns false if the memory is in sysmem or compressed buffers, or another gpu [1].

So the fix should just be to make sure the memory is video ram of the relevant gpu? 

[0]: https://github.com/NVIDIA/open-gpu-kernel-modules/blob/4c29105335610933e744f4ab2524ea63fc39edaf/kernel-open/nvidia-drm/nvidia-drm-fb.c#L153
[1]: https://github.com/NVIDIA/open-gpu-kernel-modules/blob/4c29105335610933e744f4ab2524ea63fc39edaf/src/nvidia-modeset/kapi/src/nvkms-kapi.c#L1900
Comment 12 Bug Janitor Service 2023-12-11 17:00:05 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4782
Comment 13 Zamundaaa 2023-12-11 21:55:54 UTC
Git commit 6f06bf19893bcf70b7dfa4b85c8529a2d2abdf1a by Xaver Hugl.
Committed on 11/12/2023 at 22:46.
Pushed by vladz into branch 'master'.

plugins/invert: support color management

To do this, this commit adds infrastructure to include glsl files,
extracts all the color management functions and uniforms into such a
file, and makes use of it in the invert effect

A  +108  -0    src/opengl/colormanagement.glsl
M  +80   -114  src/opengl/glshadermanager.cpp
M  +1    -0    src/opengl/glshadermanager.h
A  +9    -0    src/opengl/saturation.glsl
M  +10   -8    src/plugins/invert/shaders/invert.frag
M  +11   -8    src/plugins/invert/shaders/invert_core.frag
M  +3    -1    src/resources.qrc

https://invent.kde.org/plasma/kwin/-/commit/6f06bf19893bcf70b7dfa4b85c8529a2d2abdf1a