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.
This commit is contained in:
Michael Sartain 2012-10-11 09:37:38 -07:00
parent 195b20e40e
commit 2538e2af2f
2 changed files with 5 additions and 0 deletions

View file

@ -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)

View file

@ -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) {