Bug 465433 - Fractional scale under wayland still not perfect sharp
Summary: Fractional scale under wayland still not perfect sharp
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 5.26.90
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-07 17:23 UTC by zvova7890
Modified: 2023-09-07 21:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
X11 session with 150% scale (1.85 MB, image/png)
2023-02-07 17:23 UTC, zvova7890
Details
wayland session 150% scale (2.04 MB, image/png)
2023-02-07 17:24 UTC, zvova7890
Details
sharpness compare (718.77 KB, image/png)
2023-03-19 12:41 UTC, zvova7890
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zvova7890 2023-02-07 17:23:59 UTC
Created attachment 156034 [details]
X11 session with 150% scale

SUMMARY
Under wayland session with fractional scale(150%) output still a little blurry. It is visible on all screen, even on the background of plasma desktop.
See attached screenshots. Compare font's, background, etc. sharpness.

Also, screenshot under wayland on 1px bigger than the real resolution of monitor.

I checked this on today build of the unstable neon iso - same as in 5.26.5.
Comment 1 zvova7890 2023-02-07 17:24:31 UTC
Created attachment 156035 [details]
wayland session 150% scale
Comment 2 David Edmundson 2023-02-07 17:26:37 UTC
Unfortunately this is expected at the current point. Fractional scaling for wayland clients arrives in Qt 6
Comment 3 zvova7890 2023-02-07 17:34:57 UTC
Is there no chance backport to 5.15? I mean, it's too difficult or Qt5 will be dropped and no reason to waste a time?
I'm afraid transit period to Qt6 will take a long time, and application that stuck on Qt5 will looks ugly on wayland.
It will be another reason why not move to wayland.
Comment 4 zvova7890 2023-03-19 11:30:21 UTC
(In reply to David Edmundson from comment #2)
> Unfortunately this is expected at the current point. Fractional scaling for
> wayland clients arrives in Qt 6

I afraid it is not. I have ported your patches for fractional scale on qt5-wayland - there is still problems with sharpness. Also, I tried qt 6.5 beta3 - same behavior. I'm realized that fractional scale on qt-wayland is affected only for QWindow::scale(or devicePixelRatio), but QScreen::scale(or devicePixelRatio) stays on fixed point scale that reports by wl_output. Seems Qt has confused about this and rendering still incorrect. 
I have experimented with QScreen to return same *fractional* scale(not rounded fixed point scale) as QWindow gets from FractionalScale protocol(in my case it is 1.5f) - only after that I got sharp picture. 

If you already know that - okay, but if you don't - please take a look... Leaving this as is will make us to see plasma 6 with still incorrect fractional scale on wayland
Comment 5 zvova7890 2023-03-19 12:41:10 UTC
Created attachment 157416 [details]
sharpness compare

left - as it works now, qwaylandwindow with fractional protocol returns 1.5f scale, qwaylandscreen untouched and return 2 scale.
middle - fractional protocol, qwaylandwindow returns 1.5f, qwaylandscreen patched and return also 1.5f
right - xwayland window as reference
Comment 6 David Edmundson 2023-07-05 09:14:22 UTC
Just to confirm the middle one we're saying is fine?

>If you already know that - okay. Seems Qt has confused about this and rendering still incorrect

There's a bunch of changes that are relevant that I did in QtBase that I doubt you would have backported. The screen will still be wrong, but we'll be relying on the screen information less. These will be in Qt 6.6.

Things look sharp to me running 6.6, though I will admit I don't have the best eye for these details.
Comment 7 David Edmundson 2023-07-05 09:15:36 UTC
Relevant Qtbase change: https://codereview.qt-project.org/c/qt/qtbase/+/447074

but there's a bunch of follow ups in QtWayland and  QtDeclarative to use it, so it's not a trivial backport
Comment 8 zvova7890 2023-07-05 23:46:22 UTC
>> Just to confirm the middle one we're saying is fine?
Yes, right. It is better to download the image and view it in gwenview, for example. The left one is more "hairy", visible effect of scaling.

I tested Qt 6.5 on Arch Linux some time ago, and although I don't recall the exact details, I do remember that the rendering was fine. I believe I made adjustments to these environment variables during my testing:

#QT_AUTO_SCREEN_SCALE_FACTOR=1
#QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough

So, cross the fingers for the plasma 6 :)

Also, invalid qscreen scaling can broke some apps, that rely on it. For example, some apps can get scaling settings when the window has been not yet created and pass it to some part of code that can't dynamically change the scaling factor. I hope we would't see that apps, but who knows. As example I can provide some android emulators, based on containers, like anbox or waydroid. Anbox session starts android in background, passing scale factor to the container and doesn't have technical capabilities to change the scale when user open a window. If I understand correctly, we can't get current display fractional scale factor until we doesn't have a window with attached scale factor protocol. It is not only qt-related, it's true for all wayland apps. Do we currently have the capability or are there any existing plans to get a selected display scale factor with floating-point accuracy?
Comment 9 zvova7890 2023-09-07 21:28:57 UTC
I have installed KDE neon unstable + download updates and the fractional scale on NEON is worse than in the stable branch of KDE5. When using fractional scaling all windows is blurred including xwayland(kde5 has OK xwayland window). I don't think it is related to the Qt, as all scales is comes correctly, but maybe it's related to the kwin. Should I report it to the NEON branch?