Advertisement
Guest User

bumblebee patch

a guest
Dec 14th, 2014
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.32 KB | None | 0 0
  1. diff --git a/libglfork.cpp b/libglfork.cpp
  2. index 24e952c..b1c7f25 100644
  3. --- a/libglfork.cpp
  4. +++ b/libglfork.cpp
  5. @@ -239,7 +239,6 @@ static struct PrimusInfo {
  6.    // FIXME: there are race conditions in accesses to these
  7.    DrawablesInfo drawables;
  8.    ContextsInfo contexts;
  9. -  GLXFBConfig *dconfigs;
  10.  
  11.    PrimusInfo():
  12.      adpy_str(getconf(PRIMUS_DISPLAY)),
  13. @@ -258,9 +257,13 @@ static struct PrimusInfo {
  14.      die_if(!adpy, "failed to open secondary X display\n");
  15.      die_if(!ddpy, "failed to open main X display\n");
  16.      die_if(!needed_global, "failed to load PRIMUS_LOAD_GLOBAL\n");
  17. +  }
  18. +  GLXFBConfig dconfigs(int i)
  19. +  {
  20.      int ncfg, attrs[] = {GLX_DOUBLEBUFFER, GL_TRUE, None};
  21. +    static GLXFBConfig *
  22.      dconfigs = dfns.glXChooseFBConfig(ddpy, 0, attrs, &ncfg);
  23. -    die_if(!ncfg, "broken GLX on main X display\n");
  24. +    return dconfigs[i];
  25.    }
  26.  } primus;
  27.  
  28. @@ -343,7 +346,7 @@ static bool test_drawpixels_fast(Display *dpy, GLXContext ctx)
  29.  {
  30.    int width = 1920, height = 1080;
  31.    int pbattrs[] = {GLX_PBUFFER_WIDTH, width, GLX_PBUFFER_HEIGHT, height, GLX_PRESERVED_CONTENTS, True, None};
  32. -  GLXPbuffer pbuffer = primus.dfns.glXCreatePbuffer(dpy, primus.dconfigs[0], pbattrs);
  33. +  GLXPbuffer pbuffer = primus.dfns.glXCreatePbuffer(dpy, primus.dconfigs(0), pbattrs);
  34.    primus.dfns.glXMakeCurrent(dpy, pbuffer, ctx);
  35.    GLuint pbo;
  36.    primus.dfns.glGenBuffers(1, &pbo);
  37. @@ -385,7 +388,7 @@ static void* display_work(void *vd)
  38.    XSelectInput(ddpy, di.window, StructureNotifyMask);
  39.    note_geometry(ddpy, di.window, &width, &height);
  40.    di.update_geometry(width, height);
  41. -  GLXContext context = primus.dfns.glXCreateNewContext(ddpy, primus.dconfigs[0], GLX_RGBA_TYPE, NULL, True);
  42. +  GLXContext context = primus.dfns.glXCreateNewContext(ddpy, primus.dconfigs(0), GLX_RGBA_TYPE, NULL, True);
  43.    die_if(!primus.dfns.glXIsDirect(ddpy, context),
  44.      "failed to acquire direct rendering context for display thread\n");
  45.    if (!primus.dispmethod)
  46. @@ -728,7 +731,7 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
  47.  
  48.  GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
  49.  {
  50. -  GLXWindow glxwin = primus.dfns.glXCreateWindow(dpy, primus.dconfigs[0], win, attribList);
  51. +  GLXWindow glxwin = primus.dfns.glXCreateWindow(dpy, primus.dconfigs(0), win, attribList);
  52.    DrawableInfo &di = primus.drawables[glxwin];
  53.    di.kind = di.Window;
  54.    di.fbconfig = config;
  55. @@ -753,7 +756,7 @@ void glXDestroyWindow(Display *dpy, GLXWindow window)
  56.  
  57.  GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
  58.  {
  59. -  GLXPbuffer pbuffer = primus.dfns.glXCreatePbuffer(dpy, primus.dconfigs[0], attribList);
  60. +  GLXPbuffer pbuffer = primus.dfns.glXCreatePbuffer(dpy, primus.dconfigs(0), attribList);
  61.    DrawableInfo &di = primus.drawables[pbuffer];
  62.    di.kind = di.Pbuffer;
  63.    di.fbconfig = config;
  64. @@ -774,7 +777,7 @@ void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
  65.  
  66.  GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
  67.  {
  68. -  GLXPixmap glxpix = primus.dfns.glXCreatePixmap(dpy, primus.dconfigs[0], pixmap, attribList);
  69. +  GLXPixmap glxpix = primus.dfns.glXCreatePixmap(dpy, primus.dconfigs(0), pixmap, attribList);
  70.    DrawableInfo &di = primus.drawables[glxpix];
  71.    di.kind = di.Pixmap;
  72.    di.fbconfig = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement