[PATCH v2 2/2] winex11.drv: Fix incorrect frequency for double scan and interlaced modes.

Zhiyi Zhang zzhang at codeweavers.com
Mon Apr 20 03:42:33 CDT 2020


Double scan modes have double the dots to be scanned and interlaced
modes only have half the dots to be scanned.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
v2: Don't add a 0.05 rounding to the frequency value.

 dlls/winex11.drv/xrandr.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c
index bef52128f21..95e4a5d6dba 100644
--- a/dlls/winex11.drv/xrandr.c
+++ b/dlls/winex11.drv/xrandr.c
@@ -482,6 +482,21 @@ static XRRCrtcInfo *xrandr12_get_primary_crtc_info( XRRScreenResources *resource
     return NULL;
 }
 
+static unsigned int get_frequency( const XRRModeInfo *mode )
+{
+    unsigned int dots = mode->hTotal * mode->vTotal;
+
+    if (!dots)
+        return 0;
+
+    if (mode->modeFlags & RR_DoubleScan)
+        dots *= 2;
+    if (mode->modeFlags & RR_Interlace)
+        dots /= 2;
+
+    return (mode->dotClock + dots / 2) / dots;
+}
+
 static int xrandr12_init_modes(void)
 {
     unsigned int only_one_resolution = 1, mode_count;
@@ -540,8 +555,7 @@ static int xrandr12_init_modes(void)
 
             if (mode->id == output_info->modes[i])
             {
-                unsigned int dots = mode->hTotal * mode->vTotal;
-                unsigned int refresh = dots ? (mode->dotClock + dots / 2) / dots : 0;
+                unsigned int refresh = get_frequency( mode );
 
                 TRACE("Adding mode %#lx: %ux%u@%u.\n", mode->id, mode->width, mode->height, refresh);
                 X11DRV_Settings_AddOneMode( mode->width, mode->height, 0, refresh );
-- 
2.20.1



More information about the wine-devel mailing list