More XVidMode fixes

François Gouget fgouget at codeweavers.com
Wed Sep 12 17:37:33 CDT 2001


   I managed to reproduce the XVidMode problem using the XFree86 4.0.3
vesa server (I hope I have the terminology right this time).
   This server returns dotclock=0 and htotal=vtotal=0. But hdisplay and
vdisplay are correct. I assume that the vesa drive simply returns zero
for the values it does not know.
   So I modified the code to simply test for htotal or vtotal being zero
and setting wRefreshRate to zero in such a case (I'm told it's not a
crucial parameter and that we can use the modeline without it). I also
decided against testing for hdisplay and vdisplay having funky values; I
expect the X server to always return valid values for these fields.


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * dlls/x11drv/xvidmode.c
   Check for htotal=vtotal=0 (for xfree 4 vesa driver)


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/x11drv/xvidmode.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xvidmode.c,v
retrieving revision 1.10
diff -u -r1.10 xvidmode.c
--- dlls/x11drv/xvidmode.c	2001/09/11 00:32:33	1.10
+++ dlls/x11drv/xvidmode.c	2001/09/12 18:22:59
@@ -36,7 +36,10 @@
 {
   info->dwWidth      = mode->hdisplay;
   info->dwHeight     = mode->vdisplay;
-  info->wRefreshRate = mode->dotclock * 1000 / (mode->htotal * mode->vtotal);
+  if (mode->htotal!=0 && mode->vtotal!=0)
+      info->wRefreshRate = mode->dotclock * 1000 / (mode->htotal * mode->vtotal);
+  else
+      info->wRefreshRate = 0;
   TRACE(" width=%ld, height=%ld, refresh=%d\n",
         info->dwWidth, info->dwHeight, info->wRefreshRate);
   /* XVidMode cannot change display depths... */
@@ -54,7 +57,10 @@
 {
   info->dwWidth      = mode->hdisplay;
   info->dwHeight     = mode->vdisplay;
-  info->wRefreshRate = dotclock * 1000 / (mode->htotal * mode->vtotal);
+  if (mode->htotal!=0 && mode->vtotal!=0)
+      info->wRefreshRate = dotclock * 1000 / (mode->htotal * mode->vtotal);
+  else
+      info->wRefreshRate = 0;
   TRACE(" width=%ld, height=%ld, refresh=%d\n",
         info->dwWidth, info->dwHeight, info->wRefreshRate);
   /* XVidMode cannot change display depths... */


More information about the wine-patches mailing list