]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-utils: Adjust HiDPI cut-off value to 1.625f
authorJanne Grunau <j@jannau.net>
Sat, 17 May 2025 16:20:30 +0000 (18:20 +0200)
committerHans de Goede <hansg@kernel.org>
Thu, 3 Jul 2025 13:04:17 +0000 (15:04 +0200)
This matches mutter's behaviour before
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3616 was merged.
It first rounded to the newest fractional scale factor (in 0.25 steps)
and then rounded N.25 and N.5 down to N and N.75 up to N+1.

Commit 3b8e9184 ("ply-utils: Only choose scale 2 when the perfect scale
would be >= 1.75") interprets the mentioned difference of at most 0.25
for rounding up very literal. A differnt ionterpretation of
https://github.com/GNOME/mutter/commit/d03dce43786ddfaca86a0ec006264c1b0dfd74d9
intend is that it's desireable to round N.5 down.

This change has unexpected side effect of using a device scale of 1 for
most of Apple's Retina displays in Macbooks (221 - 227 DPI). Raised as
https://gitlab.gnome.org/GNOME/mutter/-/issues/4110 in mutter.

Using 1.75f cut-off value requires a pixel density of 236.25 for HiDPI
while 1.625f requires only 219.375 DPI.

Mutter use the same calculation with
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4490 merged.

Signed-off-by: Janne Grunau <j@jannau.net>
src/libply/ply-utils.c

index 782fadd87a4aedc91bcee1bcb8856fb0209aaf4a..13d1f204f98fe50b48cc01d6ccb596c6ad654ff1 100644 (file)
@@ -1086,7 +1086,7 @@ get_device_scale (uint32_t width,
         target_dpi = (diag_inches >= 20.f) ? 110 : 135;
 
         perfect_scale = physical_dpi / target_dpi;
-        device_scale = (perfect_scale >= 1.75f) ? 2 : 1;
+        device_scale = (perfect_scale > 1.625f) ? 2 : 1;
 
         return device_scale;
 }