puxplaying / mutter-x11-scaling

Mutter build with Ubuntu patch for Xorg fractional scaling on Manjaro / Arch Linux
107 stars 8 forks source link

Slow rendering for large screens #19

Open mmnaseri opened 2 years ago

mmnaseri commented 2 years ago

I am observing slow rendering of overlay windows in fractional scale beyond a certain point in my screen:

.------------------.------------------.
|        A         |        B         |
`------------------`------------------`

Anything in the A region renders quite snappily. Anything past this takes some time to render. Case in point, all the header menus in gnome applications and any overlay created by Firefox extensions (e.g. Bitwarden window). All interactions also are delayed. The delay gets worse as screen size increases or ratio gets closer to 100%. Performance is better the closer to 200% you get.

Another potentially related point is that windows now exhibit tearing when moving around. I have confirmed that both these issues are fixed if I remove mutter-x11-scaling.

puxplaying commented 2 years ago

Hi, thanks for the report!

As I see and understand it, this bug is somewhat expected on Xorg, because of the way how this experimental feature works. Xorg can not render different scaling factors on different monitors, and neither can it do fractional scaling.

It is basically a hack which renders the desktop at a higher resolution than your screen. So, after X has finished drawing the frame at a higher resolution, it is software scaled back (xrandr). This means you are burning a lot of CPU, and also it is very hard to avoid slowdowns and tearing, since the xrandr layer happens after the vsync logic.

As far as I understand, only Wayland can do fractional scaling as efficiently as integer scaling.

I will also mention the developer @3v1n0 here, in case this bug has not been reported on Ubuntu.

mmnaseri commented 2 years ago

Thanks for looking into this. I think as far as my usage is concerned then this makes it unstable. I have a rather large screen and not being able to use ~33% of it is a no go. I will have to downres the screen for now. Keep up the good work!