[Xquartz-changes] mesa: Branch 'master' - 6 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Tue Jun 14 00:50:47 PDT 2011


Rebased ref, commits from common ancestor:
commit 9e95aa2b7b588e257d1860055fdf0130f5dd2bd7
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jun 13 12:09:47 2011 -0700

    NOT TO ORIGIN: -ggdb3 -O0
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/configs/darwin b/configs/darwin
index 9527f61..e33941b 100644
--- a/configs/darwin
+++ b/configs/darwin
@@ -25,9 +25,9 @@ DEFINES =  -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
 
 ARCH_FLAGS += $(RC_CFLAGS)
 
-CFLAGS =  -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fvisibility=hidden \
+CFLAGS =  -ggdb3 -O0 -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fvisibility=hidden \
 	-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-CXXFLAGS =  -ggdb3 -Os -Wall -fno-strict-aliasing -fvisibility=hidden \
+CXXFLAGS =  -ggdb3 -O0 -Wall -fno-strict-aliasing -fvisibility=hidden \
 	-I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
 
 # Library names (actual file names)
commit 706523f12aa1633614e1d926ac9825a732039c17
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jun 13 11:46:46 2011 -0700

    NOT TO ORIGIN: getpid()
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/src/glx/apple/apple_cgl.c b/src/glx/apple/apple_cgl.c
index 648ed86..9875d08 100644
--- a/src/glx/apple/apple_cgl.c
+++ b/src/glx/apple/apple_cgl.c
@@ -31,6 +31,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <dlfcn.h>
+#include <unistd.h>
 
 #include "apple_cgl.h"
 #include "apple_glx.h"
@@ -69,6 +70,9 @@ apple_cgl_init(void)
    if (initialized)
       return;
 
+   fprintf(stderr, "PID: %d\n", getpid());
+   sleep(20);
+
    opengl_framework_path = getenv("OPENGL_FRAMEWORK_PATH");
    if (!opengl_framework_path) {
       opengl_framework_path = OPENGL_FRAMEWORK_PATH;
commit 7d5ea6ecc15bd3e9bd77ce877b7bc11569a6386d
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jun 13 14:38:23 2011 -0700

    NOT TO ORIGIN: hacks to use make_context_current like we used to
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index ba17535..a25cef3 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -212,7 +212,15 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
 {
    struct glx_context *gc = (struct glx_context *) gc_user;
    struct glx_context *oldGC = __glXGetCurrentContext();
-
+#ifdef GLX_USE_APPLEGL
+   bool error = apple_glx_make_current_context(dpy, 
+                   (oldGC && oldGC != &dummyContext) ? oldGC->driContext : NULL, 
+                   gc ? gc->driContext : NULL, draw);
+   
+   apple_glx_diagnostic("%s: error %s\n", __func__, error ? "YES" : "NO");
+   if(error)
+      return GL_FALSE;
+#else
    /* XXX: If this is left out, then libGL ends up not having this
     * symbol, and drivers using it fail to load.  Compare the
     * implementation of this symbol to _glapi_noop_enable_warnings(),
@@ -242,6 +250,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
    }
 
    _glapi_check_multithread();
+#endif
 
    __glXLock();
    if (oldGC == gc &&
@@ -260,6 +269,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
    }
 
    if (gc) {
+#ifndef GLX_USE_APPLEGL
       /* Attempt to bind the context.  We do this before mucking with
        * gc and __glXSetCurrentContext to properly handle our state in
        * case of an error.
@@ -274,6 +284,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
          __glXGenerateError(dpy, None, GLXBadContext, X_GLXMakeContextCurrent);
          return GL_FALSE;
       }
+#endif
 
       if (gc->thread_refcount++ == 0) {
 	 gc->currentDpy = dpy;
commit 761f073028bf3b07a9ddf2ff1b7ada8d86aaf7fb
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jun 13 21:57:38 2011 -0700

    glx: Destroy the old context only after the new one has been bound
    
    This fixes a regression introduced by 49d7e48b33264d94e30af6129c281b6acafa9427
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 9027734..ba17535 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -256,13 +256,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
 	 oldGC->currentDpy = 0;
 	 oldGC->currentDrawable = None;
 	 oldGC->currentReadable = None;
-
-	 if (oldGC->xid == None && oldGC != gc) {
-	    /* We are switching away from a context that was
-	     * previously destroyed, so we need to free the memory
-	     * for the old handle. */
-	    oldGC->vtable->destroy(oldGC);
-	 }
       }
    }
 
@@ -292,6 +285,13 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
       __glXSetCurrentContextNull();
    }
 
+   if (oldGC->thread_refcount == 0 && oldGC != &dummyContext && oldGC->xid == None) {
+      /* We are switching away from a context that was
+       * previously destroyed, so we need to free the memory
+       * for the old handle. */
+      oldGC->vtable->destroy(oldGC);
+   }
+
    __glXUnlock();
    return GL_TRUE;
 }
commit 58d4a6742aab58072cb93832c050c7728dabbccd
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Jun 13 09:31:21 2011 -0700

    glx: Bind to our context before __glXSetCurrentContext
    
    We want to bind to our context before calling __glXSetCurrentContext or
    messing with the gc rect in order to properly handle error conditions.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index 064fd71..9027734 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -212,7 +212,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
 {
    struct glx_context *gc = (struct glx_context *) gc_user;
    struct glx_context *oldGC = __glXGetCurrentContext();
-   int ret = Success;
 
    /* XXX: If this is left out, then libGL ends up not having this
     * symbol, and drivers using it fail to load.  Compare the
@@ -268,24 +267,32 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
    }
 
    if (gc) {
+      /* Attempt to bind the context.  We do this before mucking with
+       * gc and __glXSetCurrentContext to properly handle our state in
+       * case of an error.
+       *
+       * If an error occurs, set the Null context since we've already
+       * blown away our old context.  The caller is responsible for
+       * figuring out how to handle setting a valid context.
+       */
+      if (gc->vtable->bind(gc, oldGC, draw, read) != Success) {
+         __glXSetCurrentContextNull();
+         __glXUnlock();
+         __glXGenerateError(dpy, None, GLXBadContext, X_GLXMakeContextCurrent);
+         return GL_FALSE;
+      }
+
       if (gc->thread_refcount++ == 0) {
 	 gc->currentDpy = dpy;
 	 gc->currentDrawable = draw;
 	 gc->currentReadable = read;
       }
       __glXSetCurrentContext(gc);
-      ret = gc->vtable->bind(gc, oldGC, draw, read);
    } else {
       __glXSetCurrentContextNull();
    }
 
    __glXUnlock();
-
-   if (ret) {
-      __glXGenerateError(dpy, None, ret, X_GLXMakeContextCurrent);
-      return GL_FALSE;
-   }
-
    return GL_TRUE;
 }
 
commit a128355ecb5b782a69461a04991e4cffb32249db
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Tue Jun 14 00:45:12 2011 -0700

    apple: Set the glapi dispatch table on context bind
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>

diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index 66933f5..0c89f46 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -52,7 +52,7 @@
 struct _glapi_table * __ogl_framework_api = NULL;
 struct _glapi_table * __applegl_api = NULL;
 
-void apple_xgl_init_direct(void) {
+void apple_glapi_set_dispatch(void) {
     static void *handle;
     const char *opengl_framework_path;
 
diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
index a76cb4c..d94c1e0 100644
--- a/src/glx/apple/apple_glx.c
+++ b/src/glx/apple/apple_glx.c
@@ -131,7 +131,6 @@ apple_init_glx(Display * dpy)
    }
 
    apple_cgl_init();
-   apple_xgl_init_direct();
    (void) apple_glx_get_client_id();
 
    XAppleDRISetSurfaceNotifyHandler(surface_notify_handler);
diff --git a/src/glx/apple/apple_glx.h b/src/glx/apple/apple_glx.h
index 25f5ea6..c70fc00 100644
--- a/src/glx/apple/apple_glx.h
+++ b/src/glx/apple/apple_glx.h
@@ -45,6 +45,6 @@ void apple_glx_swap_buffers(void *ptr);
 void apple_glx_waitx(Display * dpy, void *ptr);
 int apple_get_dri_event_base(void);
 
-void apple_xgl_init_direct(void);
+void apple_glapi_set_dispatch(void);
 
 #endif
diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index 92c785f..4bf4672 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -59,6 +59,8 @@ applegl_bind_context(struct glx_context *gc, struct glx_context *old,
    if (error)
       return 1; /* GLXBadContext is the same as Success (0) */
 
+   apple_glapi_set_dispatch();
+
    return Success;
 }
 


More information about the Xquartz-changes mailing list