-
Notifications
You must be signed in to change notification settings - Fork 3k
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
colors change as subtitles display, or when osd is drawn when using dmabuf-wayland #14592
Comments
I'm not able to reproduce on git master or 0.38 on mutter 46.3.1. Flickering when subtitles show sounds like a compositor and/or driver bug to me. We just draw shm buffers for the subtitles/osd and attach it to a different surface and hand that off to the compositor. Could you try a different compositor (weston, kwin, whatever) and see if the same thing happens? |
GNOME is likely switching between direct scanout and compositing whenever subtitles appear disappear. Alternatively GNOME might be using an overlay plane for the subtitles and that plane might be getting activated/deactivated. |
I could reproduce it with weston. Exactly how it happens with Gnome. Also, this only happens with dmabuf-wayland, not with gpu-next. Maybe Intel specific, then? |
can reproduce on wlroots with amdgpu as well. only happens when direct scanout is active |
Well I'm not a compositor developer but I assumed this was supposed to work with direct scanout without any weirdness? In fact, rmader himself was the one that submitted the patch in #12237 to make it so direct scanout was possible on mutter when the the osd was not being shown. I would assume that, at least at the time, nothing was flickering when the osd would hide/appear. @rmader: any insight here? |
This is most likely the case and the slight color mismatch is unfortunately expected for the time being until we have the color-management and color-representation protocols. Until then compositors have to guess and unfortunately Mutter and Weston currently default to e.g. bt601 color curves - which is slightly different from bt709. While we could tweak that - e.g. defaulting to bt709 as much more content uses that - most work in that area just focuses on getting the proper protocols landed/implemented. On the side of Gnome we'll probably be too late for 47, however 48 will likely work out. |
P.S.: as an intermediate solution it might make sense to always keep the overlay visible in the given situation. That will increase power consumption accordingly of course. |
Hmm I see. So in that case we can just pretend the osd surface always has contents if the colorspace isn't bt601. Does this work for you guys?
It might be worth vendoring in the color management protocol on our side and using it instead of waiting for it to be official. |
Yeah, should somewhat work for the time being.
That's kinda happening already, however the issue is rather the compositor implementations, not the protocol. At least for Weston and Mutter I can attest though that we're much closer now to have thing working. If you're interested, here's a small Gstreamer prototype that I'll be further working on next month: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6830 |
For this specific problem, it seems like color-representation would suffice. I would have no problem vendoring that for mpv usage since it's pretty important for our use case and if it would be helpful for compositors. Of course, color-management is of interest to us as well but that seems quite a bit more complicated. |
vo_dmabuf_wayland maps and unmaps the osd surface as needed so compositors can be smarter and use direct scanout. Unfortunately, this has a bad side effect of causing flickering on most colorspaces. This is because compositors have to assume the content is a certain colorspace when using direct scanout and there is no way in wayland for clients to signal what colorspace they actually are in. Apparently mutter and weston both assume bt601 which of course breaks anything in bt709. For now, we can workaround this problem by simply always considering the osd surface to have contents in it if the mp_image of the actual video contents isn't in bt601. This breaks direct scanout, but that's better than having flickering whenever subtitles appear/disappear. The proper solution would be to use the color-representation protocol or something similar, but unfortunately anything color-related in wayland is still stuck deep in development. Fixes mpv-player#14592.
Can anyone confirm if this still occurs after #15048? I think it should work on mutter 47 now unless color-representation is also needed. |
I can reproduce this on KWin 6.2.0 and mpv commit 187fffd, but only when:
mpv Information
Other Information
|
Can you post of a log of that happening? If kwin just happens to not be using its color management stuff at all then that's expected. But I think there's probably a gap item on our end too when it comes to bt. 1886. |
I played the video for a few seconds, triggered the color change, then quit. |
Yeah that's the problem. It would be worth writing this transfer function wayland side but kwin doesn't support custom transfer functions yet so it wouldn't solve it. What happens if you try to force a trc? e.g. with |
There is still color change, but I noticed that the osd info (press |
Oh sorry I forgot that option only does anything for gpu-next. It actually makes sense for vo_dmabuf_wayland to support it too. That's something I should do. If you don't mind, could you hack this patch in real quick? Obviously don't daily drive it.
|
Yeah, the color didn't change with osd now, although the |
Thanks. So that means we should just always set something in that case. I wonder what the sanest enum to pick would be. Guess I'll look at what compositors do. |
Fixes mpv-player#14592 as long as the compositor supports it.
Fixes mpv-player#14592 as long as the compositor supports it.
Mutter on master should work out of the box now with pretty much all real world files since https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4062. For everything else, you may have to trick the compositor by specifying some other primary and/or transfer function. e.g. using If your compositor doesn't support |
May I ask what it actually means by "map BT.1886 to BT.709"? Does mpv convert the buffer internally to a state suitable for compositor to apply BT.709 TF on it, or mpv just pass the buffer unchanged, letting the compositor apply BT.709 TF when it really should be applying BT.1886 TF? |
We don't do any transformations. mpv just signals the transfer function of the surface to the compositor. For libplacebo, A compositor that gets |
Well I seem to understand now. And it is kinda unfortunate that BT.1886 is not included in H.273 CICP when it is out for over a decade. |
The next versions of Mutter (46.8, 47.4 and 48) will now default to bt709 matrix coefficients and ensure the KMS drivers use the same (instead of relying on their default values). I.e. this issue is now fixed and there shouldn't be any visible difference between compositing and offloading any more, see https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4204 Work on the color protocols also continues, but might not land fully for 48, in which case e.g. HDR10 content will continue to look wrong - but at least consistent. |
mpv Information
Other Information
Reproduction Steps
Expected Behavior
Colors not changing/flickering like that, regardless of fullscreen or windowed mode.
Actual Behavior
Colors change/flicker strangely, when in fullscreen mode, and subtitles display or the osd is drawn.
Log File
output.txt
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
--log-file=output.txt
.The text was updated successfully, but these errors were encountered: