xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Sat Feb 21 23:35:30 PST 2009


 hw/xquartz/GL/indirect.c |   43 +++++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

New commits:
commit 61abf3189f3f97ec5228d45c035dbfd0c249f844
Author: George Staplin <gstaplin at apple.com>
Date:   Sat Feb 21 22:33:10 2009 -0700

    XQuartz: GL: Change from xalloc to xcalloc to potentially avoid
    uninitialized data in the __GLXAquaContext.
    (cherry picked from commit d3120241f9f48d21f9a6ecfb848434a4a0270855)

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index e71516a..9b54b0c 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -167,7 +167,7 @@ __glXAquaScreenCreateContext(__GLXscreen *screen,
   
     GLAQUA_DEBUG_MSG("glXAquaScreenCreateContext\n");
     
-    context = xalloc (sizeof (__GLXAquaContext));
+    context = xcalloc(1, sizeof (__GLXAquaContext));
     
     if (context == NULL)
 	return NULL;
commit 5587f9b771f5b5427a81d4d657f403667d20f310
Author: George Staplin <gstaplin at apple.com>
Date:   Sat Feb 21 22:22:52 2009 -0700

    XQuartz: GL: Fix a bug with an uninitialized GLX data structure.
    
    This was causing a crash randomly, due to random memory contents.
    Use xcalloc to prevent this in the future, due to future changes or mistakes.
    
    Set the drawableType to include GLX_PIXMAP_BIT and GLX_PBUFFER_BIT.
    The new libGL supports these.
    
    Set the max Pbuffer width/height, based on the results of a test program.
    We may someday want to revisit this depending on what users need, so that
    we create a CGLContextObj, make it current, and call glGetIntegerv to
    gather the information at runtime.
    (cherry picked from commit c7e338330943e0d03a99328c740540d03f018d20)

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 0a60672..e71516a 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -648,21 +648,37 @@ static __GLXconfig *CreateConfigs(int *numConfigsPtr, int screenNumber) {
 					    c->samples = conf->multisample_samples;
 					}
 
+					/* 
+					 * The Apple libGL supports GLXPixmaps and 
+					 * GLXPbuffers in direct mode.
+					 */
 					/* SGIX_fbconfig / GLX 1.3 */
-					c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT;
+					c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT
+					    | GLX_PBUFFER_BIT;
 					c->renderType = GLX_RGBA_BIT;
 					c->xRenderable = GL_TRUE;
 					c->fbconfigID = -1;
 					
-					/*TODO add querying code to capabilities.c for the Pbuffer maximums.
-					 *I'm not sure we can even use CGL for Pbuffers yet...
-					 */
 					/* SGIX_pbuffer / GLX 1.3 */
-					c->maxPbufferWidth = 0;
-					c->maxPbufferHeight = 0;
-					c->maxPbufferPixels = 0;
+					
+					/* 
+					 * The CGL layer provides a way of retrieving
+					 * the maximum pbuffer width/height, but only
+					 * if we create a context and call glGetIntegerv.
+					 * 
+					 * The following values are from a test program
+					 * that does so.
+					 */
+					c->maxPbufferWidth = 8192;
+					c->maxPbufferHeight = 8192;
+					c->maxPbufferPixels = /*Do we need this?*/ 0;
+					/* 
+					 * There is no introspection for this sort of thing
+					 * with CGL.  What should we do realistically?
+					 */
 					c->optimalPbufferWidth = 0;
 					c->optimalPbufferHeight = 0;
+					
 					c->visualSelectGroup = 0;
 					
 					c->swapMethod = GLX_SWAP_UNDEFINED_OML;
@@ -708,7 +724,8 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
     if (pScreen == NULL) 
 	return NULL;
 
-    screen = xalloc(sizeof *screen);
+    screen = xcalloc(1, sizeof *screen);
+
     if(NULL == screen)
 	return NULL;
     
@@ -723,11 +740,13 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
     screen->base.fbconfigs = CreateConfigs(&screen->base.numFBConfigs, 
 					   pScreen->myNum);
     
+    /* This is set by __glXScreenInit: */
+    screen->base.visuals = NULL;
+    /* This is to be initialized prior to the call to __glXScreenInit: */
+    screen->base.numVisuals = 0;
+
     __glXScreenInit(&screen->base, pScreen);
 
-    /* __glXScreenInit initializes these, so the order here is important, if we need these... */
-    //  screen->base.GLextensions = "";
-    // screen->base.GLXvendor = "Apple";
     screen->base.GLXversion = xstrdup("1.4");
     screen->base.GLXextensions = xstrdup("GLX_SGIX_fbconfig "
 					 "GLX_SGIS_multisample "


More information about the xorg-commit mailing list