Bug 502390 - Wrong screen resolution for XWayland clients on multi-monitor setups with mixed resolution displays
Summary: Wrong screen resolution for XWayland clients on multi-monitor setups with mix...
Status: RESOLVED LATER
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (other bugs)
Version First Reported In: 6.3.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen, wayland-only
Depends on:
Blocks:
 
Reported: 2025-04-04 05:11 UTC by Vladimir Yerilov
Modified: 2025-11-06 22:05 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
systemsettings settings (198.51 KB, image/png)
2025-04-04 05:11 UTC, Vladimir Yerilov
Details
wrong resolution, bad performance, good looks (1.03 MB, image/png)
2025-04-04 05:12 UTC, Vladimir Yerilov
Details
correct resolution, good performance, looks blurry, unclickable (therefore unusable) (1.11 MB, image/png)
2025-04-04 05:13 UTC, Vladimir Yerilov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Yerilov 2025-04-04 05:11:14 UTC
Created attachment 179989 [details]
systemsettings settings

SUMMARY
I noticed a wierd behaviour of XWayland app[s] when certain conditions are met:
1. Wayland Plasma session is running (up to 6.3.4 are affected, dev branch not tested but should be the same)
2. Legacy applications (X11): "Apply scaling themselves" is selected as a scaling preference.
3. Have dual or more monitor setup with both monitors having different resolution. In my case, it's 3072x1920 (laptop) and 1920x1080 (external) ones.
4. XWayland app[s] run on the external monitor have its resilution effectively doubled then downscaled, resulting in severe fps loss (but looks good). Selecting native (real) resolution in app's settings makes it run much more smoothly, but its interface becomes blurred and unavailable (nothing happens when I click on what is supposed to be an app's button, dropdown menu, radiobutton, etc).

STEPS TO REPRODUCE
1. Have Wayland, at least 2 monitors with not equal resolution (I guess HiDPI + a regular FHD will do)
2. Launch XWayland app supposed to work in full-screen mode
3. Scratch your head in wonders

OBSERVED RESULT
App's interface is not responding (unreachable, unclickable)

EXPECTED RESULT
Plasma (KWin or what else is to blame for this) not messing with non-HiDPI monitor resolution. Let it be the default one. Or launch a separate xwayland instance for each monitor / process run on such monitor, if possible.

SOFTWARE/OS VERSIONS
Windows: there it works btw
macOS: there be krakens
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0
Qt Version: 6.8.3

ADDITIONAL INFORMATION
I guess it has already been discussed here:
https://bugs.kde.org/show_bug.cgi?id=459185
Xrandr shows doubled resolution for FHD monitor (DP-1):
$ xrandr                                                                                              0 (55.686s)
Screen 0: minimum 16 x 16, current 6912 x 2160, maximum 32767 x 32767
eDP-1 connected 3072x1920+0+0 (normal left inverted right x axis y axis) 312mm x 195mm
   3072x1920    119.98*+
   2048x1536    119.95  
   1920x1440    119.97  
   1600x1200    119.82  
   1440x1080    119.92  
   1400x1050    119.90  
   1280x1024    119.83  
   1280x960     119.89  
   1152x864     119.77  
   1024x768     119.80  
   800x600      119.85  
   640x480      119.52  
   320x240      117.34  
   2560x1600    119.93  
   1920x1200    119.90  
   1680x1050    119.89  
   1440x900     119.94  
   1280x800     119.85  
   1152x720     119.73  
   960x600      119.74  
   928x580      119.55  
   800x500      119.47  
   768x480      119.71  
   720x480      119.65  
   640x400      119.64  
   320x200      117.55  
   2880x1620    119.95  
   2560x1440    120.00  
   2048x1152    119.96  
   1920x1080    119.93  
   1600x900     119.95  
   1368x768     119.83  
   1280x720     119.86  
   1024x576     119.85  
   864x486      119.69  
   720x400      119.54  
   640x350      119.24  
DP-1 connected primary 3840x2160+3072+0 (normal left inverted right x axis y axis) 510mm x 290mm
   3840x2160     59.98*+
   2048x1536     59.95  
   1920x1440     59.97  
   1600x1200     59.87  
   1440x1080     59.99  
   1400x1050     59.98  
   1280x1024     59.89  
   1280x960      59.94  
   1152x864      59.96  
   1024x768      59.92  
   800x600       59.86  
   640x480       59.38  
   320x240       59.29  
   2560x1600     59.99  
   1920x1200     59.88  
   1680x1050     59.95  
   1440x900      59.89  
   1280x800      59.81  
   1152x720      59.97  
   960x600       59.63  
   928x580       59.88  
   800x500       59.50  
   768x480       59.90  
   720x480       59.71  
   640x400       59.95  
   320x200       58.14  
   3200x1800     59.96  
   2880x1620     59.96  
   2560x1440     59.96  
   2048x1152     59.90  
   1920x1080     59.96  
   1600x900      59.95  
   1368x768      59.88  
   1280x720      59.86  
   1024x576      59.90  
   864x486       59.92  
   720x400       59.27  
   640x350       59.28
Comment 1 Vladimir Yerilov 2025-04-04 05:12:17 UTC
Created attachment 179990 [details]
wrong resolution, bad performance, good looks
Comment 2 Vladimir Yerilov 2025-04-04 05:13:24 UTC
Created attachment 179991 [details]
correct resolution, good performance, looks blurry, unclickable (therefore unusable)
Comment 3 Vladimir Yerilov 2025-04-04 05:17:08 UTC
You might want to ask how I got a screenshot of unclickable FHD game? Well I had to drag it with Meta+mouse click to another screen where I could change the settings etc, then dragged it back. Until I set native 1080 resolution the game worked "fine" (except for terrible performance due to resolution overhead).
Comment 4 Nate Graham 2025-04-04 16:40:47 UTC
Likely an issue caused by XWayland running at the highest resolution rather than than the resolution of the screen that the window is on, due to only having one XWayland instance rather than one per screen or per window.
Comment 5 Vladimir Yerilov 2025-04-06 05:59:38 UTC
(In reply to Nate Graham from comment #4)
> Likely an issue caused by XWayland running at the highest resolution rather
> than than the resolution of the screen that the window is on, due to only
> having one XWayland instance rather than one per screen or per window.

Is it possible (meaning: feasible) to make such change? To have XWayland instances per screen on "on-demand" for fullscreen ) or specific windows? What implications that could bring I wonder...
So, is it a Plasma "bug" (something you guys could improve) or rather XWayland problem?
Comment 6 Nate Graham 2025-04-08 17:14:09 UTC
One XWayland instance per XWayland-using app is probably possible, and then it could dynamically change its scale factor when it moves to another screen.

One XWayland instance per screen is less likely to be possible since it would require apps to switch which XWayland instance they're using as they get moved between screens. I don't know if that's possible.

Of course the downside of all of this would be higher resource usage due to more XWayland processes running. So there are trade-offs here.

I'll let the KWin folks comment further.
Comment 7 madness742 2025-05-26 16:11:28 UTC
I can confirm the same behaviour, I switch my primary monitor scaling to 100% prior to launching a game. Legacy applications (X11) needs to be set to "Scaled by the system" under System Settings -> Display Configuration.

Using custom start/end scripts with `gamemode` to adjust the monitor scaling with `kscreen-doctor` is sadly not fast enough. So i'm forced to do it manually.

Cosmic DE Alpha 7 has introduced a new scaling option that fixes the xwayland resolution when using mixed scaling, something similar in KDE Plasma would be very appreciated! 

Using 100% scaling on the primary monitor and 150% scaling on the second monitor makes certain text hard to read because of Bug 491015. 
Constantly changing scaling is causing Bug 504635. I'll update the bug report once Plasma 6.4 hits the Fedora repos, and if the issue still persists. 

The other workaround I can think of is using `gamescope`, but it doesn't work with the Flatpak version of Steam.

Monitor 1: LG UltraGear 27GL850 (2560x1440, 125% scaling, primary)
Monitor 2: LG 27UL850-W (3840x2160, 200% scaling)

Operating System: Fedora Linux 42
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Comment 8 righn 2025-06-19 19:16:19 UTC
(In reply to madness742 from comment #7)
> I can confirm the same behaviour, I switch my primary monitor scaling to
> 100% prior to launching a game. Legacy applications (X11) needs to be set to
> "Scaled by the system" under System Settings -> Display Configuration.
> 
> Using custom start/end scripts with `gamemode` to adjust the monitor scaling
> with `kscreen-doctor` is sadly not fast enough. So i'm forced to do it
> manually.
> 
> Cosmic DE Alpha 7 has introduced a new scaling option that fixes the
> xwayland resolution when using mixed scaling, something similar in KDE
> Plasma would be very appreciated! 
> 
> Using 100% scaling on the primary monitor and 150% scaling on the second
> monitor makes certain text hard to read because of Bug 491015. 
> Constantly changing scaling is causing Bug 504635. I'll update the bug
> report once Plasma 6.4 hits the Fedora repos, and if the issue still
> persists. 
> 
> The other workaround I can think of is using `gamescope`, but it doesn't
> work with the Flatpak version of Steam.
> 
> Monitor 1: LG UltraGear 27GL850 (2560x1440, 125% scaling, primary)
> Monitor 2: LG 27UL850-W (3840x2160, 200% scaling)
> 
> Operating System: Fedora Linux 42
> KDE Plasma Version: 6.3.5
> KDE Frameworks Version: 6.14.0
> Qt Version: 6.9.0

Gamescope, at the moment, doesn't seem to work well with NVIDIA, especially laptops. So it ain't a solution for a lot of people. 

My details:

Operating System: Arch Linux
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1

Screen:

Internal laptop: 2560x1440@165hz
External screen: 1920x1080@60hz

It doesn't matter on which screen the game is running, the game thinks it's always the internal screen, even though the external one is set to be primary. I can choose a internal display's resolution,  I can even select the refresh rate, even though the external display is 60hz. 

While, it is nice to have a sharper picture, my laptop ain't that powerful to run every game at 1440p, but setting the resolution at 1080p, makes the whole window smaller.
Comment 9 Zamundaaa 2025-11-06 22:05:55 UTC
Unfortunately this is just how Xwayland scaling works, there is no perfect solution for X11 applications. There is a reason we went through so much trouble to move away from X11 where we can.

For fullscreen mode, xrandr emulation (see bug 501505) will help, and together with https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2095 it should do the right thing out of the box.

For windowed mode, an Xwayland instance per application might become a thing at some point in the far-ish future, but right now it's not really feasible.