Bug 486725

Summary: sRGB content is over-saturated in HDR
Product: [Plasma] kwin Reporter: TheFeelTrain <thefeeltrain>
Component: colour-managementAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: normal CC: CoelacanthusHex, dashonwwIII, heri+kde, kilgore.trout, nate, thefeeltrain, xaver.hugl
Priority: NOR    
Version: 6.0.4   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: sRGB
SDR Stretched
HDR
sRGB colors tested in SDR
sRGB colors tested in HDR

Description TheFeelTrain 2024-05-07 12:54:58 UTC
Created attachment 169268 [details]
sRGB

SUMMARY

Basically the exact opposite of this bug: https://bugs.kde.org/show_bug.cgi?id=482780

Instead of colors being washed out in HDR, the colors are over-saturated.

STEPS TO REPRODUCE
1. Enable HDR

OBSERVED RESULT

Colors have too much saturation.

EXPECTED RESULT

sRGB content should look identical in HDR and SDR mode when SDR Intensity is set to 0%.

SOFTWARE/OS VERSIONS

Linux: Arch Linux
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0

Monitor: InnoCN 27M2V
Driver: Mesa 24.0.6-arch1.2

ADDITIONAL INFORMATION

I have included 3 attachments to help demonstrate.

The attachment labeled "sRGB" is what the image is supposed to look like. This is with the monitor at default settings with an ICC profile enabled. In a perfect world it would look like this in all circumstances.

The attachment labeled "SDR Stretched" is what the image looks like without an ICC profile. This is an sRGB image being stretched to the full gamut of my monitor (which is around 167% of sRGB).

The attachment labeled "HDR" is the same image with HDR enabled in Plasma settings with SDR Intensity set to 0%. Since an SDR Intensity of 0% is supposed to represent Rec.709 it should look close to the sRGB image, but it does not. It is clearly wider gamut than it should be.

If Plasma were merely stretching sRGB content up to Rec.2020 the "HDR" attachment would look the same as the "SDR Stretched" attachment, but it does not. So it is clear that Plasma is attempting to clamp the image down to Rec.709, it's just not doing a very good job. It lands somewhere in the middle of where it should be and the full Rec.2020 space.

This is further confirmed with an X-Rite i1 Pro colorimeter and DisplayCAL, as DisplayCAL applies the ICC profile on its own (which you can see for yourself by enabling an ICC profile in Plasma, it will get applied by both Plasma and DisplayCAL simultaneously and the test results will be bad). Since DisplayCAL is the one doing the color conversions itself it is possible to test ICC profile color accuracy while in HDR mode. Both tests are run with completely default monitor settings as to reduce the number of variables.

If you look at "sRGB colors in SDR" image you can see they are basically perfect, while "sRGB colors in HDR" has them all over the place. While I would not expect them to be 100% identical they should at least be close.

I do recognize this could simply be my monitor's default settings/handling for HDR and SDR being wildly different, but I have no way to test this as this monitor does not allow any adjustments to be made in HDR mode. Which is partially why I am posting this. I am hoping that someone else with a colorimeter could also run some tests and see if they have similar results.

If this cannot be replicated, the monitor is probably at fault and hopefully the issue can be solved once ICC profiles are available in HDR mode. But if it can be replicated it means it is an actual bug with how sRGB content is being handled in HDR by Plasma/kwin. Being able to adjust "SDR Intensity" below 0% could also be useful in this scenario.
Comment 1 TheFeelTrain 2024-05-07 12:55:28 UTC
Created attachment 169269 [details]
SDR Stretched
Comment 2 TheFeelTrain 2024-05-07 12:55:52 UTC
Created attachment 169270 [details]
HDR
Comment 3 TheFeelTrain 2024-05-07 12:56:29 UTC
Created attachment 169271 [details]
sRGB colors tested in SDR
Comment 4 TheFeelTrain 2024-05-07 12:56:47 UTC
Created attachment 169272 [details]
sRGB colors tested in HDR
Comment 5 TheFeelTrain 2024-05-07 13:18:00 UTC
I realized I should also mention that the problem seems to be with sRGB and/or Rec.709 content only. 

One thing that can be easily spotted by the naked eye is skin tones. In sRGB content some skin will look orange, but in P3 or Rec.2020 movies I have not noticed this. I have tested dozens of movies in mpv (with ENABLE_HDR_WSI=1 and other appropriate HDR settings) and they all seem fine.
Comment 6 Zamundaaa 2024-05-28 17:26:32 UTC
I'll have to try profiling again (last time I tried, it didn't really work with DisplayCAL), but switching between HDR and the SDR sRGB mode on my monitor, sRGB content visually looks the same to me