[PATCH 2/2] xrandr: Use floating point for VTotal when calculating refresh rate

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri May 31 07:01:54 PDT 2013

From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Interlaced modes generally have an odd VTotal, so we lose half a line
from VTotal when we divide by two. That causes the final refresh rate
to be slightly off. Make VTotal a double to avoid the problem.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
 xrandr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xrandr.c b/xrandr.c
index 9467c29..f94cfab 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -541,7 +541,7 @@ static double
 mode_refresh (XRRModeInfo *mode_info)
     double rate;
-    unsigned int vTotal = mode_info->vTotal;
+    double vTotal = mode_info->vTotal;
     if (mode_info->modeFlags & RR_DoubleScan) {
 	/* doublescan doubles the number of lines */

More information about the xorg-devel mailing list