KWin Wayland Independent Monitor Scaling

We want:

  • Legacy apps at the same physical as modern apps that support high DPI
  • Apps and window decoration to work across multiple screens at different DPI
  • Consistent mouse speed and input across monitors of different DPI
  • What we want to see:
    What we want to see

    What we need to render
    What we need to render

    How it works:

    In order to have a normalised co-ordinate system between monitors and to support apps that can't scale themselves the system is defined as follows:

    * KWin pretends all monitors are ~96dpi and handles all communication and input co-ordinates as such. Final output is then scaled up if applicable

    * Clients which support high DPI, when relevant, will provide a buffer (the picture of their contents) which is twice the resolution of their window size.

    This covers all the different scenarios:

    If we have a 1x window on a 2x screen, the compositor will draw the window twice the size.

    If we have a 2x window on a 1x screen, the window contents will be drawn implicitly downsized.

    If we have a 2x window on a 2x screen, the window will be drawn twice the size, but because it's at twice the resolution, we end up painting the contents at the native resolution.

    Clients without scaling now work as intended, I can use ardour or xfig on my high DPI screen and can read and interact with it normally (albeit obviously at standard resolution)

    The mouse even moves at a consistent speed across monitors and even if you had two touch screens at different DPI showing the same content, both will work perfectly.

    The changes to kwin were therefore really small, and mostly was not about implementing features but more about removing an assumed coupling between a texture size and the rendered size.



    The code to do all of this is in Plasma 5.10 as a hidden feature whilst we get more testing with everything except a UI to configure it. This is ready to land for 5.11 An extra problem is that Qt < 5.9 has a bug if the screen scale changes dynamically.

    What's left?

    Using this technique means everything is at the right size, but some adjustments are needed to make sure everything appears at native DPI not normal DPI. This is something being fixed over time.

    What about fractional scaling?

    The wayland protocol specifies a scaling in integers. We can't really go against the protocol. However, there's absolutely nothing against kwin scaling to a different amount to the protocol. It's something we can expand on later.

    One thought on “KWin Wayland Independent Monitor Scaling”

    1. Hi David,

      Thanks for the great work your doing on the hidpi field. One of the biggest frustrations these days 🙂

      Do you have any update on this one? I’m running 5.11 but can’t find this setting. Any way how to enable this (I accept the fact that it’s a WIP still :D) ?

      – Gerwin

    Leave a Reply

    Your email address will not be published. Required fields are marked *