Bug 418546 - Lock screen's icons are blurry on HiDPI with scaling 1.5
Summary: Lock screen's icons are blurry on HiDPI with scaling 1.5
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Theme - Breeze (show other bugs)
Version: 5.17.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: visual-design
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2020-03-06 13:32 UTC by postix
Modified: 2021-06-16 19:21 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:
postix: Wayland-
postix: X11+


Attachments
Screenshot. (545.00 KB, image/png)
2020-03-06 18:11 UTC, postix
Details
Looks fine for me (607.44 KB, image/png)
2020-03-06 19:57 UTC, Nate Graham
Details
Screenshot: PLASMA_USE_QT_SCALING=1, scaling 1.5 (526.93 KB, image/png)
2020-07-24 18:47 UTC, postix
Details
Screenshot: PLASMA_USE_QT_SCALING=1, scaling 2.0 (1.15 MB, image/png)
2020-07-24 19:13 UTC, postix
Details
Screenshot: Screenshot: PLASMA_USE_QT_SCALING=1, scaling 1.5 (from scaling 2.0, no reboot) (502.18 KB, image/png)
2020-07-24 21:15 UTC, postix
Details
Animation: Scaling 1.5 (rebooted) vs 1.0 (no reboot, coming from 1.5) (2.68 MB, image/gif)
2020-07-24 21:45 UTC, postix
Details
Animation: Scaling 1.0, 1.5 (always rebooted) (2.66 MB, image/gif)
2020-07-24 22:09 UTC, postix
Details
Photograph: Wayland Lockscreen with Scaling 1.5 (3.31 MB, image/jpeg)
2020-07-24 22:26 UTC, postix
Details
Even panel/launcher icons becomes blur after setting PLASMA_USE_QT_SCALING=1 (69.81 KB, image/png)
2020-07-25 08:07 UTC, Guo Yunhe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description postix 2020-03-06 13:32:41 UTC
Lock screen's battery icon is blurry on HiDPI

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1

ADDITIONAL INFORMATION
Scaling: 1.5
Comment 1 postix 2020-03-06 13:34:09 UTC
Let's make this bug report more general: The keyboard icons, the battery icon and the switch user icon look all blurry right now.
Comment 2 Nate Graham 2020-03-06 17:49:03 UTC
Cannot reproduce with git master. Can you post a screenshot of how it looks for you?
Comment 3 postix 2020-03-06 18:11:25 UTC
Created attachment 126633 [details]
Screenshot.

(In reply to Nate Graham from comment #2)
> Cannot reproduce with git master. Can you post a screenshot of how it looks
> for you?

Sure. At best look at a 100% crop.
Comment 4 Nate Graham 2020-03-06 19:57:49 UTC
Created attachment 126636 [details]
Looks fine for me
Comment 5 Nate Graham 2020-03-06 19:58:08 UTC
Thanks. I'm attaching how it looks for me. Can you try again with Plasma 5.18?
Comment 6 postix 2020-03-06 19:59:41 UTC
(In reply to Nate Graham from comment #4)
> Created attachment 126636 [details]
> Looks fine for me

Indeed. Mmm, let me report back when I receive the 5.18.X update. :)
Comment 7 postix 2020-03-15 12:57:28 UTC
(In reply to Nate Graham from comment #5)
> Thanks. I'm attaching how it looks for me. Can you try again with Plasma
> 5.18?

Still the case on :-( 

Operating System: Manjaro Linux 
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Comment 8 postix 2020-03-15 12:58:02 UTC
SDDM's icons look fine by the way.
Comment 9 Nate Graham 2020-03-15 16:24:36 UTC
Strange.
Comment 10 Guo Yunhe 2020-05-03 09:38:37 UTC
I have the same result as Postix. (How could I screenshot the lock screen?) I have 1080p display with x1.5 scale (X11). I remember I reported it years ago but cannot find the old ticket.

And not only icons, but also avatars and cover arts of media player.

I saw Nate's screenshot has bigger fonts than Postix's. Maybe that is the reason that you got different results.

Operating System: openSUSE Tumbleweed 20200501
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Kernel Version: 5.6.6-1-default
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 31.1 GiB
Comment 11 Méven Car 2020-05-03 10:59:37 UTC
I don't reproduce either with Plasma master SDDM from Kubuntu 20.04.

My hypothese is a missing environment variable not passed to sddm about HDIPI on arch/Marjaro, but ok on kubuntu/kde-neon.
Comment 12 Guo Yunhe 2020-05-03 13:37:57 UTC
(In reply to Méven Car from comment #11)
> I don't reproduce either with Plasma master SDDM from Kubuntu 20.04.
> 
> My hypothese is a missing environment variable not passed to sddm about
> HDIPI on arch/Marjaro, but ok on kubuntu/kde-neon.

The issue is about lock screen, not SDDM.
Comment 13 Méven Car 2020-05-04 08:25:27 UTC
(In reply to Guo Yunhe from comment #12)
> (In reply to Méven Car from comment #11)
> > I don't reproduce either with Plasma master SDDM from Kubuntu 20.04.
> > 
> > My hypothese is a missing environment variable not passed to sddm about
> > HDIPI on arch/Marjaro, but ok on kubuntu/kde-neon.

Sorry I meant the lockscreen rather than SDDM.

> 
> The issue is about lock screen, not SDDM.
I checked again, and I do reproduce in the end with 1.5 scaling on a 1920*1080 screen on plasma near-master.

This is X only.
Comment 14 Nate Graham 2020-07-24 18:16:04 UTC
Is this one of the things that's fixed when setting PLASMA_USE_QT_SCALING=1? Can anyone who's affected check?
Comment 15 Guo Yunhe 2020-07-24 18:18:39 UTC
How to set PLASMA_USE_QT_SCALING=1? Do I need to compile plasma workspace/desktop with this parameter or is it a runtime environment variable?
Comment 16 postix 2020-07-24 18:24:06 UTC
(In reply to Nate Graham from comment #14)
> Is this one of the things that's fixed when setting PLASMA_USE_QT_SCALING=1?
> Can anyone who's affected check?

Can still reproduce it.
Comment 17 Nate Graham 2020-07-24 18:25:11 UTC
Runtime is fine. Run these commands in a terminal window:

```
export PLASMA_USE_QT_SCALING=1
rm ~/.cache/plasma*
plasmashell --replace
kwin_x11 --replace
```

...Then lock the screen and let me know if the problem is fixed.
Comment 18 Nate Graham 2020-07-24 18:26:41 UTC
@postix
Your original screenshot clearly shows the lock screen being rendered at 100% scale rather than 150% scale which would point to it being a lack-of-Qt-scaling issue. Does it look the same as it did before, or any different? If so can you attach a screenshot?
Comment 19 postix 2020-07-24 18:47:08 UTC
Created attachment 130374 [details]
Screenshot: PLASMA_USE_QT_SCALING=1, scaling 1.5

(In reply to Nate Graham from comment #18)
> @postix
> Your original screenshot clearly shows the lock screen being rendered at
> 100% scale rather than 150% scale which would point to it being a
> lack-of-Qt-scaling issue. Does it look the same as it did before, or any
> different? If so can you attach a screenshot?

1) Scaling 1.5
2) PLASMA_USE_QT_SCALING=1 in /etc/environment and /etc/sddm.conf section [x11] (necessary?)
3) reboot
4) Ctrl+L 

Are the steps fine? This way it looks blurry.
Comment 20 Nate Graham 2020-07-24 18:51:51 UTC
You're still getting an unscaled lock screen somehow, hmm. It's being shown at 100%, not 150% scaling.

Can you try doing it like I suggested in comment 17?

> /etc/sddm.conf section [x11] (necessary?)
Not necessary. You can remove that and then instead go to System Settings > Startup and Shut Down > SDDM > Advanced > Click the "Sync" button.

In fact, after doing that, can you reboot again, and check to see if SDDM and the lock screen look okay?
Comment 21 postix 2020-07-24 19:04:13 UTC
(In reply to Nate Graham from comment #20)
> You're still getting an unscaled lock screen somehow, hmm. It's being shown
> at 100%, not 150% scaling.

Yes, it's really weird.

> Can you try doing it like I suggested in comment 17?


> You can remove that and then instead go to System Settings >
> Startup and Shut Down > SDDM > Advanced > Click the "Sync" button.
> 
> In fact, after doing that, can you reboot again, and check to see if SDDM
> and the lock screen look okay?

I tried both, unfortunately without success. :-(
Comment 22 postix 2020-07-24 19:13:28 UTC
Created attachment 130375 [details]
Screenshot: PLASMA_USE_QT_SCALING=1, scaling 2.0

With scaling 2.0 and syncing SDDM, it looks fine (after a reboot).
Comment 23 Nate Graham 2020-07-24 20:51:24 UTC
Excellent.

However the fact that you had to sync your settings to SDDM to make it work is very weird to me, but we've gotten another report of that too, so I'll dupe it.

*** This bug has been marked as a duplicate of bug 423600 ***
Comment 24 postix 2020-07-24 20:58:37 UTC
(In reply to Nate Graham from comment #23)
> Excellent.
> 
> However the fact that you had to sync your settings to SDDM to make it work
> is very weird to me, but we've gotten another report of that too, so I'll
> dupe it.
> 
> *** This bug has been marked as a duplicate of bug 423600 ***

FWIW, it only works for scaling 2.0, for 1.5 the problem persists. 
Does syncing only update /etc/sddm.conf or does it also something else?
Comment 25 postix 2020-07-24 21:09:45 UTC
(In reply to Postix from comment #22)
> Created attachment 130375 [details]
> Screenshot: PLASMA_USE_QT_SCALING=1, scaling 2.0
> 
> With scaling 2.0 and syncing SDDM, it looks fine (after a reboot).

(In reply to Nate Graham from comment #23)
> Excellent.
> 
> However the fact that you had to sync your settings to SDDM to make it work
> is very weird to me, but we've gotten another report of that too, so I'll
> dupe it.

I'm happily testing.. ;) It's not a dupe. I went back to scaling 1.5, rebooted, then changed to scaling 2.0 (without syncing or rebooting) and locked the screen: Scales and looks like the 3rd attachment [1].


[1] https://bugs.kde.org/attachment.cgi?id=130375
Comment 26 postix 2020-07-24 21:15:37 UTC
Created attachment 130380 [details]
Screenshot: Screenshot: PLASMA_USE_QT_SCALING=1, scaling 1.5 (from scaling 2.0, no reboot)

Now I can do the same coming from scaling 2.0 and scale to 1.5 without syncing and rebooting and voilá, the locked screen displayes sharp crisp icons. However, once I reboot, they are blurry again!
Comment 27 postix 2020-07-24 21:45:08 UTC
Created attachment 130381 [details]
Animation: Scaling 1.5 (rebooted) vs 1.0 (no reboot, coming from 1.5)

I went back to scaling 1.5 (reboot) and scaled to 1.0 (no reboot, no syncing) and locked the screen: 

The icons become bigger and sharper for 1.0, besides the battery icon, which becomes smaller in fact. I made an animation for you to better see the difference ...
Comment 28 postix 2020-07-24 21:47:44 UTC
Summing up:

Integer scaling like 1.0 and 2.0 look as expected w/ or w/o a reboot/syncing.
Fractional scaling like 1.5 never looks fine on my side for the lock screen*.


*The login-in screen, despite beeing SDDM as well(?!) looks always fine.
Comment 29 David Edmundson 2020-07-24 21:49:01 UTC
Is this X or wayland?

Could you see if deleting the plasma cache makes a difference?
Comment 31 postix 2020-07-24 22:09:45 UTC
Created attachment 130382 [details]
Animation: Scaling 1.0, 1.5 (always rebooted)

(In reply to David Edmundson from comment #29)
> Is this X or wayland?
> 
> Could you see if deleting the plasma cache makes a difference?

That's X11. rm -rf ~/.cache/plasma* before invoking Ctrl+L did not make any difference.
Comment 32 postix 2020-07-24 22:26:22 UTC
Created attachment 130383 [details]
Photograph: Wayland Lockscreen with Scaling 1.5

As I don't know how to take a screenshot of the lock screen at Wayland -- I used the delay function of spectacle at X -- I took a bad photograph.

Scaling 1.5 looks sharp here. Not sure if everything is as big as it should be though?
Comment 33 Guo Yunhe 2020-07-25 08:02:49 UTC
(In reply to Nate Graham from comment #17)
> Runtime is fine. Run these commands in a terminal window:
> 
> ```
> export PLASMA_USE_QT_SCALING=1
> rm ~/.cache/plasma*
> plasmashell --replace
> kwin_x11 --replace
> ```
> 
> ...Then lock the screen and let me know if the problem is fixed.


For me it is still blur. (But it fixed the size of context menu on panel and desktop).
Comment 34 Guo Yunhe 2020-07-25 08:07:41 UTC
Created attachment 130386 [details]
Even panel/launcher icons becomes blur after setting PLASMA_USE_QT_SCALING=1
Comment 35 Nate Graham 2020-07-27 14:52:06 UTC
(In reply to Guo Yunhe from comment #34)
> Created attachment 130386 [details]
> Even panel/launcher icons becomes blur after setting PLASMA_USE_QT_SCALING=1

Can you delete the plasma SVG cache and restart plasmashell? I have a sneaking suspicion that this is caused by Bug 424615.
Comment 36 Guo Yunhe 2020-07-28 07:35:20 UTC
(In reply to Nate Graham from comment #35)
> Can you delete the plasma SVG cache and restart plasmashell? I have a
> sneaking suspicion that this is caused by Bug 424615.

I did remove ~/.cache/* before running the commands but the lockscreen and panel are still blur.
Comment 37 Nate Graham 2020-07-28 14:03:48 UTC
Darn. Thanks for checking.
Comment 38 Chandradeep Dey 2021-02-04 21:13:13 UTC
I have the same problem with 125% scaling. I thought only the avatar was blurry compared to SDDM. After seeing this bug I looked at the rest and all were blurry as mentioned.

Changing
/usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/components/UserDelegate.qml
line 85
-sourceSize: Qt.size(faceSize, faceSize)
+sourceSize: Qt.size(faceSize * 1.25, faceSize * 1.25)
+width: faceSize

made the avatar as good as SDDM.
Comment 39 Méven Car 2021-03-01 09:20:12 UTC
(In reply to Chandradeep Dey from comment #38)
> I have the same problem with 125% scaling. I thought only the avatar was
> blurry compared to SDDM. After seeing this bug I looked at the rest and all
> were blurry as mentioned.
> 
> Changing
> /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/components/
> UserDelegate.qml
> line 85
> -sourceSize: Qt.size(faceSize, faceSize)
> +sourceSize: Qt.size(faceSize * 1.25, faceSize * 1.25)
> +width: faceSize
> 
> made the avatar as good as SDDM.

Does :

 line 85
 -sourceSize: Qt.size(faceSize, faceSize)
 +sourceSize: Qt.size(faceSize * Screen.devicePixelRatio, faceSize * Screen.devicePixelRatio)

Work as well ?

This then could easily be adapted to a patch.
Comment 40 Chandradeep Dey 2021-03-01 12:33:18 UTC
Yep.

Also, some observations:
1) SDDM's user account picture remains the same size even when the dpi changes. So it remains sharp.
2) The user manager KCM probably needs the same treatment.
3) The user picture is blurry on Wayland and adding the multiplication factor fixes it. But the switch user icon and battery icon are sharp by default on Wayland.

(In reply to Méven Car from comment #39)
> Does :
> 
>  line 85
>  -sourceSize: Qt.size(faceSize, faceSize)
>  +sourceSize: Qt.size(faceSize * Screen.devicePixelRatio, faceSize *
> Screen.devicePixelRatio)
> 
> Work as well ?
> 
> This then could easily be adapted to a patch.
Comment 41 Nate Graham 2021-03-01 16:30:24 UTC
Cool. Wanna send a merge request to https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/?
Comment 42 Bug Janitor Service 2021-03-02 23:30:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/686
Comment 43 Méven Car 2021-03-08 06:43:00 UTC
Git commit 1c0c824cc51caf913faf0f6885a8cf6c2c9cc3b4 by Méven Car, on behalf of Chandradeep Dey.
Committed on 08/03/2021 at 06:42.
Pushed by meven into branch 'master'.

Use a bigger image for lock screen avatar

Lock screen avatar is blurry when using HiDPI scaling. This fixes that
by adding a multiplication factor to the size of the retrieved image.

M  +1    -1    lookandfeel/contents/components/UserDelegate.qml

https://invent.kde.org/plasma/plasma-workspace/commit/1c0c824cc51caf913faf0f6885a8cf6c2c9cc3b4
Comment 44 Fabian Vogt 2021-04-20 08:55:02 UTC
(In reply to Bug Janitor Service from comment #42)
> A possibly relevant merge request was started @
> https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/686

This change introduced a regression, the fallback avatar in sddm is now a pixelated blur: https://openqa.opensuse.org/tests/1706054#step/start_wayland_plasma5/16
Comment 45 Bug Janitor Service 2021-04-20 09:02:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/803
Comment 46 David Redondo 2021-04-20 09:13:23 UTC
Git commit 2310fcb11173a166b357a453f3c727fe110f68f6 by David Redondo.
Committed on 20/04/2021 at 09:01.
Pushed by davidre into branch 'master'.

Import QtQuick.Window in UserDelegate

1c0c824cc51caf913faf0f6885a8cf6c2c9cc3b4 uses Screen but that is inside
in QtQuick.Window. This happens to work in the lockscreen (something else
importing it above it?) but breaks in the sddm theme, with the default image
being super pixelated because sourceSize defaults back to 22x22.

M  +1    -0    lookandfeel/contents/components/UserDelegate.qml

https://invent.kde.org/plasma/plasma-workspace/commit/2310fcb11173a166b357a453f3c727fe110f68f6
Comment 47 Chandradeep Dey 2021-06-16 13:26:01 UTC
Reopening as the patches only fixed the user avatar. Battery and other icons remain blurry on X11.
Comment 48 Nate Graham 2021-06-16 16:24:23 UTC
There is no way to avoid blurriness when using HiDPI fractional Qt scaling with monochrome line-art icons. The icons are designed to be pixel- aligned at 100% scale, with the lines the thickness of one pixel exactly. But when you scale them by 150%, the lines get 150% thicker yet the pixels on your screen don't become 150% bigger. So the lines are no longer match the thickness of an individual pixel anymore, and hence, they become blurry. There is no way to fix this, sorry. It is simply something you need to live with when you use fractional scaling.
Comment 49 postix 2021-06-16 19:09:06 UTC
As a last remark, maybe you can explain to me why I still (Ferdora 34) don't see this issue on the login screen of SDDM with the Breeze theme, whose settings I have synchronized (in Systemsettings). 

All, really all icons are pretty much about the same size (measured by eye sight), but all are crisp.

What's the difference? Does SDDM use different kind if icons? :-)
Comment 50 postix 2021-06-16 19:11:13 UTC
And honestly, when I look sharply, the virtual keyboard icon now looks fine to me on the lockscreen(!), the only icons, which still do not look fine, are the battery status and visual hint icon in the password field.

So there has been some improvements and I wonder if those two icons left, couldn't be fixed as well?
Comment 51 Nate Graham 2021-06-16 19:14:24 UTC
SDDM doesn't use Qt scaling.
Comment 52 postix 2021-06-16 19:21:24 UTC
(In reply to Nate Graham from comment #51)
> SDDM doesn't use Qt scaling.

It's a Qt app, why doesn't use it Qt scaling? How does it scale then?

Why is the virtual keyboard icon now fine but the other not?

I am still very confused.

I also wonder, why the battery icon in the taskbar / systemtray, which is also about the same size, looks totally fine as well. Is it a different kind of icon? Different way of scaling?