From fe51dbeb268c3674b8c6664e6d57f4e9880ac2f2 Mon Sep 17 00:00:00 2001 From: Michael Sartain Date: Thu, 11 Oct 2012 09:37:38 -0700 Subject: [PATCH] Add XInitThreads to X11_CreateDevice. The nVidia driver requires XInitThreads to be called for it to work in multithreaded mode. Sam also says that the overhead for this is small enough that it should just be done by default at this point. If this causes issues, we can add a hint later to enable / disable this call. --- src/video/x11/SDL_x11sym.h | 1 + src/video/x11/SDL_x11video.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/video/x11/SDL_x11sym.h b/src/video/x11/SDL_x11sym.h index d194df44c..d2b8fc287 100644 --- a/src/video/x11/SDL_x11sym.h +++ b/src/video/x11/SDL_x11sym.h @@ -81,6 +81,7 @@ SDL_X11_SYM(int,XMissingExtension,(Display* a,_Xconst char* b),(a,b),return) SDL_X11_SYM(int,XMoveWindow,(Display* a,Window b,int c,int d),(a,b,c,d),return) SDL_X11_SYM(int,XNextEvent,(Display* a,XEvent* b),(a,b),return) SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return) +SDL_X11_SYM(Status,XInitThreads,(void),(),return) SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return) SDL_X11_SYM(int,XPending,(Display* a),(a),return) SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return) diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index 44fff3159..122023832 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -156,6 +156,10 @@ X11_CreateDevice(int devindex) return NULL; } + // Need for threading gl calls. This is also required for the proprietary nVidia + // driver to be threaded. + XInitThreads(); + /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); if (!device) {