-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
renderer/cm: allow gamma 2.2 instead of sRGB EOTF #12094
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
sRGB is the standard and the default for most content, no need to change that globally.
Shouldn't break the proto if we decide to change it though. And shouldn't be much of a difference, 2.2 is a close enough approximation of sRGB. No need to touch the shaders. If gamma 2.2 works better for SDR -> HDR then sdr surfaces without CM ( I don't use Can be tested as is to verify that 2.2 looks better. Might not be good enough for OLED monitors because 2.2 is a bit brighter overall and may cause "crushed" blacks. Probably should end up as a config option. |
|
@UjinT34 I think that quote referring to sRGB was specifically about primaries. Looking into the spec w.r.t. transfer functions:
Thank you so much for the feedback! I'll get going on those changes tonight |
|
I'm a bit confused here. sRGB is a colorspace which uses the same primaries as BT709 and an sRGB TF. BT709 itself uses a piece-wise TF. Different gammas are approximations which can't handle blacks well enough. It's not clear which TF should be considered the default for the source content and which TF should be used as a default for an output. sRGB seems to be the correct one and gamma 2.2 is used when performance is more important than colors.
Doesn't mean that this is the correct looks. With |
61045aa to
8cfd896
Compare
819be13 to
6f406f2
Compare
|
@UjinT34 Looking at this has made me wonder if it makes sense for a follow-up PR to add Edit: This PR only targets the HDR case, but maybe it should be reworked to add two new |
Makes sense. Might need to split this option to allow setting primaries and TF independently. Will be tricky to do it backwards-compatible way though. |
|
I'm thinking just a It wouldn't cover the case of users with |
7757962 to
51eb53b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
@UjinT34 I'd argue in favor of setting the defaults to gamma 2.2 both for But my current implementation leaves the defaults as they are now. Otherwise, ready for review. Edit: There's some good discussion at mpv-player/mpv#16915 |
51eb53b to
17553c2
Compare
51eb53b to
fc2f631
Compare
fc2f631 to
876afd0
Compare
876afd0 to
a545cac
Compare
|
@s0mebodyhelpme I flubbed a change when I pushed last night (sorry about that!). The latest version of this branch should have the SDR settings fixed, and I'm using them on my machine as I write this. Edit: Note that screenshare brightness will be messed up again (like it is on the |
|
@njdom24 thanks! appreciate the fix and your effort in general, and i'm looking forward to your further work on HDR with Hyprland so that it can get better. Also look forward to testing whatever you've got in mind for the screenshare fix. |
a545cac to
e52ee50
Compare
e52ee50 to
37d4426
Compare
|
I'm keeping an eye on some discussion of a potential v2 of the proto: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/456#note_3159579 Looks like these changes may be relevant for supporting whichever direction it ends up going |
|
Thanks a lot for your work on this! May I ask, could you also add a config option of the gamma value in the power curve? e.g. when the gamma option is selected, let the user set gamma 2.4 or 2.6 instead of 2.2, similar to macOS? Reason being, I think for some display types (e.g. OLED) or in darker ambients higher gamma values can look/behave slightly better. |
|
@ssareta I'm not opposed to enhancing this in the future, but I want to focus this PR on just Gamma 2.2 because it's the one in the spec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this ready to go?
37d4426 to
cd455e4
Compare
|
@vaxerski Yeah, should be ready for review |

Describe your PR, what does it fix/add?
Instead of the piecewise sRGB EOTF, allow the user to choose Gamma 2.2 for untagged, and/or all sRGB EOTF surfaces.
Makes SDR content with
cm = hdrlook more like how it does withcm = srgbon an average monitor in SDR, as SDR media content typically assumes a gamma 2.2 curve.Should help #10950, #11341 or anyone who felt the existing gamma curve felt too "washed-out" compared to what they're used to.
Adds
render:cm_sdr_eotffor specifying the transfer function for sRGB content in general for both SDR and HDR.0: Piecewise sRGB (Existing behavior)1: Treat untagged surfaces as Gamma 2.22: Treat untagged surfaces and all sRGB EOTF surfaces as Gamma 2.2I added
2because a lot of desktop content seems to have been developed in an environment that is encoded for sRGB on the PC side, with the expectation of being decoded by a Gamma 2.2 monitor/TV. KWin seems to behave with this in mind, and this tweak gets me the appearance I expect after spending some time with KDE.1was my initial plan, but I noticed a fair few apps did get tagged for sRGB transfer that I wasn't expecting (Gamescope, Proton Wayland)On the
monitorv2side, we also have asdr_eotfvar with values of:0: Follow the default SDR EOTF fromrender:sdr_eotf. This will be sRGB forcm_sdr_eotf = 0, and Gamma 2.2 for1,21: sRGB piecewise function2: Gamma 2.2Many (most?) monitors with an sRGB clamp also enforce a Gamma of 2.2 because it's become a standard (I don't think you'll find the piecewise sRGB EOTF on much beyond color professional displays). This allows us to acknowledge that for displays configured that way.
I left the defaults as sRGB on both ends to avoid breaking anyone's setups. Personally, I'm having a good time setting
render:cm_srgb_eotf = 2andmonitorv2[*]:cm_srgb_eotf" 1to keep a consistent image in SDR and HDR.This also allows you to set
render:cm_sdr_eotf = 0andmonitorv2[*]:sdr_eotf" 1to get the piecewise sRGB curve on a Gamma 2.2 display, making SDR mode consistent with the default SDR-on-HDR image, if you want.Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
This is the default behavior in KWin, wlroots(
-git), and I believe Mutter.I believe macOS allows the user to choose the EOTF.
Works so far on my machine. With my monitor's SDR settings set to sRGB w/ Gamma 2.2, toggling HDR on and off in Elden Ring keeps a consistent image (but with different dynamic range). This is with setting
render:cm_sdr_eotf = 2andmonitorv2[*]:sdr_eotf" 0(or2).Editing
CM.glslto over-brightenCM_TRANSFER_FUNCTION_GAMMA22as a sanity check,cm = srgbis entirely unaffected by default as expected, and withcm = hdr, andrender:cm_sdr_eotf = 1, most of my windows follow the expected new gamma curve, except forkitty, which is color-managed and explicitly requests sRGB.Is it ready for merging, or does it need work?
Ready