Skip to content
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 Fractional Scaling #8514

Closed
kkanungo17 opened this issue Jan 25, 2021 · 12 comments
Closed

Wayland Fractional Scaling #8514

kkanungo17 opened this issue Jan 25, 2021 · 12 comments

Comments

@kkanungo17
Copy link

How does mpv handle fractional scaling under wayland? Does it render to 2x then downscaling or can it scale directly to the physical pixels?

@emersion
Copy link
Contributor

There's no way for a Wayland client to scale directly to the physical pixels at the moment. mpv renders at 2x and is downscaled by the compositor.

@Dudemanguy
Copy link
Member

Dudemanguy commented Jan 25, 2021

We can't handle it. The wayland protocol actually has no support for fractional scaling client side. What current compositors do for fractional scaling is probably something like resizing the final buffer at the very end (for example: upscaling 3x and then downscaling 2x for 1.5x scaling). When it comes to integer scaling, what mpv does (by default) is render whatever the actual pixels of your screen are (i.e. a 1920x1080 window is rendered at exactly 1920x1080 pixels on a 4k screen with 2x scaling). That ensures that all scaling is done completely by mpv. If you use fractional scaling, all bets are off. What actually happens with the scaling depends on whatever the implementation details are. Most likely, some of the scaling is done by mpv and the rest by the compositor. In terms of "ideal" image quality, it is best not to use fractional scaling.

@kkanungo17
Copy link
Author

Ah, too bad. Hopefully Wayland exposes a way for clients to render directly to physical pixels. I don't think scaling can be turned off for mpv specifically too, can it?

@Dudemanguy
Copy link
Member

mpv will render at whatever the video resolution is (assuming no fullscreen, maximize, etc. is set). Now of course, whether or not that's what you actually see depends on your compositor as that ultimately gets the final say in what's presented on the screen. With integer scaling, we can take the DPI of the screen into account, but with fractional scaling there's no way to "stop" the compositor from scaling whatever it wants to scale.

Sidenote: Technically you'll almost always be scaling chroma but that's a different topic.

@kkanungo17
Copy link
Author

Yeah I get that, I just meant that if mpv could be added as an exception from compositor scaling.

@pkupper
Copy link

pkupper commented Jan 27, 2021

Is anyone actively working on a wayland protocol to enable client-side fractional scaling or ist there a good reason why that would not be possible? For many setups (including mine) 1x and 2x scaling just isn't practical.

@blaueente
Copy link

This issue should not be closed. True, it may not be possible right now, but I think it should be solved eventually, as there are many devices now in the field and on the market that just require 150% scaling, say laptops with 1080p or large 2160p desktop monitors. Luckily there is some discussion on freedesktop do to this on a protocol level:
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/47
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/34

@avih
Copy link
Member

avih commented Aug 19, 2021

This issue should not be closed. True, it may not be possible right no

It should remain closed. Right now mpv does the best which it is allowed to do, so there's no point to keep it open.

Once/if the situation changes and mpv could do something with new protocols/APIs/etc, a new issue can be filed.

@Dudemanguy
Copy link
Member

Fractional scaling in wayland works on a compositor level already. It's not like you can't get 150% scaling right now. Clients just have no knowledge of non-integer scales.

@littlewu2508
Copy link

wayland: add wp-fractional-scale-v1 support

I believe this issue is resolved now, with https://github.com/mpv-player/mpv/releases/tag/v0.36.0

@Dudemanguy
Copy link
Member

Yes, we support proper fractional scaling now.

@norpol
Copy link

norpol commented Feb 25, 2024

Just verified with https://github.com/swaywm/sway/releases/tag/1.9 which includes wp-fractional-scale-v1 mpv is indeed rendering in the correct resolution (playback at 2x scale shows 1920x1080 for a video, rather than before doubling the video playback resolution).

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants