Bug 464069 - Graphical Corruption Around Certain Widgets with fractional scale factor
Summary: Graphical Corruption Around Certain Widgets with fractional scale factor
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.101.0
Platform: Other Linux
: HI normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 475834 475887 477101 477102 477488 477807 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-09 21:53 UTC by Freddie Witherden
Modified: 2024-03-01 08:28 UTC (History)
15 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments
Example screenshot. (163.08 KB, image/png)
2023-01-09 21:53 UTC, Freddie Witherden
Details
Text rendering problems in systemsettings (82.34 KB, image/png)
2024-01-09 13:43 UTC, hexchain
Details
Issues in Info Center (1.53 MB, image/png)
2024-02-09 20:46 UTC, Michel Le Bihan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Freddie Witherden 2023-01-09 21:53:17 UTC
SUMMARY
When running system settings under X11 with 150% fractional scaling and the default Breeze scheme certain panes in system settings experience graphical corruption around widgets.  A good example of this can be seen in the attached screenshot with the "Users" component active.  Observe how the left bars of the input text boxes are not rendered correctly.  Similarly, the bottom part of "Administrator" is also not drawn correctly.  The "Change Password" is also drawn incorrectly (compare to "Add New User" which is perfect and in-line with the rest of the system).


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.8
Comment 1 Freddie Witherden 2023-01-09 21:53:32 UTC
Created attachment 155160 [details]
Example screenshot.
Comment 2 Nate Graham 2023-01-10 16:49:55 UTC
What scale factor and GPU are you using?
Comment 3 Freddie Witherden 2023-01-10 16:54:21 UTC
(In reply to Nate Graham from comment #2)
> What scale factor and GPU are you using?

Under "Display Configuration" the Global scale is at 150%.  My GPU is an Intel A770M with Mesa 22.3.2.  However, I have also observed this on a system with an AMD GPU.
Comment 4 Nate Graham 2023-01-10 20:59:27 UTC
Thanks, I thought so.
Comment 5 Nate Graham 2023-01-10 22:13:29 UTC
Looks like another issue like Bug 414266, which was fixed in Qt 5.15.3. Or maybe the same issue returned. :(
Comment 6 Nate Graham 2023-10-20 15:21:24 UTC
*** Bug 475834 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2023-10-23 22:09:14 UTC
*** Bug 475887 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2023-11-17 19:55:51 UTC
*** Bug 477101 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2023-11-17 21:05:57 UTC
*** Bug 477102 has been marked as a duplicate of this bug. ***
Comment 10 Nate Graham 2023-11-29 22:29:50 UTC
*** Bug 477488 has been marked as a duplicate of this bug. ***
Comment 11 Michel Le Bihan 2023-12-10 11:13:32 UTC
Hello,
Is there any chance that this issue will be fixed before the KDE 6 release?
Comment 12 Nate Graham 2023-12-12 23:04:49 UTC
*** Bug 477807 has been marked as a duplicate of this bug. ***
Comment 13 David Edmundson 2023-12-18 22:50:28 UTC
Is it https://codereview.qt-project.org/c/qt/qtdeclarative/+/519931 ?
Comment 14 hexchain 2023-12-19 03:02:24 UTC
I don't think so. This issue occurs without changing DPR.
Comment 15 Nate Graham 2023-12-20 20:09:02 UTC
Doesn't DPR change automatically with the scale factor, though?
Comment 16 Michel Le Bihan 2023-12-20 20:16:20 UTC
Info Center that seems to be one of the most affected apps doesn't seem to be using `QQuickTextEdit`.
Comment 17 hexchain 2023-12-21 05:40:43 UTC
(In reply to Nate Graham from comment #15)
> Doesn't DPR change automatically with the scale factor, though?

Yes, but IIUC this issue is about the graphical glitches that occur without runtime DPR changes, right?
Comment 18 David Edmundson 2024-01-05 16:25:23 UTC
It is a different bug. I managed to reproduce a minimal case.  It's exhibits when we're not aligned.

```
import QtQuick
import QtQuick.Controls

Rectangle {
    width: 300
    height: 300

    TextField {
        y: 0.333345345
        text: "hello world"
    }

}
```

At 1x or 2x it looks fine, at 1.5x for some reason it exhibits artifacts.  Not all fractions look bad, just some.
Comment 19 Bug Janitor Service 2024-01-09 10:11:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/354
Comment 20 Marco Martin 2024-01-09 13:24:26 UTC
Git commit 1d8731f0d746820bd65b4494246668e81b58063d by Marco Martin.
Committed on 09/01/2024 at 14:24.
Pushed by mart into branch 'master'.

make sure the node is always at an integer position

with fractional scaling sometimes nodes are positioned not only in non
integer logical pixels, but end up being positioned also at non integer
device pixels, making textures badly rendered

M  +6    -1    plugin/kquickstyleitem.cpp

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/1d8731f0d746820bd65b4494246668e81b58063d
Comment 21 hexchain 2024-01-09 13:43:56 UTC
Created attachment 164778 [details]
Text rendering problems in systemsettings

The change fixed all the artifacts around controls (thanks!), but some texts still show rendering problems.
Comment 22 Arjen Hiemstra 2024-01-13 16:00:37 UTC
Git commit 69eba3a87868c01e919f90cf5e4d4c5069f4ac64 by Arjen Hiemstra.
Committed on 12/01/2024 at 15:26.
Pushed by ahiemstra into branch 'master'.

styleitem: Base render node size on image

When using fractional scaling, we may end up with an image that is
slightly different in size from the bounds of our item, since the image
will always be in integer size but the item size can be fractional. This
causes it to be rendered at a slightly different size from the texture
size, which triggers interpolation and leads to glitches in the rendered
result.

To avoid all that, rather than using our item's bounds for the node
size, use the image size converted back to logical pixels as the node
size. This may actually end up with us using a fractional node size, but
ensures that when rendered we use the exact image dimensions.

M  +8    -5    plugin/kquickstyleitem.cpp

https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/69eba3a87868c01e919f90cf5e4d4c5069f4ac64
Comment 23 postix 2024-02-03 10:49:13 UTC
@Arjen, there was a bug bounty opened for this one: https://discuss.kde.org/t/bug-fix-fractional-scaling-on-wayland/6594
Comment 24 Michel Le Bihan 2024-02-09 20:45:55 UTC
I'm still having rendering issues in Info Center. Please see the attached screenshot
Comment 25 Michel Le Bihan 2024-02-09 20:46:49 UTC
Created attachment 165708 [details]
Issues in Info Center
Comment 26 Nate Graham 2024-02-10 02:51:25 UTC
I see that as well, but it's a separate issue from the one described here. Can you submit a new bug report for it? Thanks!