[PATCH xrandr 2/5] Bug #37043: adjust refresh rates for doublescan and interlace

Aaron Plattner aplattner at nvidia.com
Wed Feb 6 14:38:33 PST 2013


These two flags halve and double, respectively, the effective refresh rate of a
mode.

Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
---
 xrandr.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index b0e8cec..54e0ca8 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -530,10 +530,22 @@ static double
 mode_refresh (XRRModeInfo *mode_info)
 {
     double rate;
+    unsigned int vTotal = mode_info->vTotal;
+
+    if (mode_info->modeFlags & RR_DoubleScan) {
+	/* doublescan doubles the number of lines */
+	vTotal *= 2;
+    }
+
+    if (mode_info->modeFlags & RR_Interlace) {
+	/* interlace splits the frame into two fields */
+	/* the field rate is what is typically reported by monitors */
+	vTotal /= 2;
+    }
     
-    if (mode_info->hTotal && mode_info->vTotal)
+    if (mode_info->hTotal && vTotal)
 	rate = ((double) mode_info->dotClock /
-		((double) mode_info->hTotal * (double) mode_info->vTotal));
+		((double) mode_info->hTotal * (double) vTotal));
     else
     	rate = 0;
     return rate;
-- 
1.7.12



More information about the xorg-devel mailing list