Alexandre Julliard : winex11.drv: Added a check for the ATI driver corrupting %fs.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 14 15:30:22 CST 2007


Module: wine
Branch: master
Commit: 5fce682f41e43539a1c1cdae18990ccb959a8fd4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5fce682f41e43539a1c1cdae18990ccb959a8fd4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Feb 14 18:18:07 2007 +0100

winex11.drv: Added a check for the ATI driver corrupting %fs.

Based on a patch by Lei Zhang.

---

 dlls/winex11.drv/opengl.c |   10 +++++++++-
 include/wine/library.h    |    2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index ac0c8ba..dbbd972 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -292,8 +292,17 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void)
     template.visualid = XVisualIDFromVisual(visual);
     vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
     if (vis) {
+        WORD old_fs = wine_get_fs();
         /* Create a GLX Context. Without one we can't query GL information */
         ctx = pglXCreateContext(gdi_display, vis, None, GL_TRUE);
+        if (wine_get_fs() != old_fs)
+        {
+            wine_set_fs( old_fs );
+            wine_tsx11_unlock();
+            ERR( "%%fs register corrupted, probably broken ATI driver, disabling OpenGL.\n" );
+            ERR( "You need to set the \"UseFastTls\" option to \"2\" in your X config file.\n" );
+            return FALSE;
+        }
     }
 
     if (ctx) {
@@ -411,7 +420,6 @@ LOAD_FUNCPTR(glXFreeMemoryNV)
 #undef LOAD_FUNCPTR
 
     if(!X11DRV_WineGL_InitOpenglInfo()) {
-        ERR("Intialization of OpenGL info failed, disabling OpenGL!\n");
         wine_dlclose(opengl_handle, NULL, 0);
         opengl_handle = NULL;
         return FALSE;
diff --git a/include/wine/library.h b/include/wine/library.h
index cbaa026..a1845cd 100644
--- a/include/wine/library.h
+++ b/include/wine/library.h
@@ -177,7 +177,7 @@ inline static int wine_ldt_is_empty( const LDT_ENTRY *ent )
 #  define __DEFINE_GET_SEG(seg) \
     extern inline unsigned short wine_get_##seg(void); \
     extern inline unsigned short wine_get_##seg(void) \
-    { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
+    { unsigned short res; __asm__ __volatile__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
 #  define __DEFINE_SET_SEG(seg) \
     extern inline void wine_set_##seg(int val); \
     extern inline void wine_set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }




More information about the wine-cvs mailing list