Option to disable XVidMode

François Gouget fgouget at codeweavers.com
Fri Sep 7 22:29:25 CDT 2001


   I had a report of a crash and it turned out to happen during the
XVidMode initialization.
What happened is that for some unknown reason XF86VidModeGetAllModeLines
returned a single mode with a width and/or height of zero
(htotal/vtotal). This caused a division by zero in convert_modeline.
   As a first step I propose to add an option to disable XVidMode
support in Wine just like we have for DGA and Shm. Note that if this
option is missing from the configuration file, then XVidMode support
will be disabled (like for DGA and Shm). So people using XVidMode will
need to update their configuration file.
   Then will come the work of trying to reproduce the problem and see
how best to deal with this server (XFree86-SVGA 4.1.0 apparently).

Changelog:

   François Gouget <fgouget at codeweavers.com>

 * documentation/samples/config,
   dlls/x11drv/x11drv_main.c,
   dlls/x11drv/xvidmode.c
   Add an option to disable XVidMode support

-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: documentation/samples/config
===================================================================
RCS file: /home/wine/wine/documentation/samples/config,v
retrieving revision 1.13
diff -u -r1.13 config
--- documentation/samples/config	2001/06/26 21:06:08	1.13
+++ documentation/samples/config	2001/09/08 01:37:58
@@ -124,6 +124,8 @@
 "UseDGA" = "Y"
 ; Use XShm extension if present
 "UseXShm" = "Y"
+; Use XVidMode extension if present
+"UseXVidMode" = "Y"
 ; Enable DirectX mouse grab
 "DXGrab" = "N"
 ; Create the desktop window with a double-buffered visual
Index: dlls/x11drv/x11drv_main.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/x11drv_main.c,v
retrieving revision 1.43
diff -u -r1.43 x11drv_main.c
--- dlls/x11drv/x11drv_main.c	2001/08/16 18:12:56	1.43
+++ dlls/x11drv/x11drv_main.c	2001/09/08 01:37:57
@@ -55,7 +55,7 @@
 unsigned int screen_height;
 unsigned int screen_depth;
 Window root_window;
-int dxgrab, usedga;
+int dxgrab, usedga, usexvidmode;
 
 unsigned int X11DRV_server_startticks;
 
@@ -218,6 +218,9 @@
 
     if (!get_config_key( hkey, appkey, "UseDGA", buffer, sizeof(buffer) ))
         usedga = IS_OPTION_TRUE( buffer[0] );
+
+    if (!get_config_key( hkey, appkey, "UseXVidMode", buffer, sizeof(buffer) ))
+        usexvidmode = IS_OPTION_TRUE( buffer[0] );
 
     screen_depth = 0;
     if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
Index: dlls/x11drv/xvidmode.c
===================================================================
RCS file: /home/wine/wine/dlls/x11drv/xvidmode.c,v
retrieving revision 1.8
diff -u -r1.8 xvidmode.c
--- dlls/x11drv/xvidmode.c	2001/08/09 21:36:39	1.8
+++ dlls/x11drv/xvidmode.c	2001/09/08 01:37:58
@@ -24,6 +24,8 @@
 
 #ifdef HAVE_LIBXXF86VM
 
+extern int usexvidmode;
+
 static int xf86vm_event, xf86vm_error, xf86vm_major, xf86vm_minor;
 
 LPDDHALMODEINFO xf86vm_modes;
@@ -62,12 +64,14 @@
 
   if (xf86vm_major) return; /* already initialized? */
 
+  /* if in desktop mode, don't use XVidMode */
+  if (root_window != DefaultRootWindow(gdi_display)) return;
+
+  if (!usexvidmode) return;
+
   /* see if XVidMode is available */
   if (!TSXF86VidModeQueryExtension(gdi_display, &xf86vm_event, &xf86vm_error)) return;
   if (!TSXF86VidModeQueryVersion(gdi_display, &xf86vm_major, &xf86vm_minor)) return;
-
-  /* if in desktop mode, don't use XVidMode */
-  if (root_window != DefaultRootWindow(gdi_display)) return;
 
   /* retrieve modes */
   if (!TSXF86VidModeGetAllModeLines(gdi_display, DefaultScreen(gdi_display), &nmodes,


More information about the wine-patches mailing list