Bug 478967

Summary: Wrong contrast on screenshots in the Wayland session
Product: [Plasma] kwin Reporter: Ridge <kde>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate
Priority: NOR Keywords: qt6, wayland-only
Version First Reported In: master   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Final Fantasy 14 screenshot taken with the in-game screenshot tool
Final Fantasy 14 screenshot taken with Spectacle which is darker

Description Ridge 2023-12-24 13:31:17 UTC
Created attachment 164424 [details]
Final Fantasy 14 screenshot taken with the in-game screenshot tool

SUMMARY
In the Wayland session, screenshots taken with Spectacle increases the contrast of what is actually displayed on screen, making the resulting screenshot darker than what it's supposed to be.

It's not just in the screenshot itself; activating rectangle select mode slightly increases the contrast on all screens, until a screenshot is taken and the Spectacle process has terminated.

To demonstrate, I'm going to add two images taken in Final Fantasy 14.
The first one is taken using the in-game screenshot tool, the second is with Spectacle (capture single monitor mode), notice how the screenshot taken with Spectacle is noticeably darker in some areas, especially the darker areas.

It's most noticeable in the shadows, and in darker scenes this is especially problematic.

STEPS TO REPRODUCE
1. Begin a Plasma Wayland session.
2. Take a screenshot with Spectacle.
3. Compare the result with what you captured.

OBSERVED RESULT
The contrast is wrong, and the resulting screenshot is darker than it should be.

EXPECTED RESULT
A lossless PNG without any modifications or defects.

SOFTWARE/OS VERSIONS
Linux: 6.6.8
KDE Plasma Version: 5.91.0
KDE Frameworks Version: 5.247.0
Qt Version: 6.7 Beta 1

ADDITIONAL INFORMATION
Also happens on Qt 6.6, does not happen in the X11 session.
Comment 1 Ridge 2023-12-24 13:33:53 UTC
Created attachment 164425 [details]
Final Fantasy 14 screenshot taken with Spectacle which is darker

Forgot to add to the main post, I'm using a Radeon RX 6700 XT, Mesa 23.3.
Comment 2 Ridge 2023-12-24 21:08:47 UTC
Sorry for the excessive e-mails, but I wanted to add I can reproduce this on Neon Unstable, downloaded 23rd of December 2023.
Comment 3 Bug Janitor Service 2024-01-12 21:21:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4906
Comment 4 Zamundaaa 2024-01-13 13:36:22 UTC
Git commit c1e09f65c9c621113625c32491ac3f59275b3b2c by Xaver Hugl.
Committed on 13/01/2024 at 14:28.
Pushed by zamundaaa into branch 'master'.

opengl/glshader: use gamma 2.2 for sRGB render targets

The sRGB global colordescription uses gamma 2.2, so this function also has to do
it, or the shader will end up doing a colorspace conversion where there shouldn't
be one.
This also meams that HDR content will be wrongly encoded, but fixing that while
also dealing with sRGB content correctly requires a lot more invasive changes, in
KWin and in the screenshot and screencast APIs.

M  +1    -1    src/opengl/glshader.cpp

https://invent.kde.org/plasma/kwin/-/commit/c1e09f65c9c621113625c32491ac3f59275b3b2c
Comment 5 Zamundaaa 2024-01-13 17:39:56 UTC
Git commit 97df21448712247f54eeada61e6fadab8bf13932 by Xaver Hugl.
Committed on 13/01/2024 at 18:28.
Pushed by zamundaaa into branch 'Plasma/6.0'.

opengl/glshader: use gamma 2.2 for sRGB render targets

The sRGB global colordescription uses gamma 2.2, so this function also has to do
it, or the shader will end up doing a colorspace conversion where there shouldn't
be one.
This also meams that HDR content will be wrongly encoded, but fixing that while
also dealing with sRGB content correctly requires a lot more invasive changes, in
KWin and in the screenshot and screencast APIs.


(cherry picked from commit c1e09f65c9c621113625c32491ac3f59275b3b2c)

M  +1    -1    src/opengl/glshader.cpp

https://invent.kde.org/plasma/kwin/-/commit/97df21448712247f54eeada61e6fadab8bf13932