-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
wayland: add support for wp-color-representation-v1 #14936
base: master
Are you sure you want to change the base?
Conversation
ea9846f
to
c703f29
Compare
Download the artifacts for this pull request: |
Edit: Scratch that. I think this is just a small kwin bug with regards to the feature support it advertises. I think this can work there. Will double check later. |
d4c58e3
to
9e36ab3
Compare
So it turns out what was happening here is that kwin master supports |
9e36ab3
to
60751d9
Compare
I also added |
FWIW can we generate an ICC profile based on primary, transfer, etc on the fly and pass it to the compositor that does not support them? |
ICC profile generation isn't in scope or supported by this protocol if that's what you're asking. It supports sending an icc profile to the compositor. |
I mean generating an ICC profile from our side and sending the generated ICC profile to the compositor. |
Not really sure why mpv should generate ICC profiles. Wouldn't that be slow? Out of scope for what I want to do here though in any case. |
I would say it is in order to be compatible with more compositors. Of course, there is the opposite opinion that it is the duty of the compositor to be compatible with more applications, not the duty of the application.
AFAIK we just need to fill up some fields according to the ICC spec. We are not generating complex ICC like the kind that contains a LUT.
Agree. |
HDR metadata can change from frame to frame, so we'd be generating a new ICC profile for each frame and the compositor would also need to apply it for each frame. This just doesn't work. |
60751d9
to
cd357cc
Compare
d6ce8ce
to
be14cc7
Compare
33255c2
to
3d88959
Compare
Do we plan to merge it or wait for protocol to become stable first? I think we can iterate on master with it. |
I have no problem with merging before it becomes stable. But someone needs to verify on some compositor that this actually works and has a desirable outcome. I lack the hardware to really test anything meaningfully. |
I think it is mostly on compositor side anyway, as long as mpv sends the metadata there is not much else we can do. |
That's true but e.g. I have no idea how this works with whatever kwin currently does with vulkan for hdr. Also now that I think about it, color representation isn't in any compositor yet and I dunno if people are going to keep the |
I could test this, however when I try to build I currently get this (gcc 14.2.1, linux)
Not sure if it's me or really a problem with the code... I also see it for some of the PR voters. |
I think I baited @Dudemanguy to commit broken code, sorry. Changing this one line to the following should work. struct pl_hdr_metadata *hdr = &p->target_params->color.hdr; |
c44ab3a
to
fdb2cf9
Compare
Yeah oops. Should be fixed now. |
Thanks! Alright, I gave this a test. Used Mutter 47.0, and then via looking glass I enabled both hdr and color_management:
In general, I use this config:
With this change, it's possible to play HDR content with proper colors by simply starting mpv like this: Without this change, the colors will look washed out / wrong. I compared it to what's possible right now (without this change), i.e. with vk_hdr_layer, like this: This change definitely does something, and I see it as great value already. Of course, it would be great if mpv could somehow detect and set target-prim + target-trc automatically. Any chance this is possible? |
Thanks. Nice to hear this actually works. I think I will probably split out the xx-color-management-v4 addition in a separate PR since I know that one is currently in use by several compositors. The color representation change can live on in draft form for now. I merged the two things together since they are closely related changes and it was getting annoying to have to rebase all the time while I was working on this.
The default for both of these is Edit: Out of curiosity, does it work if you use |
What do you mean with
It seems like If more testing is needed you can let me know specific combinations of settings and I'll try them out. |
So it seems we are still dependent on vulkan for correct colors for now. That's OK. Mutter must strictly only use the vulkan extension under the hood.
This is kind of not good though. Can you confirm which setting actually makes the difference here? I assume only |
This would be What I would focus on first is EDIT: @denkdran I could reproduce the same results as yours. I will debug it, because from quick look, seems that something is off with metadata. But I did quick test only, don't have time rn. |
@Dudemanguy You are correct, the flickering only occurs with @kasper93 Yes! Right, with BTW, if I use
EDIT: While testing
|
Yeah that would be because both mpv and that layer are attempting to to use the protocol on the same surface which is a hard error. I guess a workaround would be to not use the protocol on our side if that environment variable is set. |
This has been reduced to just |
This is yet another color-related protocol for wayland. It's much more simple compared to xx-color-management-v4, but perhaps some compositor out there may find it useful. For now, this is copy and pasted from the main upstream fork*. *: https://gitlab.freedesktop.org/swick/wayland-protocols/-/tree/color-representation
Alternative to #14917. The downside is that this protocol is ungodly complicated. Upside is that more people seem to implement and in theory when the color management protocol lands upstream next decade it will be like this. So probably longer term this is better.
Weston atm doesn't support the minimum features we need so it's not good for testing other than making sure I didn't make a protocol error. kwin is probably the best but
xx-color-management-v4
is only supported in kwin master at the moment and not at release (release supports v2). So not really tested yet until I go compile a bunch of kde junk later. Mutter 47 seems to supportxx-color-management-v4
though.TODO: