I finally have access to an x86 SMP box, and I have a few cycles to look at the SMP related problems. I'm using an AGP G400 and quake3-smp. Like Dieter, I get a black screen and a hung program. When I break in with GDB, here is the stack trace. Dieter, does this match what you see?
That problem appears to have been a simple deadlock. The LockDisplay / UnlockDisplay calls were not balanced in various paths through MakeContextCurrent. The attached patch fixes that problem. I still hit other problems on MGA, but they *appear* to be MGA specific.
Dieter: Could you try this patch on R200 and let me know if it helps. I'll keep working on the other issues.
? lib/GL/glx/Doxyfile
? lib/GL/glx/foo
Index: lib/GL/glx/glxext.c
===================================================================
RCS file: /cvs/dri/xc/xc/lib/GL/glx/glxext.c,v
retrieving revision 1.41
diff -u -d -r1.41 glxext.c
--- a/lib/GL/glx/glxext.c 14 Apr 2004 01:28:45 -0000 1.41
+++ b/lib/GL/glx/glxext.c 15 Apr 2004 21:43:31 -0000
@@ -1406,17 +1406,25 @@
GLXContextID gc, GLXContextTag old_gc, GLXDrawable draw, GLXDrawable read,
xGLXMakeCurrentReply * reply );
+/**
+ * Sends a GLX protocol message to the specified display to make the context
+ * and the drawables current.
+ *
+ * \param dpy Display to send the message to.
+ * \param opcode Major opcode value for the display.
+ * \param gc_id Context tag for the context to be made current.
+ * \param draw Drawable ID for the "draw" drawable.
+ * \param read Drawable ID for the "read" drawable.
+ * \param reply Space to store the X-server's reply.
+ *
+ * \warning
+ * This function assumes that \c dpy is locked with \c LockDisplay on entry.
+ */
static Bool SendMakeCurrentRequest( Display *dpy, CARD8 opcode,
GLXContextID gc_id, GLXContextTag gc_tag,
GLXDrawable draw, GLXDrawable read,
xGLXMakeCurrentReply * reply )
{
- opcode = __glXSetupForCommand(dpy);
- if (!opcode) {
- return GL_FALSE;
- }
-
- LockDisplay(dpy);
if ( draw == read ) {
xGLXMakeCurrentReq *req;
@@ -1541,11 +1549,12 @@
** unbind the previous context.
*/
sentRequestToOldDpy = True;
+ LockDisplay(oldGC->currentDpy);
if ( ! SendMakeCurrentRequest( oldGC->currentDpy, oldOpcode, None,
oldGC->currentContextTag, None, None,
&reply ) ) {
/* The make current failed. Just return GL_FALSE. */
- UnlockDisplay(dpy);
+ UnlockDisplay(oldGC->currentDpy);
SyncHandle();
return GL_FALSE;
}
@@ -1580,6 +1589,7 @@
gc ? gc->xid : None,
oldGC->currentContextTag,
draw, read, &reply );
+ UnlockDisplay(dpy);
#ifdef GLX_DIRECT_RENDERING
}
#endif
@@ -1622,7 +1632,7 @@
oldGC->xid, 0,
oldGC->currentDrawable,
oldGC->currentReadable, &reply ) ) {
- UnlockDisplay(dpy);
+ UnlockDisplay(oldGC->currentDpy);
SyncHandle();
/*
** The request failed; this cannot happen with the
@@ -1634,7 +1644,7 @@
*/
}
else {
- UnlockDisplay(dpy);
+ UnlockDisplay(oldGC->currentDpy);
}
oldGC->currentContextTag = reply.contextTag;
}
