From fb69b6aeb23c5fad851047c10f0e81fb75c7e1d7 Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Mon, 20 Apr 2020 16:42:33 +0800 Subject: [PATCH] winex11.drv: Fix incorrect frequency for double scan and interlaced modes. 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 Signed-off-by: Alexandre Julliard --- 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 );