Bug 449681

Summary: Scaling on wayland results in glitches everywhere
Product: [Plasma] kwin Reporter: ryu.ketsueki
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: nate, pereira.alex
Priority: NOR Keywords: regression
Version First Reported In: 5.23.90   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.24
Sentry Crash Report:
Attachments: Screenshot demonstrating the problem

Description ryu.ketsueki 2022-02-06 04:29:36 UTC
Created attachment 146332 [details]
Screenshot demonstrating the problem

SUMMARY
I use a laptop which max resolution is 1366x768. The elements look too big on screen for both X11 and Wayland sessions but the Wayland session allows for a scaling feature, which neatly reduces the size of everything on screen while still retaining pixel sharpness unlike some X11 workarounds. Thing is, prior to 5.23.90, this scaling was pretty much perfect. After this update, the scaling does not work on certain elements, such as window decorations. They keep the exact same size after reducing or increasing the scaling, resulting in visual glitches in the process as well. Other elements, such as plasmashell, show visual glitches on the icons. I don't know how far this scaling problem goes but it seems to be a regression from 5.23.5

STEPS TO REPRODUCE
1. On Wayland session, turn the scaling to 75% or lower, or 125% or higher

OBSERVED RESULT
Screenshot attached to show result

EXPECTED RESULT
All elements on screen to be scaled properly instead of stay the same size as before and generate visual glitches.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20220204
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Kernel Version: 5.16.4-1-default (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i3-7020U CPU @ 2.30GHz
Memory: 11.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620

ADDITIONAL INFORMATION
I am still waiting on the fix of the crashing Breeze bug I submitted last year. Wasn't expecting it to not be treated for so long
Comment 1 Bug Janitor Service 2022-02-07 10:41:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/1978
Comment 2 Vlad Zahorodnii 2022-02-07 11:48:47 UTC
Git commit bb935aa5de87ffdac45cacb226de8ed7d4e635c1 by Vlad Zahorodnii.
Committed on 07/02/2022 at 11:45.
Pushed by vladz into branch 'master'.

Fix decoration rendering with scale factor < 1

QPainter won't let paint with a device pixel ratio less than 1. There
are used to be workarounds to force a device pixel ratio of 1, but they
were removed with fractional scaling corner fix.

This change makes sure that the decoration renderer forces a device
pixel ratio of 1 if the output's scale factor is less than 1 so
calculated texture coordinates match where window borders are rendered
in the texture atlas.

M  +8    -2    src/decorationitem.cpp
M  +1    -0    src/decorationitem.h
M  +16   -14   src/scenes/opengl/scene_opengl.cpp
M  +1    -1    src/scenes/opengl/scene_opengl.h
M  +2    -2    src/scenes/qpainter/scene_qpainter.cpp
M  +0    -5    src/utils/common.cpp
M  +0    -9    src/utils/common.h

https://invent.kde.org/plasma/kwin/commit/bb935aa5de87ffdac45cacb226de8ed7d4e635c1
Comment 3 Vlad Zahorodnii 2022-02-07 11:50:20 UTC
Git commit 9e9bb6c6deaf76834340b9359d0e19fc7ccee8cd by Vlad Zahorodnii.
Committed on 07/02/2022 at 11:50.
Pushed by vladz into branch 'Plasma/5.24'.

Fix decoration rendering with scale factor < 1

QPainter won't let paint with a device pixel ratio less than 1. There
are used to be workarounds to force a device pixel ratio of 1, but they
were removed with fractional scaling corner fix.

This change makes sure that the decoration renderer forces a device
pixel ratio of 1 if the output's scale factor is less than 1 so
calculated texture coordinates match where window borders are rendered
in the texture atlas.


(cherry picked from commit bb935aa5de87ffdac45cacb226de8ed7d4e635c1)

M  +8    -2    src/decorationitem.cpp
M  +1    -0    src/decorationitem.h
M  +16   -14   src/scenes/opengl/scene_opengl.cpp
M  +1    -1    src/scenes/opengl/scene_opengl.h
M  +2    -2    src/scenes/qpainter/scene_qpainter.cpp
M  +0    -5    src/utils/common.cpp
M  +0    -9    src/utils/common.h

https://invent.kde.org/plasma/kwin/commit/9e9bb6c6deaf76834340b9359d0e19fc7ccee8cd
Comment 4 Alexandre Pereira 2022-02-07 12:14:04 UTC
*** Bug 432766 has been marked as a duplicate of this bug. ***
Comment 5 Alexandre Pereira 2022-02-07 12:15:28 UTC
I marked https://bugs.kde.org/show_bug.cgi?id=432766 as duplicate of this, I think its the same issue!
Comment 6 Vlad Zahorodnii 2022-02-07 12:16:52 UTC
That's a 5.24 regression
Comment 7 Alexandre Pereira 2022-02-07 13:50:28 UTC
(In reply to Vlad Zahorodnii from comment #6)
> That's a 5.24 regression

hum... yeah, sorry, reading the summary carefully ... i will see if I can "un duplicate" it :)

but most importantly, this bug fix commit actually fixed the breeze kwin decorations on wayland being properly round on a 75% scaling screen. (it was not working in 5.23, I just tested)