https://bugs.kde.org/show_bug.cgi?id=476102

            Bug ID: 476102
           Summary: [Wayland] Downscaled X11 Windows Look Blocky/Blurry
    Classification: Plasma
           Product: kwin
           Version: 5.27.8
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: multi-screen
          Assignee: kwin-bugs-n...@kde.org
          Reporter: eamonn...@protonmail.com
  Target Milestone: ---

SUMMARY
On KDE Plasma Wayland, with one fractionally scaled display and any number of
displays without any scaling, the text in downscaled(?) X11 applications look
blocky when using the "Apply scaling themselves" option under Legacy (X11)
Application settings once they are moved from the scaled display to a display
which is not scaled. Images look more on the blurry side. The larger the font
in the application, the more it moves from the "blocky" to the "blurry" end of
the spectrum. The content of X11 windows with this option does not look as
smooth as one would expect.

The thinner the font as well, the more apparent this effect becomes. Here is an
example of the effect on some text on the Steam:
- Games in library: https://i.postimg.cc/0j0YWsQm/image.png
- Some general library text: https://i.postimg.cc/xTgGLnBV/image.png
- Image content on the Store Page looks noticeably blurrier in the client (X11)
than it does on Firefox on the same display.
  - Steam Client: https://i.postimg.cc/sXF53XG7/image.png
  - Firefox: https://i.postimg.cc/zDFT1qzH/image.png

The issue is not exclusive to Steam, here are other examples:
- ProtonUp-Qt Flatpak, running with QT_QPA_PLATFORM=xcb to enforce X11:
https://i.postimg.cc/90L4wF0x/image.png
  - Here's how it looks under Wayland on the same display:
https://postimg.cc/xqH2DtwK/487bfd88
- Cookie Clicker, an Electron game running under Proton (Wine X11) with the
"--force-device-scale-factor=1.5" launch option:
https://i.postimg.cc/6qkk0C8T/image.png
  - Using the Wine integer scaling option does not really alleviate the issue
either

This applies to all X11 applications:
- X11 applications that can apply scaling themselves, such as modern Qt/GTK
applications, including some Electron applications such as the Heroic Games
Launcher.
- X11 applications that cannot apply scaling themselves but which can have a
scale factor set, such as the Steam Client (STEAM_FORCE_DESKTOPUI_SCALING=1.5)
or older Electron applications including games (both native and running under
Wine) such as Cookie Clicker or Melvor Idle (--force-device-scale-factor=1.5).
Wine applications with a DPI scale factor set also exhibit similar behaviour,
to varying degrees depending on how high you set the scale factor (it's not as
easy to get right as it is for the other two, since you can't provide a decimal
value)
- X11 applications unscaled, which look noticeably blockier and not just
smaller when not on the scaled display.

I understand that when running with this "Apply scaling themselves" option that
a single XWayland server is used, which is why applications are downscaled in
the first place. I did test this quickly with a non-fractional scale factor and
applications looked better, but still not perfect.

In spite of this, I'm wondering if perhaps this is related to KWin in Plasma 5
not using the pretty new Wayland fractional scaling protocol? Since to my
understanding for the scaled display, KWin is downscaling from the nearest
integer value in order to achieve fractional scaling, as for a long time there
was no protocol for fraction scaling on Wayland. Since when moving from the
scaled display over to another display we're essentially downscaling *again*,
maybe this effect is a side-effect of that? It still happens with integer
scaling values I think though, but I only tested briefly.

If this is true, then could this potentially be fixed when Plasma implements
the Wayland fractional scaling protocol in KWin in Plasma 6? I have read on
other bug reports that implementing this protocol is planned for Plasma 6, but
I'm not sure if it's still on the roadmap or if I perhaps misunderstood.

I also understand that this cannot be backported so I am not jabbing anyone who
has worked tirelessly on making Plasma Wayland as rock-solid as it is (a visual
oddity is very minor in the grand scheme and shows how far Wayland has come!).

Of course, the *real* solution here is for applications to port to Wayland. If
the Steam Client ports to Wayland, if Electron Wayland support continues at the
brisk pace it's going at, and once Wine (and derivatives like Proton) lands
Wayland support with support for fractional scaling, this issue will disappear
for a huge amount of use-cases. Since many Qt and GTK apps all support Wayland
already, the main way I am impacted by this is with games and Wine applications
(particularly tools like ModOrganizer 2).

STEPS TO REPRODUCE
1.  Use two displays, one with fractional scaling and one without (though it
may be reproduceable without a fractional scale value, the scaled+no scale
display is the main factor here)
2. Set the Legacy (X11) application setting in Display Settings to "Apply
scaling themselves"
3. Launch an X11 application which can apply scaling itself, such as:
  - The Steam Client, with the STEAM_FORCE_DESKTOPUI_SCALING value set to the
decimal equivalent of your scale factor, ex: 1.5 for 150% scaling, is an
accessible example.

OBSERVED RESULT
On Wayland with at least one display with scaling, X11 applications is
blurry/blocky on displays without scaling. This is always present but is more
noticeable when scaled up.


EXPECTED RESULT
The rendering content of X11 applications should match that of Wayland
applications on displays without scaling, and/or the way they look when the
"Scaled by the system" option is used in Display settings.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux Zen Kernel 5.6.7 64bit
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION
- Similar behaviour happens with some parts of KDE, such as notification text
very occasionally being blocky until highlighted, and the same issue with text
on some settings menu options (though this problem has gradually lessened with
updates!)
  - A similar issue is also present on text in the Overview effect, on displays
with no scaling, text always appears pixelated.
- Even though I have a suspicion this is a technical limitation with no real
immediate solution, I have provided so much background and context not just in
the hope of helping get an answer, but in the interest of documenting what
behaviour I'm seeing so if others stumble upon this ticket, they can see if
they're having the exact same problem and then see what the answer is. I didn't
see another issue reporting this problem, so I am hoping if this cannot be
resolved, this ticket could help document the problem a little better.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to