glXImportContextEXT / parallel rendering
Joachim Schöberl <[email protected]>
| Newsgroups | gmane.comp.video.mesa3d.user |
|---|---|
| Message-ID | <[email protected]> |
Hello OpenGL / Mesa experts, I am facing difficulties with glXImportContextEXT. I want to do parallel rendering from a Linux cluster using shared display lists. The master shall create the GLXContext, and the slaves should contribute display lists via shared contextes generated by glXImportContextEXT. Works fine on the local machine, but I get crashes from remote access from our university super computer. Unfortunately, the linux distribution on the big machine includes the rather old mesa 6.5, and that's out of my hands. I have attached two simple codes, master and slave (not doing real stuff, but reproducing the crashes). Running master locally I get: test/opengl> master -indirect master: displname = :0 master: extensionstring = GLX_EXT_visual_info GLX_EXT_visual_rating GLX_SGIX_fbconfig GLX_SGIX_pbuffer GLX_SGI_video_sync GLX_SGI_swap_control GLX_EXT_swap_control GLX_EXT_texture_from_pixmap GLX_ARB_create_context GLX_ARB_create_context_profile GLX_ARB_multisample GLX_NV_float_buffer GLX_ARB_fbconfig_float GLX_NV_swap_group GLX_EXT_framebuffer_sRGB GLX_NV_multisample_coverage GLX_NV_copy_image GLX_NV_video_capture GLX_ARB_get_proc_address ********** please enter these values for slave ********** master: drawable = 56623106 master: contextid = 56623107 ********************************************************** starting the slave from the linux cluster (connected via ssh -Y ..) I get: [jschoebe@n67 test]$ ./slave displname = localhost:12.0 ************ take values from master ********* drawable = 56623106 contextid = 56623107 display = 0x503010 window-props: x = 0, y = 0, w = 400, h = 500, depth = 24, root-win = 627 extensionstring = GLX_ARB_get_proc_address GLX_ARB_multisample GLX_EXT_import_context GLX_EXT_visual_info GLX_EXT_visual_rating GLX_SGI_make_current_read GLX_SGI_swap_control GLX_SGI_video_sync GLX_SGIX_fbconfig GLX_SGIX_pbuffer found VISINFO !!! attribs = 1 4 8 8 9 8 10 8 12 1 visid = 41 screen = 0 depth = 24 class = 4 rgb mask = 16711680/65280/255 bits_per_rgb = 11 now, import glxcontext ... Xlib: sequence lost (0x10000 > 0x11) in reply type 0x11! Running slave on the local network, I can create the shared glxcontext. Who can tell me what I have done wrong, or what kind of workaround I need ? thanks a lot, Joachim PS: My application is Netgen http://sourceforge.net/projects/netgen-mesher/ _______________________________________________ mesa-users mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-users
slave.cpp
(text/x-c++src, 3 KB)
// c++ slave.cpp -lGL -o slave
#include <iostream>
using namespace std;
#include <stdlib.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
int main(int argc, char *argv[])
{
Drawable drawable;
GLXContextID xid;
char * displname = getenv ("DISPLAY");
cout << "displname = " << displname << endl;
cout << "************ take values from master *********" << endl;
cout << "drawable = ";
cin >> drawable;
cout << "contextid = ";
cin >> xid;
Display * display = XOpenDisplay (displname);
cout << "display = " << display << endl;
Window win;
int wx, wy;
unsigned int ww, wh, bw, depth;
XGetGeometry(display, drawable, &win,
&wx, &wy, &ww, &wh, &bw, &depth);
cout << "window-props: x = " << wx << ", y = " << wy
<< ", w = " << ww << ", h = " << wh << ", depth = " << depth
<< ", root-win = " << win << endl;
cout << "extensionstring = " << glXQueryExtensionsString(display, 0) << endl;
// make a new GLXContext
// first, generate a visual (copied from togl)
int attrib_list[] =
{
GLX_USE_GL,
GLX_RGBA,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
// GLX_ALPHA_SIZE, 8,
GLX_DEPTH_SIZE, 1,
// GLX_DOUBLEBUFFER,
None
};
XVisualInfo * visinfo = glXChooseVisual(display, 0, attrib_list);
if (visinfo)
{
cout << "found VISINFO !!!" << endl;
int hi = 0;
cout << "attribs = ";
while (attrib_list[hi] != None)
cout << attrib_list[hi++] << " ";
cout << endl;
cout << "visid = " << visinfo->visualid << endl;
cout << "screen = " << visinfo->screen << endl;
cout << "depth = " << visinfo->depth << endl;
cout << "class = " << visinfo->c_class << endl;
cout << "rgb mask = "
<< visinfo->red_mask << "/" << visinfo->green_mask << "/" << visinfo->blue_mask << endl;
cout << "bits_per_rgb = " << visinfo -> bits_per_rgb << endl;
}
else
{
cerr << "no VISINFO found" << endl;
exit(1);
}
cout << "now, import glxcontext ..." << endl;
GLXContext impcontext = glXImportContextEXT ( display, xid );
cout << "ImportedContext: " << endl
<< "isdirect " << glXIsDirect (display, impcontext) << endl;
cout << "impcontext = " << impcontext << endl;
GLXContext context;
// context = glXCreateContext( display, visinfo, 0, False );
context = glXCreateContext( display, visinfo, impcontext, False);
cout << "context = " << context << endl;
cout << "make current ... " << endl;
glXMakeCurrent (display, drawable, context);
cout << "have current" << endl;
cout << "error = " << glGetError() << endl;
glClear(GL_COLOR_BUFFER_BIT); /* clear the display */
glColor3f(1.0, 1.0, 1.0); /* set current color to white */
glBegin(GL_POLYGON); /* draw filled triangle */
glVertex2i(200,125); /* specify each vertex of triangle */
glVertex2i(100,375);
glVertex2i(300,375);
glEnd(); /* OpenGL draws the filled triangle */
glFlush();
return 0;
}
master.cpp
(text/x-c++src, 2.3 KB)
// c++ master.cpp -lGL -lGLU -lglut -o master
#include <iostream>
using namespace std;
#include <stdlib.h>
#include <string.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <GL/glu.h>
#include <GL/glut.h>
// #include <GL/glxext.h>
void displayCB(void) /* function called whenever redisplay needed */
{
glClear(GL_COLOR_BUFFER_BIT); /* clear the display */
glColor3f(1.0, 1.0, 1.0); /* set current color to white */
glBegin(GL_POLYGON); /* draw filled triangle */
glVertex2i(200,125); /* specify each vertex of triangle */
glVertex2i(100,375);
glVertex2i(300,375);
glEnd(); /* OpenGL draws the filled triangle */
glFlush(); /* Complete any pending operations */
}
void keyCB(unsigned char key, int x, int y) /* called on key press */
{
if( key == 'q' ) exit(0);
}
int main(int argc, char *argv[])
{
if (argc != 2 || strcmp(argv[1], "-indirect") != 0)
cerr << "start with 'master -indirect' to create indirect rendering context" << endl;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA);
glutInitWindowSize(400,500);
Window win = glutCreateWindow("Triangle");
string displname = XDisplayName (0);
Display * dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
GLXContext ctx = glXGetCurrentContext();
GLXContextID xid = glXGetContextIDEXT (ctx);
cout << "master: displname = " << displname << endl;
cout << "master: extensionstring = " << glXQueryExtensionsString(dpy, 0) << endl;
cout << "********** please enter these values for slave **********" << endl;
cout << "master: drawable = " << drawable << endl;
cout << "master: contextid = " << xid << endl;
cout << "**********************************************************" << endl;
/*
int value;
glXQueryContextInfoEXT (dpy, ctx, GLX_SHARE_CONTEXT_EXT, &value);
cout << "GLX_SHARE_CONTEXT_EXT = " << value << endl;
glXQueryContextInfoEXT (dpy, ctx, GLX_VISUAL_ID_EXT, &value);
cout << "GLX_VISUAL_ID_EXT = " << value << endl;
glXQueryContextInfoEXT (dpy, ctx, GLX_SCREEN_EXT, &value);
cout << "GLX_SCREEN_EXT = " << value << endl;
*/
glClearColor(0.0,0.0,0.0,0.0);
gluOrtho2D(0,400,0,500);
glutDisplayFunc(displayCB);
glutKeyboardFunc(keyCB);
glutMainLoop();
return 0;
}