Bug 422552

Summary: Auto-detect appropriate scale factor for the easy cases (e.g. 4k screen) on X11
Product: [Plasma] KScreen Reporter: Nate Graham <nate>
Component: commonAssignee: kscreen-bugs-null <kscreen-bugs-null>
Severity: wishlist CC: agurenko, bruno, eric.donkersloot, kamikazow, katyaberezyaka, kde, kde, loudsquid, mail, makosol, miltonh26, MurzNN, openmindead, peter.eszlari, plasma-bugs, postix, rlk, sommerluk
Priority: HI    
Version: master   
Target Milestone: 1.0   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Nate Graham 2020-06-06 20:07:57 UTC
Right now Plasma does not apply any kind of automatic scaling. For difficult cases like FHD resolution on a 14" screen, or 1440p resolution on a 13" screen, this makes sense, as there isn't yet consensus on how to handle this, and doing so might be technically thorny; see https://phabricator.kde.org/T13158.

However there is a very easy case where we can guess with near-100% certainty what we should do: the case of the 4k screen. No matter what physical size the screen is, a 4K screen always benefits from applying a 200% scale factor. Maybe the user might in the end prefer 225% or 250% or whatever, but 200% is always more correct than the default 100% for these screens.

I would recommend that Plasma automatically apply an initial scale factor of 200% for 4k screens to improve the out-of-the-box experience for users with 4K screen hardware.
Comment 1 Nate Graham 2020-06-06 21:48:27 UTC
X11 is affected; Wayland is not.
Comment 2 rlk 2020-07-11 17:50:30 UTC
As long as it's still possible for those of us who prefer 100% scaling to use it.
Comment 3 Nate Graham 2020-07-11 19:05:19 UTC
Of course. :)
Comment 4 Bruno Friedmann 2020-07-22 13:06:28 UTC
Hi I'm more than interested to have hidpi issues fixed.

I'm using a laptop Dell Precision 7510 which has a internal seiko 15" lcd panel with a 288dpi. Externally I use two monitor : one 4k Dell 2715Q which has 163dpi and a 24" inch FHD HP zr2240w

I'm waiting since the last 5 years (oh yeah babe) to be able to use those 3 screens correctly each with it's full resolution at its correct dpi so image, film  fonts and graphic element are all handled.

I don't really understand how a blind 200% scale factor would be great ?
It's would only be ok on the internal screen, but 150% is better for the 27" external and 100% on the 24" FHD...
Comment 5 mail 2020-09-27 19:27:02 UTC
I'm interested in this fix, also.

I have thinkpad x1 yoga (1st gen) with 2560x1440 resolution, and wayland can't work with this resolution =(
Comment 6 Peter Eszlari 2021-02-26 17:24:28 UTC
This is especially annoying when installing Kubuntu, because the installer provides no option to change scaling.
Comment 9 Bruno Friedmann 2021-03-01 12:17:33 UTC
@soredake maybe you miss the subject of this bug
"on X11" ;-)
Comment 10 Paul McAuley 2021-03-09 15:36:19 UTC
This really needs improvement. I'm not sure how much of this is set by Plasma and how much the distribution? In my case OpenSUSE Leap 15.2 / 15.3 beta makes a fair attempt at scaling the fonts but does not set the Plasma global scale properly (the same for a new user in a system updated Plasma to 5.21). You can see the details of how a fresh install looks on my 15.6" 4K display in the screenshots I posted at https://bugzilla.opensuse.org/show_bug.cgi?id=1183119 (and hence was redirected here). Therefore, if an automatic estimate can be made at font scaling then making a similar automatic estimate for global scale is surely feasible.

From an initial look at the data you can obtain in software, it would seem that this should be possible for more than just "easy cases".

In my case for Dell XPS 15 9560 4K @ 15.6" which I measured with a ruler as 346 x 194 mm (282 dpi).

If I do the following, I get an accurate size exactly corresponding to my physical dimensions:
paul@PAUL-DELL:~> xrandr | grep ' connected'
eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 346mm x 194mm

For comfortable viewing I set the scaling to 250% (and using the standard 100%=96DPI: 96 x 2.5 = 240 DPI). The 240"DPI" figure here is clearly different to the actual 282 DPI so I guess the difficult part is factoring this difference into account and estimating the scaling thresholds for different devices; though not caring too much about the exact difference and having an algorithm to make rough educated guesses at thresholds would still be better than setting everything to 100% by default. 

For more refined user satisfaction, perhaps surveys could be taken to see what users are using, or even just copy whatever default setting Microsoft Windows uses for each display as their automatic default settings seem to work well.
Comment 11 Nate Graham 2021-03-10 02:37:17 UTC
See https://phabricator.kde.org/T13158

4K @ 15.6" generally maps perfectly to 200% scale. You don't want to extrapolate 96 DPI for laptops because people generally set the screen closer to their face than a desktop monitor, and also it's much smaller; reaching an effectively scaled 96 DPI with your screen would yield a usable scaled resolution of 1305x 734, which barely provides enough space to be useful doing anything. It would be even worse for physically smaller screens. Effectively scaled 112 DPI is probably the minimum acceptable value, and some people will prefer something closer to 120.

With 112 as out target scaled DPI, your screen resolution would be an effective 1536x864; at 120 it would be effectively 1612x907, which is approaching the realm of sanity. Not coincidentally, this is close to the effective resolution of a MacBook pro.
Comment 12 Nate Graham 2021-11-01 15:51:21 UTC
*** Bug 444681 has been marked as a duplicate of this bug. ***
Comment 13 Nate Graham 2022-01-24 22:51:49 UTC
*** Bug 449049 has been marked as a duplicate of this bug. ***
Comment 14 Vladimir Yerilov 2022-12-28 14:03:31 UTC
Hi, I have a 15" laptop with 3200x2000 resolution and I would've been perfectly fine with auto-applied 2X scale, which I set manually and which is used to be set automatically in Gnome. Of course it makes elements of UI a bit bigger than I used to, but as a starting point that's okay, way better than no scaling at all.
Comment 15 Nate Graham 2023-01-02 21:19:01 UTC
The issue on X11 is that scale is global, not per-monitor. So auto-configuring a scale factor is fine if you have a single-monitor setup, but the moment you plug in a second monitor, and that monitor would benefit from a different scale factor, it doesn't work at all. Think about the case of a 4K internal laptop screen for which KScreen choosers 200 or 250% scale. With a 1080p 24" screen attached, everything would be unusably huge.

Of course, that's an issue when you manually choose a scale factor anyway, so it's not really a regression if we do it automatically, because this use case is explicitly unsupported on X11 anyway (you should use the Wayland session for proper mixed-DPI multimonitor setups).
Comment 16 Bug Janitor Service 2023-01-02 21:55:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/171
Comment 17 Nate Graham 2023-01-03 18:18:35 UTC
This turns out to be much harder on X11 than I thought.

The thing that sets the scale factor (using environment variables) runs after the thing that propagates environment variables to apps and Plasma. So on first boot, the scale will still be wrong, but fix itself on subsequent boots.

Making it right on the first boot would require fundamentally re-architecting the whole system to move the scale factor generation logic into a new thing that runs earlier, which is hard because it has dependencies on code in the place where it already lives.

This all works properly on Wayland, and we have better auto-scaling there for Plasma 5.27. I think fixing this on X11 is not worth the effort at this point in time, given the huge re-architecting required, the risk of breakage it would entail, and how usable the Wayland session is now.

Anyone who feels up to fixing this properly on X11 is welcome to try, of course.
Comment 18 Bruno Friedmann 2023-01-03 20:19:30 UTC
I'm a bit sad to see this kind of conclusion, especially waiting on that since 2015.

At no Wayland is a no go: because after waiting the same amount time wayland and nvidia are just not usable.

And intel with wayland look like its works, if you accept to loose main functionality, like being able to restore your last session.

2023 start with mitigated feeling. At least thanks to have tried, I would not care about first time, first time is a one shot, opening your session day by day and get it configured exactly like yesterday would have been magic.
Regards and again thanks a lot for the whole effort made on this.