glapi: drop SOLARIS_THREADS
[mesa.git] / src / glx / glxcmds.c
index 1be6ff397946d51166e620cb1c89f5cf93500313..4fbc6b6ab21b8dbfd1e3712f30dadc118c5236f3 100644 (file)
@@ -110,10 +110,6 @@ GarbageCollectDRIDrawables(Display * dpy, __GLXscreenConfigs * sc)
    XSetErrorHandler(oldXErrorHandler);
 }
 
-extern __GLXDRIdrawable *GetGLXDRIDrawable(Display * dpy,
-                                           GLXDrawable drawable,
-                                           int *const scrn_num);
-
 /**
  * Get the __DRIdrawable for the drawable associated with a GLXContext
  *
@@ -362,7 +358,7 @@ AllocateGLXContext(Display * dpy)
  */
 
 static GLXContext
-CreateContext(Display * dpy, XVisualInfo * vis,
+CreateContext(Display * dpy, int generic_id,
               const __GLcontextModes * const fbconfig,
               GLXContext shareList,
               Bool allowDirect,
@@ -371,18 +367,16 @@ CreateContext(Display * dpy, XVisualInfo * vis,
    GLXContext gc;
 #ifdef GLX_DIRECT_RENDERING
    __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
-#else
-   (void) screen;
 #endif
 
    if (dpy == NULL)
       return NULL;
 
-   gc = AllocateGLXContext(dpy);
-   if (!gc)
+   if (generic_id == None)
       return NULL;
 
-   if ((vis == NULL) && (fbconfig == NULL))
+   gc = AllocateGLXContext(dpy);
+   if (!gc)
       return NULL;
 
 #ifdef GLX_DIRECT_RENDERING
@@ -408,8 +402,8 @@ CreateContext(Display * dpy, XVisualInfo * vis,
       req->reqType = gc->majorOpcode;
       req->glxCode = X_GLXCreateContext;
       req->context = gc->xid = XAllocID(dpy);
-      req->visual = vis->visualid;
-      req->screen = vis->screen;
+      req->visual = generic_id;
+      req->screen = screen;
       req->shareList = shareList ? shareList->xid : None;
       req->isDirect = GC_IS_DIRECT(gc);
       break;
@@ -423,8 +417,8 @@ CreateContext(Display * dpy, XVisualInfo * vis,
       req->reqType = gc->majorOpcode;
       req->glxCode = X_GLXCreateNewContext;
       req->context = gc->xid = XAllocID(dpy);
-      req->fbconfig = fbconfig->fbconfigID;
-      req->screen = fbconfig->screen;
+      req->fbconfig = generic_id;
+      req->screen = screen;
       req->renderType = renderType;
       req->shareList = shareList ? shareList->xid : None;
       req->isDirect = GC_IS_DIRECT(gc);
@@ -444,8 +438,8 @@ CreateContext(Display * dpy, XVisualInfo * vis,
       req->glxCode = X_GLXVendorPrivateWithReply;
       req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX;
       req->context = gc->xid = XAllocID(dpy);
-      req->fbconfig = fbconfig->fbconfigID;
-      req->screen = fbconfig->screen;
+      req->fbconfig = generic_id;
+      req->screen = screen;
       req->renderType = renderType;
       req->shareList = shareList ? shareList->xid : None;
       req->isDirect = GC_IS_DIRECT(gc);
@@ -495,7 +489,7 @@ glXCreateContext(Display * dpy, XVisualInfo * vis,
    renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
 #endif
 
-   return CreateContext(dpy, vis, mode, shareList, allowDirect,
+   return CreateContext(dpy, vis->visualid, mode, shareList, allowDirect,
                         X_GLXCreateContext, renderType, vis->screen);
 }
 
@@ -1801,7 +1795,7 @@ glXCreateNewContext(Display * dpy, GLXFBConfig config,
    const __GLcontextModes *const fbconfig =
       (const __GLcontextModes *const) config;
 
-   return CreateContext(dpy, NULL, fbconfig, shareList,
+   return CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList,
                         allowDirect, X_GLXCreateNewContext, renderType,
                        fbconfig->screen);
 }
@@ -2290,7 +2284,7 @@ glXCreateContextWithConfigSGIX(Display * dpy,
    psc = GetGLXScreenConfigs(dpy, fbconfig->screen);
    if ((psc != NULL)
        && __glXExtensionBitIsEnabled(psc, SGIX_fbconfig_bit)) {
-      gc = CreateContext(dpy, NULL, (__GLcontextModes *) config, shareList,
+      gc = CreateContext(dpy, fbconfig->fbconfigID, fbconfig, shareList,
                          allowDirect,
                         X_GLXvop_CreateContextWithConfigSGIX, renderType,
                         fbconfig->screen);
@@ -2370,7 +2364,7 @@ __glXGetSyncValuesOML(Display * dpy, GLXDrawable drawable,
    psc = &priv->screenConfigs[i];
 
 #if defined(__DRI_SWAP_BUFFER_COUNTER) && defined(__DRI_MEDIA_STREAM_COUNTER)
-   if (pdraw && psc->sbc && psc->sbc)
+   if (pdraw && psc->sbc && psc->msc)
       return ( (pdraw && psc->sbc && psc->msc)
               && ((*psc->msc->getMSC)(psc->driScreen, msc) == 0)
               && ((*psc->sbc->getSBC)(pdraw->driDrawable, sbc) == 0)
@@ -2500,7 +2494,7 @@ __glXSwapBuffersMscOML(Display * dpy, GLXDrawable drawable,
    __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, &screen);
    __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, screen);
 
-   if (!pdraw || !gc->driContext) /* no GLX for this */
+   if (!pdraw || !gc || !gc->driContext) /* no GLX for this */
       return -1;
 
    /* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
@@ -2600,7 +2594,7 @@ __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
       return ((ret == 0) && (__glXGetUST(ust) == 0));
    }
 #endif
-   if (pdraw && psc->driScreen && psc->driScreen->waitForMSC) {
+   if (pdraw && psc->driScreen && psc->driScreen->waitForSBC) {
       ret = psc->driScreen->waitForSBC(pdraw, target_sbc, ust, msc, sbc);
       return ret;
    }