Skip to content

Implement physical pixel rounding of Wayland surfaces for compliance with fractional-scale-v1

msizanoen1 requested to merge msizanoen1/mutter:surface-pixel-align-sep into main

Implement toplevel surface rounding as required by fractional-scale-v1. Properly rounded toplevel surfaces is the minimum requirement for pixel-perfect rendering with the fractional scaling protocol.

Additionally, implement the "stable rounding" mechanism for Wayland subsurface positions and sizes as described in Appendix A.

/cc @rmader @jadahl

Appendix A: The Stable Rounding Algorithm for Subsurfaces (from https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/143#note_1343171)

  1. Parent position independent subsurface position rounding: Scale and round subsurface positions and add the scaled and rounded parent position afterwards (pos = round(subsurface_pos * scale) + round(parent_pos * scale), making subsurface position rounding independent of the position of its parent.
  2. Subsurface position dependent subsurface dimension rounding: Scale and round subsurface dimensions after adding the position, then substracting the position in both compositor and client (size = round((subsurface_size + subsurface_pos) * scale) - round(subsurface_pos * scale).

Merge request reports

Loading