tracy icon indicating copy to clipboard operation
tracy copied to clipboard

Fix and update Wayland scale handling

Open YaLTeR opened this issue 5 months ago • 4 comments

Right now Tracy uses the maximum scale across all advertised outputs. If you're on a mixed-DPI system, you get 2x-scaled Tracy on your 1x-scaled monitor, which looks a bit blurry.

This PR fixes and updates the scale handling:

  1. Changes Tracy to use the maximum scale across all outputs that the Tracy surface is actually displaying on, rather than all advertised outputs.
    • This necessitated adding a way to dynamically change the scale, since the surface can move between differently-scaled outputs.
    • Behavior with TRACY_DPI_SCALE set was preserved.
  2. With wl_compositor v6, instead of the output scale guesswork, Tracy will use the scale explicitly requested for the surface by the compositor. The compositor can generally make a better decision here, and this also makes the scale correct right from the very first frame drawn by Tracy, if the compositor sends the preferred scale before the surface is mapped.

I tested it on:

  • sway for wl_compositor < 6
  • mutter for wl_compositor < 6
  • my own compositor for wl_compositor = 6 which sends the preferred scale right away

There's still an issue that Tracy doesn't ensure that its buffer is divisible by the scale, which results in it getting killed if that happens. However, it was already present before this PR, so nothing really changes here.

YaLTeR avatar Jan 24 '24 08:01 YaLTeR