Module: wine Branch: master Commit: fb69b6aeb23c5fad851047c10f0e81fb75c7e1d7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=fb69b6aeb23c5fad851047c10...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Mon Apr 20 16:42:33 2020 +0800
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 zzhang@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 bef52128f2..95e4a5d6db 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 );