Xvfb problems with OpenGL feedback buffer

Joe Miller lpe540 at yahoo.com
Tue Dec 4 10:09:24 PST 2007


Hi,

I'm having some problems running an opengl application in Xvfb, where
 the Xvfb server keeps dying. After some investigation, it looks like the
 problem occurs when I change the glFeedbackBuffer size from something
 very large (on order of 40,000,000 floating point array) to something
 smaller (4,000,000) and then change the glRenderMode from GL_FEEDBACK to
 GL_RENDER. I've included a small program below, which I think displays
 the problem I'm having (note this program was written explicitly to
 flush out the problems I'm having). While the program below segv's when I
 try to run it in Xvfb, a much more involved program where I first
 discovered the issue returns the following error message
   ChipsServer: Fatal IO error 14 (Bad address) on X server :6966.0.
Both seemed to be caused by the same issue. I don't have any problems
 running either program with the standard X-Server. The problem only
 happens with a very large buffer size. I'm running on Redhat Enterprise 8,
 using X.Org version 6.8.2. 

I'd appreciate any thoughts or suggestions. If you need any more
 information please let me know.

Thanks in advance.

-joe

I use the following command to run Xvfb

  g++ -g test.cc -lGL -lGLU -lglut
  setenv DISPLAY :01
  Xvfb :01 -ac &
  ./a.out



#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glut.h>

#include <iostream>

using namespace std;

GLfloat *data = NULL;
int numpnts = 5000000;
int size = 2048*2048;
bool feedbackmode = true;

void RenderScene (void)
{
   glClear (GL_COLOR_BUFFER_BIT);

   glColor3f (1, 0, 0);
   float col = 0.0;
   float indx = 1.0/1000;
   for (int ii=0; ii<numpnts; ii++)
   {
      glBegin (GL_POINTS);
      glVertex3f (125, 120, 0);
      glEnd ();
   }
   cerr << "SCENE RENDERED " << endl;
   glFinish ();
}

void IdleCallback (int time)
{
   cerr << "SWITCH FEEDBACK " << feedbackmode << endl;
   if (feedbackmode)
   {
      int params[1];

      glGetIntegerv (GL_RENDER_MODE, &params[0]);
      if (params[0] != GL_FEEDBACK)
      {
         cerr << "CHANGE TO FEEDBACK MODE" << endl;
         if (data)
            delete []data;

         data = new GLfloat [size];
         glFeedbackBuffer (size, GL_3D_COLOR, data);
         glRenderMode (GL_FEEDBACK);
      }

      // next time through change to render mode
      feedbackmode = false;
   }
   else
   {
      int used = 0;
      int params[1];

      glGetIntegerv (GL_RENDER_MODE, &params[0]);
      if (params[0] != GL_RENDER)
      {
         cerr << "CHANGE TO RENDER MODE" << endl;
         used = glRenderMode (GL_RENDER);
      }
      // If used is less than zero the buffer size wasn't large enough
 for all the gl primatives.
      // increase the buffer size. If the buffer size was large enough
 reset it back to something small.
      if (used < 0)
         size += 2048*2048;
      else 
         size = 2048 * 2048;

      // next time through change to feedback mode
      feedbackmode = true;
      cerr << "USED " << used << " " << size << endl;
   }

   glutPostRedisplay ();
   glutTimerFunc (2500,IdleCallback,0);
}


int main (int argc, char *argv[])
{
   glutInit (&argc, argv);
   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGBA);
   glutInitWindowSize (250, 250);
   glutCreateWindow ("GRSDisplay");

   glutDisplayFunc (RenderScene);
 

   glMatrixMode (GL_PROJECTION);
   glLoadIdentity ();

   glOrtho (0.0, 250.0, 0.0, 250.0, 1.0, -1.0);

   glMatrixMode (GL_MODELVIEW);
   glLoadIdentity ();

   glClearColor (0, 0, 0, 1);
   glutTimerFunc (2500,IdleCallback,0);

   glutMainLoop ();
}






      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping



More information about the xorg mailing list