elementary / switchboard-plug-display

Switchboard Displays Plug
https://elementary.io
GNU General Public License v3.0
14 stars 18 forks source link

Add fractional scaling support #117

Closed ma1onso closed 2 months ago

ma1onso commented 6 years ago

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!](https://www.bountysource.com/issues/63327128-add-fractional-scaling-support?utm_campaign=plugin&utm_content=tracker%2F60457221&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F60457221&utm_medium=issues&utm_source=github).
liamkinne commented 6 years ago

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

cassidyjames commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

sixpounder commented 4 years ago

@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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

Guess nobody is unblocking this issue anytime soon

gorghino commented 3 years ago

Got a 4K laptop and I'm interested in this feature :)

memeplex commented 3 years ago

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:

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 commented 3 years ago

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 commented 3 years ago

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

gamunu commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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

bigfatbird commented 2 months ago

Uh damn. That was unexpected ❤️

danirabbit commented 2 months ago

@bigfatbird it's still marked as experimental upstream afaik, but when it's ready we'll be ready too :)