Bug 110677 - Can't invert screen colors by adjusting the gamma ramp
Summary: Can't invert screen colors by adjusting the gamma ramp
Status: RESOLVED MOVED
Alias: None
Product: DRI
Classification: Unclassified
Component: DRM/AMDgpu (show other bugs)
Version: XOrg git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-14 16:37 UTC by Vlad Zagorodniy
Modified: 2019-11-19 09:27 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
observed (2.15 MB, image/jpeg)
2019-05-14 16:38 UTC, Vlad Zagorodniy
no flags Details
expected (6.24 MB, image/png)
2019-05-14 16:38 UTC, Vlad Zagorodniy
no flags Details
Screen without inverted colors (6.24 MB, image/png)
2019-05-14 16:40 UTC, Vlad Zagorodniy
no flags Details
dmesg output (90.33 KB, text/plain)
2019-05-14 17:18 UTC, Vlad Zagorodniy
no flags Details
Xorg log file (84.49 KB, text/plain)
2019-05-14 17:19 UTC, Vlad Zagorodniy
no flags Details

Description Vlad Zagorodniy 2019-05-14 16:37:30 UTC
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
Comment 1 Vlad Zagorodniy 2019-05-14 16:38:24 UTC
Created attachment 144265 [details]
observed
Comment 2 Vlad Zagorodniy 2019-05-14 16:38:45 UTC
Created attachment 144266 [details]
expected
Comment 3 Vlad Zagorodniy 2019-05-14 16:40:37 UTC
Created attachment 144267 [details]
Screen without inverted colors
Comment 4 Michel Dänzer 2019-05-14 16:59:59 UTC
Please attach the corresponding dmesg output and Xorg log file.
Comment 5 Vlad Zagorodniy 2019-05-14 17:18:36 UTC
Created attachment 144268 [details]
dmesg output
Comment 6 Vlad Zagorodniy 2019-05-14 17:19:03 UTC
Created attachment 144269 [details]
Xorg log file
Comment 7 Nicholas Kazlauskas 2019-05-14 17:29:02 UTC
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.
Comment 8 Martin Peres 2019-11-19 09:27:54 UTC
-- 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.