summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Plattner <aplattner@nvidia.com>2013-02-06 11:13:06 -0800
committerAaron Plattner <aplattner@nvidia.com>2013-02-12 12:29:37 -0800
commit7fd4f18b649f22fad4dbf9fc64b69b3e7f172207 (patch)
tree1e0ee6947b5461bbf8b71d0f909575e3c5ca7c2a
parentd752d524027fbc20d9fdee06fed173e454f15370 (diff)
Bug #37043: adjust refresh rates for doublescan and interlace
These two flags halve and double, respectively, the effective refresh rate of a mode. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Daniel Dadap <ddadap@nvidia.com>
-rw-r--r--xrandr.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/xrandr.c b/xrandr.c
index a5a9fd0..7fb0b0b 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -541,10 +541,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;