mpv
mpv copied to clipboard
In fractional scaling on X (Cinnamon) if no app in "always on top": when starting and exiting full screen mpv resets display(s) back and forth
Important Information
Provide following Information:
- mpv version: 0.34.1
- Linux Distribution and Version: Linux Mint 21 Cinnamon Vanessa base: Ubuntu 22.04 jammy
- Source of the mpv binary: from LM repos
- Window Manager and version: x11 server: X.Org v: 1.21.1.3 driver: X
Reproduction steps
The issue is I think both X, fractional scaling and mpv related. I hope it can be solved (e.g. some workaround) in mpv - see below. When I start video in mpv when display is set to fractional scaling in Cinnamon running on X:
- Display(s) turn off, then "adjust resolution" then on again. Same when mpv is exited. It takes several seconds on my PC. It is annoying. Fractional scaling also messes up e.g. xscreensaver, so I guess it is more fractional scaling to X issue, but:
I just noted that if I have some app in "always on top" mode (even on display - if two - not where videos are displayed full screen) the reset does not happen, visually mpv is fine and full screen.
Maybe there is some way (settting?) to run mpv is full screen w/out "resetting resolution"? "always on top" workaround has its drawbacks. If no setting currently, maybe it is easy to add to mimic behavior of having some app in "always on top" ?
Looks like it is related to XRandr scaling. You may try --x11-netwm=no
or --x11-bypass-compositor=never
.
FWIW, speaking personally, I am strongly against the use of fractional scaling on X.
BTW please attach your log file.
@ruihe774, --x11-bypass-compositor=never
(also =no
) seems to solve the issue for me (but not --x11-netwm=no
). Thank you. I have not noticed any problems with performance and/or quality. What are downsides of this setting?
Would you still like to get log file? Both with setting to no
and yes
?
I have not noticed any problems with performance and/or quality.
In Cinnamon (and some other DEs), fractional scaling is done using XRandr scaling. For example, if the resolution of your monitor is 1920x1080, and you set the scaling factor to 150%, XRandr will fake its frame buffer to 1280x720 (or 2560x1440 if 2x; I'm not very certain about its behavior). Applications draw to the scaled frame buffer and XRandr then scales the frame buffer to the resolution of your monitor. The scaling algorithm used by XRandr is likely low-quality and can cause blurry text and gamma inaccuracy.
You can check the resolution of the fake frame buffer in mpv. Enter fullscreen and use shift+i
. See the "resolution" field in the "display" section.
Would you still like to get log file?
There is nothing mpv can do with this issue. With --x11-bypass-compositor
and fullscreen, mpv asks X11 to bypass the compositor. Meanwhile this also bypass the XRandr scaling. The delay is caused by XRandr changing the resolution of its frame buffer.
I believe the above explanation is accurate and indeed there is nothing we can do here. Also, 0.34.1 is not supported anyways. If you are using only one monitor, I would recommend using Xft.dpi
instead personally.
@ruihe774, I've just noted:
--x11-bypass-compositor=never
( that is disabling bypass of "XRandr scaling" by meaning of the words) gets rid of delay (which is when as you wrote "XRandr changing the resolution of its frame buffer."). So enabling scaling results in skipping of scaling. Kind of strange...
What's going on under the hood? TIA
@ruihe774, I've just noted:
--x11-bypass-compositor=never
( that is disabling bypass of "XRandr scaling" by meaning of the words) gets rid of delay (which is when as you wrote "XRandr changing the resolution of its frame buffer."). So enabling scaling results in skipping of scaling. Kind of strange... What's going on under the hood? TIA
The delay is caused by XRandr changing the resolution of its frame buffer, from a scaled frame buffer (which is used by the compositor), to a native frame buffer (which is used by mpv if --x11-bypass-compositor=yes
)
Option | Fractional Scaling | Compositor resolution | mpv resolution | Transition time |
---|---|---|---|---|
--x11-bypass-compositor=yes | disabled | native | native | no |
--x11-bypass-compositor=never | disabled | native | native | no |
--x11-bypass-compositor=yes | enabled | scaled | native | yes |
--x11-bypass-compositor=never | enabled | scaled | scaled | no |