Mesa (master): glx: Move work of converting a visual to an fbconfig

Ian Romanick idr at kemper.freedesktop.org
Wed Feb 17 19:44:23 UTC 2010


Module: Mesa
Branch: master
Commit: 52cf8db428909156b062f17a9e6251a38178dec3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=52cf8db428909156b062f17a9e6251a38178dec3

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Thu Feb  4 16:59:10 2010 -0800

glx: Move work of converting a visual to an fbconfig

For the direct rendering case, the DRI createContext function wants an
fbconfig.  When glXCreateContext is called, we have to convert the
visual to an fbconfig.  This work was done in CreateContext, but it
makes more sense for it to be done in glXCreateContext.

---

 src/glx/glxcmds.c |   60 +++++++++++++++++++++++++---------------------------
 1 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index b08cad8..1be6ff3 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -387,37 +387,12 @@ CreateContext(Display * dpy, XVisualInfo * vis,
 
 #ifdef GLX_DIRECT_RENDERING
    if (allowDirect && psc->driScreen) {
-      const __GLcontextModes *mode;
-
-      if (fbconfig == NULL) {
-	 mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
-	 if (mode == NULL) {
-	    xError error;
-
-	    error.errorCode = BadValue;
-	    error.resourceID = vis->visualid;
-	    error.sequenceNumber = dpy->request;
-	    error.type = X_Error;
-	    error.majorCode = gc->majorOpcode;
-	    error.minorCode = X_GLXCreateContext;
-	    _XError(dpy, &error);
-	    return None;
-	 }
-	 if (renderType == 0) {
-	    /* Initialize renderType now */
-	    renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
-	 }
-      }
-      else {
-	 mode = fbconfig;
-      }
-
-      gc->driContext = psc->driScreen->createContext(psc, mode, gc, shareList,
-						     renderType);
+      gc->driContext = psc->driScreen->createContext(psc, fbconfig, gc,
+						     shareList, renderType);
       if (gc->driContext != NULL) {
-	 gc->screen = mode->screen;
+	 gc->screen = screen;
 	 gc->psc = psc;
-	 gc->mode = mode;
+	 gc->mode = fbconfig;
 	 gc->isDirect = GL_TRUE;
       }
    }
@@ -497,8 +472,31 @@ PUBLIC GLXContext
 glXCreateContext(Display * dpy, XVisualInfo * vis,
                  GLXContext shareList, Bool allowDirect)
 {
-   return CreateContext(dpy, vis, NULL, shareList, allowDirect,
-                        X_GLXCreateContext, 0, vis->screen);
+   const __GLcontextModes *mode = NULL;
+   int renderType = 0;
+
+#ifdef GLX_DIRECT_RENDERING
+   __GLXscreenConfigs *const psc = GetGLXScreenConfigs(dpy, vis->screen);
+
+   mode = _gl_context_modes_find_visual(psc->visuals, vis->visualid);
+   if (mode == NULL) {
+      xError error;
+
+      error.errorCode = BadValue;
+      error.resourceID = vis->visualid;
+      error.sequenceNumber = dpy->request;
+      error.type = X_Error;
+      error.majorCode = __glXSetupForCommand(dpy);
+      error.minorCode = X_GLXCreateContext;
+      _XError(dpy, &error);
+      return None;
+   }
+
+   renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE;
+#endif
+
+   return CreateContext(dpy, vis, mode, shareList, allowDirect,
+                        X_GLXCreateContext, renderType, vis->screen);
 }
 
 _X_HIDDEN void




More information about the mesa-commit mailing list