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

Add fractional scaling support #117

Open
ma1onso opened this issue Sep 12, 2018 · 22 comments
Open

Add fractional scaling support #117

ma1onso opened this issue Sep 12, 2018 · 22 comments
Labels
Status: Blocked Something else needs to be done before this can be fixed

Comments

@ma1onso
Copy link
Sponsor

ma1onso commented Sep 12, 2018

Hi guys,

I recently acquired one laptop with 1920x1080 resolution on 15.6 inch, Windows (pre installed) automatic adjust scaling to 125%, but elementary os does not support this. I know that Xorg is lack the this feature, but Ubuntu is put effort in this: supporting fractional scaling in gnome shell and independent developers also HiDPI Fixer.

Gnome Wayland example:

image

Is a very important feature for current machines.

Greetings


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ma1onso ma1onso changed the title Fractional scaling support Add fractional scaling support Sep 12, 2018
@liamkinne
Copy link

+1 on this. Lack of granular scalability is something that friends who have used elementary have often complained about.

@cassidyjames cassidyjames added the Status: Blocked Something else needs to be done before this can be fixed label Oct 24, 2018
@cassidyjames
Copy link
Contributor

Proper support for this is blocked by moving to Wayland. X does not natively support it, GTK does not currently natively support it, and any hacks to try and enable it right now are worse than existing accessibility options for text size.

@marcolaux
Copy link

Sadly both options don't really work on a 14" 2560x1440 display.
HiDPI is too big, accessibility text scaling to larger is still too small.
I tried to make the general UI font bigger (from 9 to 11) but with this and the accessibility option larger everything looks kind of out of place (as this is not the way to go).
It's a tricky situation and I know it's hard to please every configuration out there. But on Gnome it works better out of the box because the default UI font is bigger by default so the accessibility option for larger text works there.

@cassidyjames
Copy link
Contributor

@Hyphone with recent updated to System Settings → Desktop → Appearance, there's a new "Small" text option that combined with HiDPI might be a better fit. But actual desktop-wide non-integer scaling is still not possible with the technology stack (yet!).

@marcolaux
Copy link

marcolaux commented Jun 26, 2019

@cassidyjames Thank you for the reminder. I also actually have to revise my previous statement in terms of too small texts. I compared elementary OS "Larger" text option with GNOMEs large text and it's identical. elementary OS by default indeed uses smaller fonts but the "Larger" option increases the size by 1.4 while GNOMEs larger text option increases it by 1.25 wich results in kind of identical accessability.

I guess that the "smaller" text in combination with HiDPI would be the better option for readability as the contrast of text and UI elements in elementary OS is lower (compared to Adwaita for example) and results in more eye strain in the evening hours when using LoDPI and the "Larger" text option on my display.

@PlatonB
Copy link

PlatonB commented Apr 10, 2020

Fractional scaling is now available upstream. This mode works (albeit very bad) in Ubuntu 20.04 with the latest updates:
VirtualBox_ubuntu-20 04-beta-desktop-amd64_10_04_2020_12_31_16

Are there plans to implement it in elementary OS 6?

@cassidyjames
Copy link
Contributor

@PlatonB someone will need to see what Ubuntu is doing there and see if it's worth implementing. From what I've seen and heard, it introduces pretty bad screen tearing and performance issues, so I would be reluctant to add it.

@validatedev
Copy link

validatedev commented May 4, 2020

Well, I somehow managed the achieve fractional scaling with these:
Get my monitor's scaled resolution, 2160x1440 -> 150% -> 2880x1920 (from https://github.com/alex-spataru/HiDPI-Fixer)
Create a new monitor config like these: https://github.com/nekr0z/linux-on-huawei-matebook-13-2019/blob/master/10-monitor.conf on /etc/X11/xorg.conf.d
Use modesetting driver for intel with https://github.com/nekr0z/linux-on-huawei-matebook-13-2019/blob/master/20-intel.conf file on /etc/X11/xorg.conf.d
Then reboot.
If you use your new resolution with 200%, that's the same thing with your original resolution with 150% and there's no limit what scaling value you want. It works flawlessly on eOS without any screen tearing or something (maybe there's some little performance drop but I didn't notice anything bad). I think that's the same technique which is used on macOS, not sure.
One note: It doesn't work on between kernel 5.0 and 5.4, due to bug on the kernel, which is reverted on 5.5.
FYI @cassidyjames

@sixpounder
Copy link

sixpounder commented May 9, 2020

@PlatonB someone will need to see what Ubuntu is doing there and see if it's worth implementing. From what I've seen and heard, it introduces pretty bad screen tearing and performance issues, so I would be reluctant to add it.

I am currently trying this, out of curiosity, on Ubuntu 20.04 and indeed performance are pretty bad.

On pop os 20.04, though, enabling fractional scaling via gsettings command line, at least on my setup, works without any problems. Very smooth and not eating up more resources than normal. Running a dual monitor with different resolutions and sizes on an Nvidia 1060, both OSes tested with live boot.

Screenshot from 2020-05-09 23-00-58

Screenshot from 2020-05-09 23-00-20

@cassidyjames maybe someone at System76 did something more / different in regard to the base ubuntu distro?

@validatedev
Copy link

@sixpounder Which command did you execute for fractional scaling? Are you on Xorg or Wayland?

@sixpounder
Copy link

@sixpounder Which command did you execute for fractional scaling? Are you on Xorg or Wayland?

pop 20.04 comes with xorg by default

The command is
gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"
to enable

gsettings reset org.gnome.mutter experimental-features

to disable

@validatedev
Copy link

@sixpounder Which command did you execute for fractional scaling? Are you on Xorg or Wayland?

pop 20.04 comes with xorg by default

The command is
gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']"
to enable

gsettings reset org.gnome.mutter experimental-features

to disable

It causes to me screen tearing with Intel UHD Graphics 620, I could diminish it with TearFree flag with the reduced performance.

@sixpounder
Copy link

It causes to me screen tearing with Intel UHD Graphics 620, I could diminish it with TearFree flag with the reduced performance.

I cannot repro this since I got no hardware with UHD 620, but I can garantee that at least on nvidia the experience is flawless. Having two different monitors at different resolution it is very handy to run them at different scaling.

@sixpounder

This comment has been minimized.

@gorghino

This comment has been minimized.

@memeplex
Copy link

memeplex commented Jan 14, 2021

What Ubuntu, Pop and Xfce (4.16) do is just the old trick of first up-scaling by an integer factor using the toolkit (GTK) and then down-scaling using xrandr (which by default implements the bicubic algorithm).

The process is called oversampling and AFAIK MacOS does something similar and GNOME/Wayland too. The reason for doing it this way is that many toolkits work in pixel units, so integer units, and it's not easy to change them to work with fractions. Other toolkits like Qt can natively handle fractional sizes so they don't need to oversample. Anyway, if your screen is hi-res enough the end result is quite good (far from the blurriness of mere up-scaling or changing your monitor to non-native resolutions -which depends on the algorithm your hardware implements-).

The downsides:

  • CPU/GPU overhead because of the initial upscaling (usually x2) and further interpolation. In GNOME/Wayland and Sway the interpolation is cheap: linear with fallback to nearest neighbour for integer scales. But I guess xrandr bicubic is not that cheap and I dunno how much of the GPU the implementation is able to use.
  • This is not a problem of the approach per se, but xrandr scaling has problems with NVIDIA drivers and, more importantly given how pervasive cheap Intel iGPUs are, with Intel modesetting drivers: tearing, mouse pointer flickering.

OTOH my experience with amdgpu and xrandr has been great, but YMMV.

It would have been nice that someone fixed those bugs so that we had a reasonable transition path to Wayland in a world where FHD has become the standard for average budget laptops. I would say that 1.5x is more important nowadays than 1x or 2x, specially if you're buying new hardware, even expensive UHD external monitors are around 1.5x. But don't hold your breath because that probably won't ever happen.

Elementary or any other desktop could just implement a simple frontend hiding these xrandr tricks (https://wiki.archlinux.org/index.php/HiDPI#Xorg) but expect many bug reports because of the aforementioned issues. Or you could wait for Wayland to be a working thing, with Chromium, Electron, screen sharing and all, hoping not to lose many users along the way.

@memeplex
Copy link

memeplex commented Jan 14, 2021

I can garantee that at least on nvidia the experience is flawless

It might work for you with your specific hardware, kernel and drivers, but don't jump to conclusions because there are reported issues that makes NVIDIA the less advisable card for this:

Try not to guarantee anything about these matters, you might cause someone spend a lot of money on useless hardware. Linux is essentially broken wrt to multi-monitor, multi-dpi, fractional scaling support until Wayland matures, it's not a good place to be, you're lucky if you were able to find a comfortable setup meanwhile.

@validatedev
Copy link

I have so much crisp output when pass the higher resolution than my monitor with xorg.conf. No tear whatsoever.

@gamunu
Copy link

gamunu commented Nov 30, 2021

I'm linking the work done by the Ubuntu team to mutter for reference.

Mutter:
https://salsa.debian.org/gnome-team/mutter/-/blob/ubuntu/master/debian/patches/x11-Add-support-for-fractional-scaling-using-Randr.patch

Gnome control centre:
https://salsa.debian.org/gnome-team/gnome-control-center/-/raw/ubuntu/master/debian/patches/ubuntu/display-Support-UI-scaled-logical-monitor-mode.patch

Fractional scaling bug description:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1820850

The only issue I have faced with this implementation is the following bug. I have tested the patches on Fedora and Arch with the latest builds.
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1890141

@VitalyEmelyanov
Copy link

For me personally, this is the only problem of the current elementary version. I had to switch to other OS. The font size change is not a replacement for this. I'm looking forward for the proper fractional scaling at elementary.

@CYBERBUGJR
Copy link

@VitalyEmelyanov if you want to do a fractional scale i suggest you use this project, which is a bash script that do fractional scaling, you just need to execute it on log in. It's not ideal but it works for me.

@VitalyEmelyanov
Copy link

@VitalyEmelyanov if you want to do a fractional scale i suggest you use this project, which is a bash script that do fractional scaling, you just need to execute it on log in. It's not ideal but it works for me.

Thanks, this can be used as a temporary workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Blocked Something else needs to be done before this can be fixed
Projects
None yet
Development

No branches or pull requests