Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Add XInitThreads to X11_CreateDevice.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Michael Sartain committed Oct 11, 2012
1 parent 8919996 commit fe51dbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/video/x11/SDL_x11sym.h
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -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) {
Expand Down

0 comments on commit fe51dbe

Please sign in to comment.