[mutter] backends: Add some wiggle room for refresh rate comparisons



commit 743e8cc249168ccc64073ab83c00c31a30ca22e7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Sep 14 12:42:47 2017 +0200

    backends: Add some wiggle room for refresh rate comparisons
    
    We have not enough control over the sources of the refresh rate
    float variable to make == comparisons reliable, add some room
    when comparing these.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787668

 src/backends/meta-monitor.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index e3595fc..70350c3 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -32,6 +32,7 @@
 #define MAXIMUM_SCALE_FACTOR 4.0f
 #define MINIMUM_LOGICAL_WIDTH 800
 #define MINIMUM_LOGICAL_HEIGHT 600
+#define MAXIMUM_REFRESH_RATE_DIFF 0.001
 
 #define HANDLED_CRTC_MODE_FLAGS (META_CRTC_MODE_FLAG_INTERLACE)
 
@@ -1252,8 +1253,8 @@ meta_monitor_mode_spec_equals (MetaMonitorModeSpec *monitor_mode_spec,
 {
   return (monitor_mode_spec->width == other_monitor_mode_spec->width &&
           monitor_mode_spec->height == other_monitor_mode_spec->height &&
-          (monitor_mode_spec->refresh_rate ==
-           other_monitor_mode_spec->refresh_rate) &&
+          ABS (monitor_mode_spec->refresh_rate -
+               other_monitor_mode_spec->refresh_rate) < MAXIMUM_REFRESH_RATE_DIFF &&
           monitor_mode_spec->flags == other_monitor_mode_spec->flags);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]