On X11, there are several ways KWin can invert screen colors: either by using an OpenGL-based effect, or by adjusting the gamma ramp. While the former approach works well on most hardware, we experience some issues with the latter approach on AMD hardware. After adjusting the gamma ramp, the screen is filled with mostly white color. Steps to reproduce: * Open System Settings, go to Shortcuts, select KWin component under Global Shortcuts tab, assign custom shortcut to "Invert Screen Colors"; * Press the shortcut. (or just use xcalib -i) Observed results: The screen is filled with mostly white color. Expected results: Inverted screen. Hardware: Radeon RX 580 Mesa: 19.0.3 Linux: 5.0.13 xorg: 1.20.4
Created attachment 144265 [details] observed
Created attachment 144266 [details] expected
Created attachment 144267 [details] Screen without inverted colors
Please attach the corresponding dmesg output and Xorg log file.
Created attachment 144268 [details] dmesg output
Created attachment 144269 [details] Xorg log file
The issue is in the display driver. The driver does an sRGB degamma, CTM, then sRGB regamma + user regamma - which explains why the screen is mostly white (since the curve is inverse). If the the degamma block was put into linear bypass and the user regamma was applied directly to the regamma block that should give the correct result. Not sure if mapping the legacy gamma to the full LUT would break any IGT color or standard X11 gamma operations. I do have some changes that fix this kind of operation for atomic userspace but I'd have to take a look at the legacy one again to know if this is easy to support or not.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/drm/amd/issues/783.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.