News for hackers. Stuff that matters.
Re:Guix on the Framework 13 AMD by jckahn on Friday February 16, 2024 @07:15AM (#39395909)
My kingdom for Wayland fractional scaling that doesn’t make my apps blurry. It makes the feature a complete nonstarter for me.
Re:Guix on the Framework 13 AMD by jacek on Friday February 16, 2024 @08:16AM (#39396553)
I use KDE Plasma 5.27 (6 with many improvements is around the corner) on Wayland and fractional scaling is handled very well, nothing is blurry, no hacks required. If KDE recognizes an app that is not Wayland compatible (like most Electron apps), it will just run it in X11 mode (there's a setting for that, enabled by default).

See the screenshot of my settings: https://imgur.com/a/VQHD5vT

Re:Guix on the Framework 13 AMD by jckahn on Sunday February 18, 2024 @02:19PM (#39422142)
I’ve heard that the situation is better on KDE, but for better or worse I’m a GNOME user. I probably should have specified that!
Re:Guix on the Framework 13 AMD by hollerith on Sunday February 18, 2024 @02:31PM (#39422270)
I'm using Wayland and Gnome set to a fractional scaling factor to write this, and none of the apps I use regularly are blurry although I have to pass command-line arguments to Chrome and had to compile Emacs from source code to achieve that.

In fact, none of them were blurry 3 years ago.

Re:Guix on the Framework 13 AMD by binkHN on Friday February 16, 2024 @08:04AM (#39396412)
I think KDE6, which is just around the corner, is going to be your best bet. That said, some older programs still require xwayland and you will not get too far with these.
Re:Guix on the Framework 13 AMD by enriquto on Friday February 16, 2024 @07:24AM (#39396001)
Fractional scaling, by definition, will make stuff blurry. Clean bitmap graphics and fractional scaling are incompatible requirements.

Proof: consider a pattern of alternating black and white pixels: 0, 255, 0, 255, 0, 255, etc. This pattern cannot be scaled to a non-integer factor without introducing gray colors (i.e., by blurring-out the pattern). If your app produces this pattern, then fractional scaling will blur your app.

Re:Guix on the Framework 13 AMD by mahkoh on Friday February 16, 2024 @07:43AM (#39396185)
That is not the case on wayland. Wayland applications with support for the fractional scaling protocol can render without any blur at any fractional scale.

This is because the protocol negotiates the size of the underlying buffer. If the client and the compositor agree on the scale, then no scaling of the buffer will happen in the compositor because the client has attached a buffer that is the exact pixel size size of the window on the physical display.

It is up to the client how it implements the case you described. E.g. it could alternate between 1 black and 1 white pixel in the physical buffer or it could sometimes make two adjacent pixels the same color.

Source: I was involved in the design of this protocol and we had example clients that used this exact pattern. Chromium also supports this protocol without any blur.

Re:Guix on the Framework 13 AMD by llm_trw on Friday February 16, 2024 @08:09AM (#39396469)
> E.g. it could alternate between 1 black and 1 white pixel in the physical buffer or it could sometimes make two adjacent pixels the same color.

This is a very odd definition of "no blur".

Re:Guix on the Framework 13 AMD by mahkoh on Friday February 16, 2024 @08:23AM (#39396651)
It works in chromium without anything I'd call blur. Here it is at 175% scale: https://i.ibb.co/DtKm69d/image.png
Re:Guix on the Framework 13 AMD by enriquto on Friday February 16, 2024 @08:27AM (#39396698)
Does the scaling change the kerning of the letters? This looks horrific! (and, yes, blurry, or "antialiased" as is custom to name it).
Re:Guix on the Framework 13 AMD by M911T on Friday February 16, 2024 @12:36PM (#39400238)
yeah the kerning is bad when using that thing. It's bad on my laptop too.
Re:Guix on the Framework 13 AMD by mahkoh on Friday February 16, 2024 @08:32AM (#39396759)
No, that's just the font I'm using. It's the same if I keep the scale at 1 and then zoom in the browser.
Re:Guix on the Framework 13 AMD by llm_trw on Friday February 16, 2024 @07:55PM (#39405131)
Have you considered using a good font?

Having people with no understanding of, or worse no interest in, beautiful UIs making decisions for the display server is a worry.

Re:Guix on the Framework 13 AMD by darkwater on Friday February 16, 2024 @08:52AM (#39396993)
It doesn't look horrific at all to me
Re:Guix on the Framework 13 AMD by CyberDildonics on Friday February 16, 2024 @09:07AM (#39397166)
This looks fantastic to me. Also antialiasing is not the same as 'blurry', it is factional values in pixels that have fractional coverage.
Re:Guix on the Framework 13 AMD by Phrodo_00 on Friday February 16, 2024 @02:59PM (#39402174)
> factional values in pixels that have fractional coverage.

This is also the definition of blurriness.

I think the screenshot looks fine (other than the weird kerning), but I can see how one person's antialiasing could be other people's blurriness

Re:Guix on the Framework 13 AMD by CyberDildonics on Friday February 16, 2024 @05:14PM (#39403672)
This is also the definition of blurriness.

This is not true in any sense, but it is what some people think when they don't know much about the underlying principles and just see fractional pixels.

A blur would be lowering the frequency of an input signal, anti-aliasing is representing that signal more accurately when quantizing it into discreet values.

Do some animated aliased 3D renders then try to blur it to get the same result as an anti-aliased version.

Look at a checkerboard pattern as it goes into the distance. The pattern eventually converges into grey if it is antialiased because the integral of everything under the pixel is grey as the squares end up smaller than a pixel. Blurring the entire frame gives a much different result.

Re:Guix on the Framework 13 AMD by DiabloD3 on Friday February 16, 2024 @08:51AM (#39396968)
Chrome natively scales; however, any bitmap image shown it will be blurry.
Re:Guix on the Framework 13 AMD by llm_trw on Friday February 16, 2024 @08:35AM (#39396782)
And people wonder why you'll take X from my cold dead hands.
Re:Guix on the Framework 13 AMD by dpkirchner on Friday February 16, 2024 @02:57PM (#39402159)
IMO, it looks like exactly what you'd see if you took pixel perfect rendered text and applied a small-radius Gaussian blur to it. It might look different on your screen, however (monitor settings can affect rendering quite a lot).
Re:Guix on the Framework 13 AMD by jackdaniel on Friday February 16, 2024 @07:33AM (#39396091)
Not everything is a bitmap. Ordinary drawing operations operate on coordinates, so fractional scaling should not lead to any blur (although may miss some pixel-perfect designs).

In other words vectors may be scaled with little precision loss, or they may be scaled naively (render to bitmap and then scale the bitmap).

Re:Guix on the Framework 13 AMD by seabrookmx on Friday February 16, 2024 @08:34PM (#39405428)
This. People seem to forget that you can zoom to 125% in your browser without blur, since the UI elements on the web are vector-based.
Re:Guix on the Framework 13 AMD by enriquto on Sunday February 18, 2024 @02:24PM (#39422189)
There's nothing special about the browser. Bitmap images are blurred by fractional scaling. That is inevitable.
Re:Guix on the Framework 13 AMD by seabrookmx on Monday February 19, 2024 @01:51PM (#39433265)
Yes but the fonts, boxes and lines are all fine. And on the web the image issue is usually resolved by starting hi res to begin with and sampling down not up.

When people complain about desktop apps not scaling they aren't complaining about the odd icon, it's the whole app looking like a smeary mess because it's not using vector based graphics. Fronts, grid lines etc. become blurry.

Re:Guix on the Framework 13 AMD by pxc on Saturday February 17, 2024 @12:27AM (#39406696)
Is this how DPI scaling in X11 works?

Also, don't you get the same effect (readable large fonts but alignment changes a bit) when you increase the size of your UI fonts, even without changing overall UI scaling?

Why are people (apparently) so attached to pixel alignments for OS-native GUIs?

Re:Guix on the Framework 13 AMD by throwaway11205 on Friday February 16, 2024 @07:30AM (#39396068)
Fractional scaling works perfectly well on Xorg Linux and Windows, but looks blurry on Wayland Linux. Maybe it's not micrometer-scale crisp, but I can't see that. Text on Wayland is very visibly blurred.

And it's not just text, but UI controls too. It looks like Wayland just renders the lower integer scale factor and then stretches the resulting bitmap image. That's bullshit.

Re:Guix on the Framework 13 AMD by jsheard on Friday February 16, 2024 @07:38AM (#39396145)
Doesn't macOS do it the other way, rendering at the next highest integer scale factor and then downscaling to fit the display?

If you can't render fractional factors natively for tech debt reasons then that's the least bad way to do it.

Re:Guix on the Framework 13 AMD by throwaway11205 on Friday February 16, 2024 @07:41AM (#39396162)
MacOS way is better, text is blurry, but much less. I still don't like it though, but can use it in an emergency.

But there apparently is another way that Xorg and Windows uses. I have perfectly crisp (as far as my eyes can tell) UI and text on both systems at 150% scale (27" 4K display).

> for tech debt reasons

I thought Wayland was supposed to fix the tech debt - so now it introduced some that makes bare basic features impossible?

Re:Guix on the Framework 13 AMD by DiabloD3 on Friday February 16, 2024 @09:04AM (#39397137)
It does for any app that can't scale; all modern OSX apps can scale natively. I've been using that trick for integer-like scaling for years to deal with fractional scaling while preserving the quasi-aliasing ("crispness") of the source image.

However, Wayland does not prescribe any method for non-integer scaling. Any Wayland WM could choose to do the same thing, and it would be hardware accelerated essentially for free.

Both X11 and Wayland WMs typically don't use this trick, and neither does Windows.

Re:Guix on the Framework 13 AMD by jorvi on Friday February 16, 2024 @08:01AM (#39396374)
It is exactly (some) Xorg apps that render blurry on Wayland. You are blaming the wrong party for “bullshit”. Xorg scaling sucks, whereas Wayland’s is great.
Re:Guix on the Framework 13 AMD by darthrupert on Friday February 16, 2024 @09:11AM (#39397218)
I have the exact opposite experience: fonts are crisp on Wayland and blurry crap on xorg.
Re:Guix on the Framework 13 AMD by DiabloD3 on Friday February 16, 2024 @09:01AM (#39397106)
I don't know why this guy is being downvoted, he is correct.

You cannot scale things to non-integer amounts without incurring some damage.

Blurry/fuzzyness, ringing, screen door effect, etc, you cannot avoid these no matter how smart your scaling algorithm is as long as you're upscaling it to something inbetween 100% and 200%. Nyquist-Shannon is a bitch.

Wayland made a decision way back that non-scaling apps can only be integer scaled to avoid this defect. This was the correct decision, objectively. Unfortunately, people still choose to own monitors that have weird resolutions that do not approximate 96dpi after integer scaling.

Thankfully, 200% dpi screens (ex: 3840x2160 in 24", where 24" are normally 1080p) are starting to become the norm, so someday this problem will go away: you will always be scaling at least 200%, making non-integer scaling artifacts a lot less visible.

Also, I think the parent comment that enriquto replied to might be confused and is merely asking for nearest neighbor scaling. This is not part of Wayland (which is just a protocol), and is managed entirely by the WM being used. Given Wayland is trying to enforce integer scaling, WMs allowing choosing nearest neighbor when integer scaling would be preferable in many cases.

Re:Guix on the Framework 13 AMD by jwells89 on Friday February 16, 2024 @09:40AM (#39397633)
> Unfortunately, people still choose to own monitors that have weird resolutions that do not approximate 96dpi after integer scaling.

It’s not always a choice unfortunately. I buy displays that are capable of a clean 1x or 2x when I can, but there’s a ton of laptops that still need fractional scaling.

Take my Thinkpad X1 Nano. Great laptop in a lot of ways, including the screen (~500 nits brightness, excellent backlight consistency, color, and contrast, no glare) except that it runs at a resolution that requires 1.5x scaling to be usable.

Looking at replacement candidate laptops, the only ones that have 2x screens that aren’t a downgrade somehow destroy battery life (e.g. 3000x2000 OLED panel in Dragonfly Elite G4, which docks 3-4h of battery). 1x screens in this category for some reason are all kinda crappy with e.g. dim 350 nit backlights that start to struggle in a moderately naturally well-lit room, which is just goofy in a portable machine that’s likely to get usage in a bright environment.

This is one thing that MacBooks objectively do consistently better.

Re:Guix on the Framework 13 AMD by goosedragons on Friday February 16, 2024 @02:46PM (#39402022)
It's not really as necessary on PCs because of how Windows does scaling. It's only a problem in programs that just straight up don't support it. And Apple has routinely and still does ship laptops with non-integer scaled resolutions as default (e.g., the 12" MacBook, the 13" Macbook Air).
Re:Guix on the Framework 13 AMD by phkahler on Friday February 16, 2024 @09:08AM (#39397177)
>> My kingdom for Wayland fractional scaling that doesn’t make my apps blurry.

I'm convinced I don't understand this thing. I feel like it's NOT the compositors job to scale the pixels of an application. That might be a good hack for super high resolution screens with applications that don't know how to handle high DPI but it's an inferior solution. Scaling text at the pixel level is going to be inferior to rendering it at higher resolution to start with.

So how does it work? Do we have per-monitor setting for scale factor, and both the DE and the apps need to follow it for idea behavior? And the compositor scaling the apps is a stopgap? Is that it, or is there more to this?

Re:Guix on the Framework 13 AMD by alwayslikethis on Friday February 16, 2024 @10:12AM (#39398068)
Let me type down what I learned through many hours of research.

Under a Wayland compositor, there are basically three types of apps.

1. XWayland apps which cannot use Wayland's scaling protocols, but may be able to use Xft.dpi to scale themselves. Examples include Electron apps when not running on Wayland and later versions of Qt5. These will work without blurriness but they cannot support proper multi-dpi support. The Wayland compositor has no way of detecting whether it actually scales. Some compositors (KDE, Hyprland) let you not scale them, but others (GNOME) will make them super blurry because they are rendered at 96 DPI and stretched to the needed scale. GTK3 notably never supported fractional scaling on X11.

2. Wayland apps which supports integer scaling only. Examples include GTK3, GTK4, Qt5 apps, Mozilla Firefox (minus the experimental fractional scaling feature, which is very buggy). When compositor wants to render at a fractional resolution, the app will render at the nearest integer scale, and the compositor will downsample it. These don't look ideal, but aren't super blurry either, and will work properly with multi-dpi monitors.

3. Wayland apps which properly support fractional scaling via wp-fractional-scale-v1. This is a recent addition to the protocol, so not widely supported yet. The only toolkit that supports it is Qt6, but Chromium (incl. recent Electron apps in Wayland mode) also supports it. Some terminal emulators do too. This results in pixel perfect rendering and looks ideal and works properly with multi-dpi monitors.

Downsampling works well on Macs which have high resolution screens such that you mostly use at least 175% scaling. At lower scales such as 125% (e.g. 1080p 13-14 inch laptops) and 150% (e.g. 1440p 14-16 inch devices), the degradation is fairly obvious if you use smaller fonts. This also breaks subpixel rendering (Macs haven't had it for a long time), which is important for making fonts look good on lower DPI screens. In some ways, Wayland scaling is a regression for KDE because Qt5 had proper fractional scaling for some time under X11, which was not implemented in Wayland as the protocol came out after Qt5 lost support.

Re:Guix on the Framework 13 AMD by marwis on Friday February 16, 2024 @05:18PM (#39403709)
> 1. XWayland apps (...) The Wayland compositor has no way of detecting whether it actually scales

Can't X apps just set a window property (XChangeProperty) with their scale factor and have compositor read that?

Re:Guix on the Framework 13 AMD by p_l on Saturday February 17, 2024 @04:09AM (#39407779)
The toolkits would need to add that, and some of them had engineering direction incompatible with such an idea.
Re:Guix on the Framework 13 AMD by marwis on Saturday February 17, 2024 @01:06PM (#39411766)
I don't see how any toolkit design could be incompatible with this and not sure how color spaces play into that?

Every X11 app is already composited and scaled by compositor and has top-level X window where it could set any property it wishes.

Re:Guix on the Framework 13 AMD by p_l on Saturday February 17, 2024 @05:07PM (#39413992)
Not design. Engineering direction. People problem, instead of computer problem, to be quite honest. And one of those directions was that there was no other output than blitting RGBA8888 to screen (which was at one point the only format expected to be seen with Wayland, and GTK3 already was driving towards Wayland) - potentially accelerated with OpenGL (which had hilarious results on some chips where GL pipeline was 16bit only while 2D was 24bit).

Also, unless you're running Xsgi, it's not a given that every app is scaled by compositor.

Honestly, the right way was always to not assume any given DPI, and instead have every top-level window be DPI-aware and have the toolkit update that information dynamically.[1] Or optionally go all-in on vector dpi-independent approach.

[1] The only correct way to handle hi-dpi on Win32 GDI, where scaling is broken partly by old GDI assumption that DPI didn't change, and by applications that hardcoded 96 dpi

Re:Guix on the Framework 13 AMD by mappu on Friday February 16, 2024 @06:13PM (#39404293)
There must be more categories than this because Qt 5 on Wayland can do fractional scaling since some years, you may need to set QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough.
Re:Guix on the Framework 13 AMD by alwayslikethis on Saturday February 17, 2024 @04:04AM (#39407749)
Since some years? I don't think so. wp-fractional-scale-v1 was merged only like 1 year ago. The only more recent version of Qt5 is 5.15 and on the release notes I don't see any Wayland changes.. Any reference you have for that?
Re:Guix on the Framework 13 AMD by kevincox on Friday February 16, 2024 @10:24AM (#39398253)
Apps that natively support fractional scaling will not be scaled by the compositor. (Well unless they span multiple monitors with different scales IIUC.) Scaling is just a fallback for apps that don't support fractional scaling or edge cases like you drag a non-responding app onto a monitor with a different scale.

Yes, you can have a per-monitor scale factor and apps should render at the right scale based on where they are positioned.

Re:Guix on the Framework 13 AMD by pxc on Friday February 16, 2024 @03:09PM (#39402306)
If you've got a whole kingdom on offer, you can bite the bullet and buy monitors that all have the same DPI. It's painful, but it's what I've done.
Re:Guix on the Framework 13 AMD by jckahn on Sunday February 18, 2024 @02:28PM (#39422226)
Not for my Framework 13 laptop. There’s only one screen resolution option. Even when I don’t have it plugged into my 4K external monitor, Wayland’s fractional scaling looks atrocious on Ubuntu 22.04.
Re:Guix on the Framework 13 AMD by k8svet on Friday February 16, 2024 @03:48PM (#39402754)
I've never ever noticed blurriness from downscaled integer up-scaled Wayland apps.

Blurriness is almost always due to use of xwayland.

These are completely unrelated technically.