Skip to content

wayland/xwayland: Add xwayland-scaling-mode setting - #907

Open
wlroots wants to merge 1 commit into
linuxmint:masterfrom
wlroots:xwayland-scaling-mode
Open

wlroots wants to merge 1 commit into
linuxmint:masterfrom
wlroots:xwayland-scaling-mode

Conversation

@wlroots

@wlroots wlroots commented Nov 26, 2026

Copy link
Copy Markdown

Summary

On a 1920x1080 monitor at 125%, Xwayland currently gets a 3072x1728 X screen
(ceil(highest monitor scale) == 2). X11 clients therefore render at a higher
resolution than the monitor and the compositor downscales them. This wastes GPU
time and can cause input lag (mutter#3767).

This adds an xwayland-scaling-mode GSettings enum to
org.cinnamon.muffin.wayland:

  • automatic (default): keep the current behavior, i.e. scale the Xwayland
    coordinate space by ceil(highest monitor scale).
  • native: use the highest monitor scale directly, so the Xwayland coordinate
    space matches the physical monitor resolution (1920x1080 at 125%). This
    avoids rendering more pixels than necessary, at the cost of X11 user
    interfaces appearing smaller on fractional scales.

Changing the setting takes effect immediately by re-applying the monitor
configuration, which updates the output geometry and the scale used for
existing Xwayland surfaces. The MUFFIN_DEBUG_DISABLE_XWAYLAND_SCALING
escape hatch is preserved.

Internally the Xwayland effective scale is now a double, and the surface,
shaped texture, window actor, input and DnD paths were converted from integer
scale handling to fractional scales with explicit rounding.

Based on the approach discussed in
https://gitlab.gnome.org/GNOME/mutter/-/issues/3767.

Testing

  • ninja builds successfully with and without tests, and
    glib-compile-schemas --strict accepts the updated schema.
  • gsettings range org.cinnamon.muffin.wayland xwayland-scaling-mode reports
    automatic/native, and the default is automatic.
  • Run the test suite with GSETTINGS_SCHEMA_DIR=<build>/data (as the Debian
    packaging already does) so it picks up the new key. With that, the suite
    reaches the pre-existing /backends/monitor/one-disconnected-linear-config
    failure, which also fails on unmodified master.

No automated test was added for the new key: mutter's Xwayland scaling test
relies on MonitorTestCaseSetup/meta_create_monitor_test_setup, which are
local static helpers in Muffin's monitor-unit-tests.c, and Muffin has no
equivalent Xwayland test harness yet. Happy to add one in a follow-up if
preferred.

Manual verification

# automatic (default): 3072x1728 at 125%
gsettings set org.cinnamon.muffin.wayland xwayland-scaling-mode automatic
# native: 1920x1080 at 125%
gsettings set org.cinnamon.muffin.wayland xwayland-scaling-mode native

Currently the Xwayland coordinate space is scaled by the ceiling of the
highest monitor scale. On a 1920x1080 monitor at 125% this results in a
3072x1728 Xwayland root window, so X11 clients are rendered at a higher
resolution than the monitor and then downscaled by the compositor.

Add an xwayland-scaling-mode enum to the org.cinnamon.muffin.wayland
schema:

  - automatic (default) keeps the current behavior, i.e. the ceiling of
    the highest monitor scale.
  - native uses the highest monitor scale directly, so the Xwayland
    coordinate space matches the physical monitor resolution (1920x1080
    at 125%). This avoids rendering more pixels than necessary, at the
    cost of X11 user interfaces appearing smaller on fractional scales.

The setting takes effect immediately by reapplying the monitor
configuration, which updates the output geometry and the scale used for
existing Xwayland surfaces.

The scale used by Xwayland is now a double throughout the surface,
shaped texture and window actor paths, since fractional scales such as
1.25 or 1.5 are no longer rounded up.

Based on the approach discussed in
https://gitlab.gnome.org/GNOME/mutter/-/issues/3767.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant