[mir:wayland] Support wp_fractional_scale_v1 for correct HiDPI scaling#4932
[mir:wayland] Support wp_fractional_scale_v1 for correct HiDPI scaling#4932Copilot wants to merge 7 commits into
Conversation
Agent-Logs-Url: https://github.com/canonical/mir/sessions/946b03e3-67a7-43bd-a6ee-8f03f16f999a Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Agent-Logs-Url: https://github.com/canonical/mir/sessions/946b03e3-67a7-43bd-a6ee-8f03f16f999a Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Agent-Logs-Url: https://github.com/canonical/mir/sessions/946b03e3-67a7-43bd-a6ee-8f03f16f999a Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
|
@copilot testing this exposes existing problems with the scale handling: The internal background client used by miral-shell has the text reduced in size in proportion to the scale. What appears to be happening is that the scale is not being propagated from the platform and therefore not seen by clients. Here's a comparison of a debug trace with the |
…atform Agent-Logs-Url: https://github.com/canonical/mir/sessions/ed6ce9e0-7914-48ea-9756-9a1b1a82877e Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
Fixed in c6f3b34. There were two bugs causing this:
Also fixed: |
Agent-Logs-Url: https://github.com/canonical/mir/sessions/ed6ce9e0-7914-48ea-9756-9a1b1a82877e Co-authored-by: AlanGriffiths <9048879+AlanGriffiths@users.noreply.github.com>
The
mir:waylandnested compositor platform only used the integerwl_output.scaleevent, so on hosts using fractional scaling (e.g. 1.75×) the nested session always rendered at scale 1 — sending undersized, upscaled buffers to the host.What's new?
wp_fractional_scale_manager_v1+wp_viewporterclient support — generated and integrated wayland-scanner client bindings for both protocolsOutputnow creates awp_fractional_scale_v1object; thepreferred_scaleevent (scale asuint32 / 120) updateshost_scale(nowfloat)toplevel_configuresizes the EGL buffer asround(host_scale × logical_size);wp_viewport::set_destinationis used so the host compositor maps the buffer to the correct logical footprintdcout.custom_logical_sizeis set to the host's logical window size (fromxdg_toplevel.configure), whileoutput_sizetracks the physical pixel buffer size separately.view_area()returns the pixel buffer size for the GL renderer'sglViewport, whiledcout.extents()returns the logical size used by the nested compositor for surface placementdcout.scalepropagation — the fractional scale is written toDisplayConfigurationOutput::scaleso the nested session's display configuration reflects the true host scale, and nested clients receive correctwl_output.scaleeventspreferred_scalefires after initialization (e.g. after the first buffer is committed), the EGL surface is recreated at the new pixel size andon_display_config_changedis always triggered on any scale change so all connected clients are updatedwl_output.scalepath is preserved unchangedHow to test
Run a Mir nested session on a HiDPI host configured with a fractional scale (e.g.
scale: 1.75in a GNOME or Mir session):miral-app --wayland-host $WAYLAND_DISPLAYPreviously the nested session rendered at 1× (blurry) and nested clients (e.g. the miral-shell background) had text rendered at proportionally reduced size due to incorrect logical size reporting. With this change:
wl_output.scaleandwp_fractional_scale_v1Checklist