Bug 414866 - Support per-screen scale factors on X11
Summary: Support per-screen scale factors on X11
Status: RESOLVED INTENTIONAL
Alias: None
Product: KScreen
Classification: Plasma
Component: common (show other bugs)
Version: 5.12.9
Platform: Kubuntu Linux
: NOR normal
Target Milestone: 1.0
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords: usability
: 358689 426431 432179 439763 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-12-05 16:00 UTC by Marc Streckfuß
Modified: 2022-01-21 05:14 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Streckfuß 2019-12-05 16:00:22 UTC
Apologies if something like this has already been fixed, I'm still on Kubuntu 18.04 LTS, thus it could well be that this has been addressed upstream, but I doubt that.
Also sorry if this is the wrong component, I don't know which part is responsible for configuring X11.

So, I had the problem of multiple DPI and read that X11 only supports on -dpi directive and that one should wait for wayland to support that.
Fortunately I found a [blogpost](https://blog.summercat.com/configuring-mixed-dpi-monitors-with-xrandr.html) to use xrandr to configure X11 properly, so that it works on my system.

It would thus be awesome if KDE could support either monitor-dependant scaling or some magic mode where dpi is set to the highest possible (thus increasing the virtual resolution of the other displays and then scaling down again).

My example config is:
```
xrandr --dpi 108.8 --fb 3735x2880 --output HDMI-0 --scale 1.088x1.088 --rotate left --pos 0x160 --panning 1175x2089+0+0 --output DP-2.8 --mode 2560x1440 --pos 1175x1440 --panning 2560x1440+1175+1440 --output DVI-D-0 --scale 1.333x1.333 --pos 1175x0 --panning 2560x1440+1175+0
```

The scale has been determined by dividing the individual DPI of the displays (DVI-D-0 is a Full HD Panel but with the scale we are at WQHD virtual again).

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 18.04
KDE Plasma Version: 5.12.9
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5
Comment 1 Nate Graham 2019-12-06 16:12:30 UTC
There's a (semi-blocked) patch that implements this: https://phabricator.kde.org/D12405.
Comment 2 Marc Streckfuß 2019-12-06 16:38:04 UTC
After reading through the patch, I think deferring the scaling to X11 could even remove all the downsides of the previous patch (it would work on all applications), but might introduce it's own set of problems:

With my suggestion, all screens run at the same dpi and thus have their virtual space, this means panning and scales and fonts etc is all according to the highest DPI. For overlapping windows, there are no corner-cases, they just use the high DPI, as essentially all windows have the same DPI.

X11 will then take the contents and scale the pixels down, this means the windows have the same size on all screens.

Downside I see is:
The applications all render at a higher resolution than needed, thus have an additional load. Then the scaling process might be lossy, so it looks worse than without a multi monitor setup.
As such, images might get upscaled to the high resolution and X11 scales them down again.

I have the feeling that my lower dpi monitor does look worse than it used before, but I guess we can't take that as true, as I never had a comparison and now that I got a better display, I can directly compare them and see how "bad" it really was.
Comment 3 David Edmundson 2019-12-06 16:39:31 UTC
That patch has nothing with xrandr scaling.

You want to find Dan's patch.

The xrandr scaling method has been seen, and has been deemed problematic.

Until recently there was an issue with pointer constraints without a downstream patch only Ubuntu had. There's also a massive issue that if you open a legacy app on your 1x monitor, it's quarter of the size which is a worst state than before.

Obviously we don't try and break the setup you have that works (you can disable kscreen so it doesn't meddle with your scripts) - and you can set the DPI and Qt scale factor to your highest screen.

But I don't want us support that, as it's an invasive change to spend time on when wayland fixes it properly.
Comment 4 Nate Graham 2019-12-06 16:43:30 UTC
I read this bug report as not asking for xrandr scaling specifically, but as using that as a workaround for the lack of per-screen scaling support in KScreen on X11.

Can we re-open this to track doing it using QT_SCREEN_SCALE_FACTORS?
Comment 5 Nate Graham 2019-12-09 21:51:16 UTC
Re-opening per the result of in-person discussion. We'll investigate whether or not per-screen scale factors is an outcome that can actually work given the technical limitations of X11. No guarantees, but we'll give it a shot. :)
Comment 6 Luigi Toscano 2020-09-12 08:22:22 UTC
*** Bug 426431 has been marked as a duplicate of this bug. ***
Comment 7 crupest 2020-10-06 15:00:05 UTC
These are two different problems:
1. KDE Plasma should support multi-screen with different xrandr scale. As far as I've searched, this is the "best" way to deal with multi-screen with different DPI. By far, the function is buggy as you can see in bugs searched with "xrandr scale" keywords.(https://bugs.kde.org/buglist.cgi?quicksearch=xrandr%20scale Too many so I don't list).

2. KScreen should support configuring different scale in different screen. By far, it only supports unified scale in all screens. Although KScreen is just config front-end (I think) and actual implementation could vary, it is very important to those who use multiple screens with different DPI.
Comment 8 2wxsy58236r3 2021-01-27 13:04:20 UTC
*** Bug 432179 has been marked as a duplicate of this bug. ***
Comment 9 Sebastian Turzański 2021-04-19 21:04:32 UTC
I'm also affected- don't see the option to cast my vote
Comment 10 Nate Graham 2021-08-03 00:26:38 UTC
*** Bug 439763 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2022-01-21 05:13:52 UTC
Unfortunately there's no practical way to fix it on X11 due to baked-in assumptions in X11 itself. It already works on Wayland, so there is little chance it will ever get fixed on X11, which means the overall effort will never get unblocked, which means it can't be done.

Unfortunately I think we have to close this. Folks who want a decent hidpi experience will have to use Wayland and look forward to upcoming changes to improve the experience for XWayland apps in particular.

Sorry everyone. :(
Comment 12 Nate Graham 2022-01-21 05:14:28 UTC
*** Bug 358689 has been marked as a duplicate of this bug. ***