segfault in multithread OpenGL app on i915

Nickolay Kolchin nbkolchin at gmail.com
Fri Sep 29 16:11:58 PDT 2006


Hello,

I have a weird problem with multithread application on i915 chipset
(i810 DRI driver). Application segfaults when trying to use OpenGL
functions from second thread.

All necessary initialization is perfomed in application, ie XInitThreads, etc.

Tested on Suse 10.1 (xorg 6.8, 20050225 i810 driver) and Gentoo
LiveDVD (xorg 7.0, 1.4.2 i810 driver).

This code works fine with NVidia drivers. (for several years)

Is this a driver bug? a Mesa bug? a well-known bug that nobody is
going to fix in near future? Or this is my programming error?

[code]
static void* cbOpenglTest1(void*)
{
  while(1)
  {
    XLockDisplay(display);
    if(!glXMakeCurrent(display, x_win, x_glxContext))
    {
      printf("glXMakeCurrent failed\n");
      exit(0);
    }
    int err = glGetError(); // <- SEGFAULT here :(
    L_INFO("OpenGL Error: %i", err);
    if(!glXMakeCurrent(display, 0, 0))
    {
      printf("glXMakeCurrent failed\n");
      exit(0);
    }
    XUnlockDisplay(display);
    usleep(100);
  }
  return 0;
}

static void Expose()
{
  XLockDisplay(display);
  if(!glXMakeCurrent(display, win, glxContext))
  {
    printf("glXMakeCurrent failed\n");
    exit(0);
  }
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glColor3f(1.0, 0.0, 0.0);
  glRectf(-0.5, -0.5, 0.5, 0.5);
  swapBuffers();
  if(!glXMakeCurrent(display, 0, 0))
  {
    printf("glXMakeCurrent failed\n");
    exit(0);
  }
  XUnlockDisplay(display);
}
[/code]

--
Nickolay



More information about the xorg mailing list